diff --git a/test/ui-test/src/screens/SettingsScreen.py b/test/ui-test/src/screens/SettingsScreen.py index 74460e5a4e..96058d1bf0 100644 --- a/test/ui-test/src/screens/SettingsScreen.py +++ b/test/ui-test/src/screens/SettingsScreen.py @@ -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) diff --git a/test/ui-test/testSuites/global_shared/scripts/settings_names.py b/test/ui-test/testSuites/global_shared/scripts/settings_names.py index 917f7a9efd..97497a5dbb 100644 --- a/test/ui-test/testSuites/global_shared/scripts/settings_names.py +++ b/test/ui-test/testSuites/global_shared/scripts/settings_names.py @@ -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: diff --git a/test/ui-test/testSuites/global_shared/steps/settingsSteps.py b/test/ui-test/testSuites/global_shared/steps/settingsSteps.py index 1a7795366f..3d66d5d731 100644 --- a/test/ui-test/testSuites/global_shared/steps/settingsSteps.py +++ b/test/ui-test/testSuites/global_shared/steps/settingsSteps.py @@ -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): diff --git a/test/ui-test/testSuites/suite_communities/shared/steps/communitySteps.py b/test/ui-test/testSuites/suite_communities/shared/steps/communitySteps.py index b0e78091a4..dde18f621e 100644 --- a/test/ui-test/testSuites/suite_communities/shared/steps/communitySteps.py +++ b/test/ui-test/testSuites/suite_communities/shared/steps/communitySteps.py @@ -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: ######################### diff --git a/test/ui-test/testSuites/suite_communities/tst_communityFlows/test.feature b/test/ui-test/testSuites/suite_communities/tst_communityFlows/test.feature index bf3a15cba3..aa62bce940 100644 --- a/test/ui-test/testSuites/suite_communities/tst_communityFlows/test.feature +++ b/test/ui-test/testSuites/suite_communities/tst_communityFlows/test.feature @@ -114,13 +114,4 @@ Feature: Status Desktop community Then the community channel has 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 \ No newline at end of file + | thumbs up | 👍 | \ No newline at end of file diff --git a/test/ui-test/testSuites/suite_communities/tst_communityNavigation/bdd_hooks.py b/test/ui-test/testSuites/suite_communities/tst_communityNavigation/bdd_hooks.py new file mode 100644 index 0000000000..fd2e2303c9 --- /dev/null +++ b/test/ui-test/testSuites/suite_communities/tst_communityNavigation/bdd_hooks.py @@ -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"] \ No newline at end of file diff --git a/test/ui-test/testSuites/suite_communities/tst_communityNavigation/test.feature b/test/ui-test/testSuites/suite_communities/tst_communityNavigation/test.feature new file mode 100644 index 0000000000..a8a4d256fb --- /dev/null +++ b/test/ui-test/testSuites/suite_communities/tst_communityNavigation/test.feature @@ -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 "", with description "My community description", intro "Community Intro" and outro "Community Outro" + And the user lands on the community named "" + 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 + # 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 | \ No newline at end of file diff --git a/test/ui-test/testSuites/suite_communities/tst_communityNavigation/test.py b/test/ui-test/testSuites/suite_communities/tst_communityNavigation/test.py new file mode 100644 index 0000000000..e69956ffa6 --- /dev/null +++ b/test/ui-test/testSuites/suite_communities/tst_communityNavigation/test.py @@ -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') diff --git a/ui/app/AppLayouts/Profile/views/CommunitiesView.qml b/ui/app/AppLayouts/Profile/views/CommunitiesView.qml index 8b06c0de42..e5c766e573 100644 --- a/ui/app/AppLayouts/Profile/views/CommunitiesView.qml +++ b/ui/app/AppLayouts/Profile/views/CommunitiesView.qml @@ -100,6 +100,8 @@ SettingsContentBase { CommunitiesListPanel { id: communitiesList + + objectName: "CommunitiesView_communitiesListPanel" width: parent.width model: SortFilterProxyModel {