test(tst_communityPermissions): permissions setting is available

new scenario
This commit is contained in:
Magnus 2023-03-15 12:53:56 +00:00 committed by Noelia
parent 55ad5409f7
commit e19f0aa7f7
12 changed files with 100 additions and 39 deletions

View File

@ -37,6 +37,7 @@ class SidebarComponents(Enum):
class AdvancedOptionScreen(Enum):
ACTIVATE_OR_DEACTIVATE_WALLET: str = "walletSettingsLineButton"
ACTIVATE_OR_DEACTIVATE_COMMUNITY_PERMISSIONS: str = "communitySettingsLineButton"
I_UNDERSTAND_POP_UP: str = "i_understand_StatusBaseText"
class ENSScreen(Enum):
@ -137,6 +138,14 @@ class SettingsScreen:
def __init__(self):
verify_screen(SidebarComponents.ADVANCED_OPTION.value)
def open_advanced_settings(self):
click_obj_by_name(SidebarComponents.ADVANCED_OPTION.value)
def activate_community_permission_settings(self):
click_obj_by_name(AdvancedOptionScreen.ACTIVATE_OR_DEACTIVATE_COMMUNITY_PERMISSIONS.value)
click_obj_by_name(AdvancedOptionScreen.I_UNDERSTAND_POP_UP.value)
def open_wallet_settings(self):
click_obj_by_name(SidebarComponents.WALLET_OPTION.value)
@ -473,5 +482,13 @@ class SettingsScreen:
click_obj_by_name(ContactsViewScreen.CONTACT_REQUEST_PENDING_REQUEST_TAB_BUTTON.value)
contact_list = get_obj(ContactsViewScreen.RECEIVED_REQUESTS_CONTACT_PANEL_LIST_VIEW.value)
verify_equal(contact_list.count, 1, "Checking if there is exactly one pending contact request")
def open_community(self, community_name: str):
communities_list = get_obj(CommunitiesSettingsScreen.LIST_PANEL.value)
verify(communities_list.count > 0, "At least one joined community exists")
for i in range(communities_list.count):
delegate = communities_list.itemAtIndex(i)
if str(delegate.title) == community_name:
click_obj(delegate)
return
verify(False, "Community not found")

View File

@ -49,7 +49,8 @@ class CommunityScreenComponents(Enum):
MARK_AS_READ_BUTTON = "mark_as_Read_StatusMenuItem"
PIN_TEXT = "chatInfoButton_Pin_Text"
ADD_MEMBERS_BUTTON = "community_AddMembers_Button"
WELCOME_ADD_MEMBERS_BUTTON = "community_AddMembers_Button"
WELCOME_MANAGE_COMMUNITY = "community_ManageCommunity_Button"
EXISTING_CONTACTS_LISTVIEW = "community_InviteFirends_Popup_ExistinContacts_ListView"
INVITE_POPUP_NEXT_BUTTON = "community_InviteFriendsToCommunityPopup_NextButton"
INVITE_POPUP_MESSAGE_INPUT = "community_ProfilePopupInviteMessagePanel_MessageInput"
@ -67,6 +68,7 @@ class CommunitySettingsComponents(Enum):
COMMUNITY_DESCRIPTION_TEXT = "communitySettings_CommunityDescription_Text"
COMMUNITY_LETTER_IDENTICON = "communitySettings_Community_LetterIdenticon"
MEMBERS_BUTTON = "communitySettings_Members_NavigationListItem"
PERMISSIONS_BUTTON = "communitySettings_Permissions_NavigationListItem"
MEMBERS_TAB_MEMBERS_LISTVIEW = "communitySettings_MembersTab_Members_ListView"
MEMBER_KICK_BUTTON = "communitySettings_MembersTab_Member_Kick_Button"
MEMBER_CONFIRM_KICK_BUTTON = "communitySettings_KickModal_Kick_Button"
@ -374,7 +376,7 @@ class StatusCommunityScreen:
verify_equals(str(pin_text_obj.text), str(wanted_pin_count))
def invite_user_to_community(self, user_name: str, message: str):
click_obj_by_name(CommunityScreenComponents.ADD_MEMBERS_BUTTON.value)
click_obj_by_name(CommunityScreenComponents.WELCOME_ADD_MEMBERS_BUTTON.value)
contacts_list = wait_and_get_obj(CommunityScreenComponents.EXISTING_CONTACTS_LISTVIEW.value)
@ -444,3 +446,13 @@ class StatusCommunityScreen:
test.fail("Chat is not loaded")
click_obj_by_name(CommunityScreenComponents.MARK_AS_READ_BUTTON.value)
def click_sidebar_option(self, community_sidebar_option:str):
#TODO Make compatible with other sidebar options
if community_sidebar_option == "Manage Community":
click_obj_by_name(CommunityScreenComponents.WELCOME_MANAGE_COMMUNITY.value)
def verify_option_exists(self, option:str):
if option=="Permissions":
title = get_obj(CommunitySettingsComponents.PERMISSIONS_BUTTON.value).title
verify_text(option, str(title))

View File

@ -124,6 +124,7 @@ settings_Communities_MainView_LeavePopup_LeaveCommunityButton = {"container": st
# Advanced Settings:
walletSettingsLineButton = {"container": statusDesktop_mainWindow, "objectName": "WalletSettingsLineButton", "type": "StatusSettingsLineButton", "visible": True}
communitySettingsLineButton = {"container": statusDesktop_mainWindow, "objectName": "CommunitySettingsLineButton", "type": "StatusSettingsLineButton", "visible": True}
i_understand_StatusBaseText = {"container": statusDesktop_mainWindow_overlay, "text": "I understand", "type": "StatusBaseText", "unnamed": 1, "visible": True}
# Extra Settings:

View File

@ -58,6 +58,16 @@ def step(context):
@Given("the user opens own profile popup")
def step(context: any):
the_user_opens_own_profile_popup()
@Given("Application Settings \"|any|\" is open")
def step(context: any, settings_type:str):
#TODO: Implement parameters for settings
_settingsScreen.open_advanced_settings()
@Given("\"|any|\" is toggled on under Experimental features")
def step(context: any, settings_type:str):
#TODO: Implement parameters for settings
_settingsScreen.activate_community_permission_settings()
#########################
### ACTIONS region:
@ -121,7 +131,7 @@ def step(context):
@When("the user opens the language selector")
def step(context):
_languageScreen.open_language_combobox()
@When("the user selects the language |any|")
def step(context, native):
_languageScreen.select_language(native)
@ -135,7 +145,8 @@ def step(context, native):
def step(context: any):
ctx = currentApplicationContext()
_settingsScreen.sign_out_and_quit_the_app(ctx.pid)
@Given("the user opens the communities settings")
@When("the user opens the communities settings")
def step(context: any):
_settingsScreen.open_communities_section()
@ -197,7 +208,7 @@ def step(context: any):
_statusMain.navigate_to_edit_profile()
@When("the user closes the popup")
def step(context: any):
def step(context: any):
_statusMain.close_popup()
#########################
@ -269,6 +280,10 @@ def step(context):
def step(context):
_settingsScreen.verify_there_is_a_received_contact_request()
@Then("the user opens the community named \"|any|\"")
def step(context, community_name:str):
_settingsScreen.open_community(community_name)
###########################################################################
### COMMON methods used in different steps given/when/then region:
###########################################################################

View File

@ -18,6 +18,7 @@ mainWindow_chatInfoBtnInHeader_StatusChatInfoButton = {"container": statusDeskto
chatInput_Root = {"container": statusDesktop_mainWindow, "objectName": "statusChatInput", "type": "Rectangle", "visible": True}
emojiPopup_Emoji_Button_Placeholder = {"container": statusDesktop_mainWindow, "objectName": "statusEmoji_%NAME%", "type": "StatusEmoji", "visible": True}
community_AddMembers_Button = {"container": statusDesktop_mainWindow, "objectName": "CommunityWelcomeBannerPanel_AddMembersButton", "type": "StatusButton", "visible": True}
community_ManageCommunity_Button = {"container": statusDesktop_mainWindow, "objectName": "CommunityWelcomeBannerPanel_ManageCommunity", "type": "StatusFlatButton", "visible": True}
community_InviteFirends_Popup_InvitePanel = {"container": statusDesktop_mainWindow_overlay, "objectName": "CommunityProfilePopupInviteFrindsPanel_ColumnLayout", "type": "ColumnLayout", "visible": True}
community_InviteFirends_Popup_ExistinContacts_ListView = {"container": community_InviteFirends_Popup_InvitePanel, "objectName": "ExistingContacts_ListView", "type": "StatusListView", "visible": True}
community_InviteFriendsToCommunityPopup_NextButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "InviteFriendsToCommunityPopup_NextButton", "type": "StatusButton", "visible": True}
@ -25,6 +26,7 @@ community_InviteFriends_Popup_MessagePanel = {"container": statusDesktop_mainWin
community_ProfilePopupInviteMessagePanel_MessageInput = {"container": community_InviteFriends_Popup_MessagePanel, "objectName": "CommunityProfilePopupInviteMessagePanel_MessageInput", "type": "TextEdit", "visible": True}
community_InviteFriend_SendButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "InviteFriendsToCommunityPopup_SendButton", "type": "StatusButton", "visible": True}
communitySettings_Members_NavigationListItem = {"container": statusDesktop_mainWindow, "objectName": "CommunitySettingsView_NavigationListItem_Members", "type": "StatusNavigationListItem", "visible": True}
communitySettings_Permissions_NavigationListItem = {"container": statusDesktop_mainWindow, "objectName": "CommunitySettingsView_NavigationListItem_Permissions", "type": "StatusNavigationListItem", "visible": True}
communitySettings_MembersTab_Members_ListView = {"container": statusDesktop_mainWindow, "objectName": "CommunityMembersTabPanel_MembersListViews", "type": "ListView", "visible": True}
communitySettings_MembersTab_Member_Kick_Button = {"container": communitySettings_MembersTab_Members_ListView, "objectName": "MemberListIten_KickButton", "type": "StatusButton", "visible": True}
communitySettings_KickModal_Kick_Button = {"container": statusDesktop_mainWindow_overlay, "objectName": "CommunityMembers_KickModal_KickButton", "type": "StatusButton", "visible": True}

View File

@ -46,6 +46,10 @@ def step(context, category_name, channel_names, method):
def step(context, category_name, channel_names):
the_category_contains_channels(category_name, channel_names)
@Given("\"|any|\" is toggled on under Experimental features")
def step(context: any, settings_type:str):
#TODO: Implement parameters for settings
_settingsScreen.activate_community_permission_settings()
#########################
### ACTIONS region:
@ -154,6 +158,11 @@ def step(context: any):
def step(context, channel):
_statusCommunityScreen.mark_as_read(channel)
@When("\"|any|\" is clicked in the community sidebar")
def step(context, community_sidebar_option:str):
_statusCommunityScreen.click_sidebar_option(community_sidebar_option)
#########################
### VERIFICATIONS region:
#########################
@ -218,6 +227,11 @@ def step(context, communityDescription: str):
def step(context, color: str):
_statusCommunityScreen.verify_community_overview_color(color)
@Then("\"|any|\" should be an available option in Community Settings")
def step(context, manage_community_option:str):
_statusCommunityScreen.verify_option_exists(manage_community_option)
###########################################################################
### COMMON methods used in different steps given/when/then region:
###########################################################################

View File

@ -1,31 +0,0 @@
# -*- coding: utf-8 -*-
# A quick introduction to implementing scripts for BDD tests:
#
# This file contains snippets of script code to be executed as the .feature
# file is processed. See the section 'Behaviour Driven Testing' in the 'API
# Reference Manual' chapter of the Squish manual for a comprehensive reference.
#
# The decorators Given/When/Then/Step can be used to associate a script snippet
# with a pattern which is matched against the steps being executed. Optional
# table/multi-line string arguments of the step are passed via a mandatory
# 'context' parameter:
#
# @When("I enter the text")
# def whenTextEntered(context):
# <code here>
#
# The pattern is a plain string without the leading keyword, but a couple of
# placeholders including |any|, |word| and |integer| are supported which can be
# used to extract arbitrary, alphanumeric and integer values resp. from the
# pattern; the extracted values are passed as additional arguments:
#
# @Then("I get |integer| different names")
# def namesReceived(context, numNames):
# <code here>
#
# Instead of using a string with placeholders, a regular expression can be
# specified. In that case, make sure to set the (optional) 'regexp' argument
# to True.
import names

View File

@ -2,6 +2,6 @@ AUT=nim_status_client
ENVVARS=envvars
LANGUAGE=Python
OBJECTMAPSTYLE=script
TEST_CASES=tst_communityFlows tst_searchFlows tst_communityMessageFlows tst_communityMemberFlows tst_communityAdminFlows
TEST_CASES=tst_communityFlows tst_searchFlows tst_communityMessageFlows tst_communityMemberFlows tst_communityAdminFlows tst_communityPermissions
VERSION=3
WRAPPERS=Qt

View File

@ -0,0 +1,21 @@
Feature: Community Permissions
Background:
Given A first time user lands on the status desktop and generates new key
And the user signs up with username "tester123" and password "TesTEr16843/!@00"
And the user lands on the signed in app
And the user opens the community portal section
And the user lands on the community portal section
And the user creates a community named "Test-Community", with description "My community description", intro "Community Intro" and outro "Community Outro"
And the user lands on the community named "Test-Community"
Scenario: Enable community permissions feature
Given the user opens app settings screen
And Application Settings "Advanced" is open
And "Community Permissions Settings" is toggled on under Experimental features
And the user opens the communities settings
Then the user opens the community named "Test-Community"
And the user lands on the community named "Test-Community"
When "Manage Community" is clicked in the community sidebar
Then "Permissions" should be an available option in Community Settings

View File

@ -0,0 +1,8 @@
source(findFile('scripts', 'python/bdd.py'))
setupHooks('../../global_shared/scripts/bdd_hooks.py')
collectStepDefinitions('./steps', '../shared/steps/', '../../global_shared/steps/','../../suite_onboarding/shared/steps/')
def main():
testSettings.throwOnFailure = True
runFeatureFile('test.feature')

View File

@ -97,6 +97,7 @@ Rectangle {
StatusFlatButton {
id: manageBtn
objectName:"CommunityWelcomeBannerPanel_ManageCommunity"
text: qsTr("Manage community")
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: addMembersBtn.bottom

View File

@ -153,6 +153,7 @@ SettingsContentBase {
// TODO: replace with StatusQ component
StatusSettingsLineButton {
objectName: "CommunitySettingsLineButton"
anchors.leftMargin: 0
anchors.rightMargin: 0
text: qsTr("Community Permissions Settings")