feat(tst_communityNavigation): Implemented community leave test

This commit is contained in:
Igor Sirotin 2023-01-25 15:16:58 +03:00 committed by Igor Sirotin
parent 55d39aa7c7
commit 6017a01b9a
9 changed files with 94 additions and 18 deletions

View File

@ -111,6 +111,7 @@ class ConfirmationDialog(Enum):
SIGN_OUT_CONFIRMATION: str = "signOutConfirmation_StatusButton"
class CommunitiesSettingsScreen(Enum):
LIST_PANEL: str = "settings_Communities_CommunitiesListPanel"
LEAVE_COMMUNITY_BUTTONS: str = "settings_Communities_MainView_LeaveCommunityButtons"
LEAVE_COMMUNITY_POPUP_LEAVE_BUTTON: str = "settings_Communities_MainView_LeavePopup_LeaveCommunityButton"
@ -264,10 +265,18 @@ class SettingsScreen:
def open_communities_section(self):
click_obj_by_name(SidebarComponents.COMMUNITIES_OPTION.value)
def leave_community(self):
# In our case we have only one visible community and only one button
click_obj_by_name(CommunitiesSettingsScreen.LEAVE_COMMUNITY_BUTTONS.value)
click_obj_by_name(CommunitiesSettingsScreen.LEAVE_COMMUNITY_POPUP_LEAVE_BUTTON.value)
def leave_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:
buttons = get_children_with_object_name(delegate, "CommunitiesListPanel_leaveCommunityPopupButton")
verify(len(buttons) > 0, "Leave community button exists")
click_obj(buttons[0])
click_obj_by_name(CommunitiesSettingsScreen.LEAVE_COMMUNITY_POPUP_LEAVE_BUTTON.value)
return
verify(False, "Community left")
def open_profile_settings(self):
verify_object_enabled(SidebarComponents.PROFILE_OPTION.value)

View File

@ -118,7 +118,8 @@ ProfilePopup_SayWhoYouAre_TextEdit = {"container": statusDesktop_mainWindow_over
ProfilePopup_SendContactRequest_Button = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileSendContactRequestModal_sendContactRequestButton", "type": "StatusButton"}
# Communities Settings:
settings_Communities_MainView_LeaveCommunityButtons = {"container": statusDesktop_mainWindow, "objectName":"CommunitiesListPanel_leaveCommunityPopupButton", "type": "StatusBaseButton", "visible": True}
settings_Communities_CommunitiesListPanel = { "container": statusDesktop_mainWindow, "objectName": "CommunitiesView_communitiesListPanel", "type": "StatusListView" }
settings_Communities_MainView_LeaveCommunityButtons = { "container": statusDesktop_mainWindow, "objectName": "CommunitiesListPanel_leaveCommunityPopupButton", "type": "StatusBaseButton", "visible": True }
settings_Communities_MainView_LeavePopup_LeaveCommunityButton = {"container": statusDesktop_mainWindow, "objectName":"CommunitiesListPanel_leaveCommunityButtonInPopup", "type": "StatusBaseButton", "visible": True}
# Advanced Settings:

View File

@ -140,9 +140,9 @@ def step(context: any):
def step(context: any):
_settingsScreen.open_communities_section()
@When("the user leaves the community")
def step(context: any):
_settingsScreen.leave_community()
@When("the user leaves \"|any|\" community")
def step(context: any, communityName):
_settingsScreen.leave_community(communityName)
@When("the user opens the profile settings")
def step(context: any):

View File

@ -146,6 +146,10 @@ def step(context, user_name, message):
def step(context, user_name):
_statusCommunityScreen.kick_member_from_community(user_name)
@When("the user opens the community portal section")
def step(context: any):
init_steps.the_user_opens_the_community_portal_section()
#########################
### VERIFICATIONS region:
#########################

View File

@ -114,13 +114,4 @@ Feature: Status Desktop community
Then the community channel has emoji "<new_emoji>"
Examples:
| new_emoji_description | new_emoji |
| thumbs up | 👍 |
# TODO: This scenario must be in a different feature since it does not accomplishe the start/en sequence and / or background
# Add new test case that contains scenarios related to create/delete and navigate throw communities and usage of navbar.
#@merge
#Scenario: User leaves community
# When the user opens app settings screen
# And the user opens the communities settings
# And the user leaves the community
# Then the count of communities in navbar is 0
| thumbs up | 👍 |

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# This file contains hook functions to run as the .feature file is executed
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../testSuites/global_shared/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/"))
import steps.commonInitSteps as init_steps
# Global properties for the specific feature
_user = "tester123"
_password = "TesTEr16843/!@00"
@OnFeatureStart
def hook(context):
init_steps.context_init(context, testSettings)
init_steps.signs_up_process_steps(context, _user, _password)
@OnFeatureEnd
def hook(context):
currentApplicationContext().detach()
snooze(_app_closure_timeout)
@OnStepEnd
def hook(context):
context.userData["step_name"] = context._data["text"]

View File

@ -0,0 +1,36 @@
#******************************************************************************
# Status.im
#*****************************************************************************/
#/**
# * \file test.feature
# *
# * \test Status Desktop - Community
# * \date January 2023
# **
# *****************************************************************************/
Feature: Status Desktop community navigation
As an admin user I want to create a community and be able to leave it.
The feature start sequence is the following (setup on its own `bdd_hooks`):
** given A first time user lands on the status desktop and generates new key
** when user signs up with username "tester123" and password "TesTEr16843/!@00"
** and the user lands on the signed in app
Scenario Outline: User creates and leaves community
# Create a community
Given the user opens the community portal section
And the user creates a community named "<community_name>", with description "My community description", intro "Community Intro" and outro "Community Outro"
And the user lands on the community named "<community_name>"
Then the count of communities in navbar is 1
# Leave a community
When the user opens app settings screen
And the user opens the communities settings
And the user leaves "<community_name>" community
# Switch back to portal to ensure that leaving procedure finished
When the user opens the community portal section
Then the count of communities in navbar is 0
Examples:
| community_name |
| My community 1 |

View File

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

View File

@ -100,6 +100,8 @@ SettingsContentBase {
CommunitiesListPanel {
id: communitiesList
objectName: "CommunitiesView_communitiesListPanel"
width: parent.width
model: SortFilterProxyModel {