From e88369a83eb8708748b8258ec81b5e91b1a3db79 Mon Sep 17 00:00:00 2001 From: Anastasiya Semiankevich Date: Wed, 31 May 2023 18:00:31 +0300 Subject: [PATCH] tst_communityManageOverview): add scenario that copies community private key --- test/ui-test/src/screens/SettingsScreen.py | 2 +- .../src/screens/StatusCommunityScreen.py | 20 ++++++++++-- ...word_popup.py => change_password_popup.py} | 0 .../community_back_up_private_key_popup.py | 18 +++++++++++ .../shared/scripts/community_names.py | 8 +++++ .../suite_communities/shared/scripts/names.py | 2 +- .../shared/steps/communitySteps.py | 6 +++- .../testSuites/suite_communities/suite.conf | 2 +- .../tst_communityManageCommunity/test.feature | 13 +------- .../tst_communityManageMembers/test.feature | 0 .../tst_communityManageMembers/test.py | 13 ++++++++ .../tst_communityManageOverview/test.feature | 31 +++++++++++++++++++ .../tst_communityManageOverview/test.py | 13 ++++++++ .../CommunityOverviewSettingsPanel.qml | 3 ++ .../community/TransferOwnershipPopup.qml | 1 + 15 files changed, 113 insertions(+), 19 deletions(-) rename test/ui-test/src/screens/components/{cahange_password_popup.py => change_password_popup.py} (100%) create mode 100644 test/ui-test/src/screens/components/community_back_up_private_key_popup.py create mode 100644 test/ui-test/testSuites/suite_communities/tst_communityManageMembers/test.feature create mode 100644 test/ui-test/testSuites/suite_communities/tst_communityManageMembers/test.py create mode 100644 test/ui-test/testSuites/suite_communities/tst_communityManageOverview/test.feature create mode 100644 test/ui-test/testSuites/suite_communities/tst_communityManageOverview/test.py diff --git a/test/ui-test/src/screens/SettingsScreen.py b/test/ui-test/src/screens/SettingsScreen.py index 51fbb3f8d3..719e0d9ff0 100644 --- a/test/ui-test/src/screens/SettingsScreen.py +++ b/test/ui-test/src/screens/SettingsScreen.py @@ -19,7 +19,7 @@ from utils.ObjectAccess import * from .StatusMainScreen import MainScreenComponents from .StatusMainScreen import authenticate_popup_enter_password -from .components.cahange_password_popup import ChangePasswordPopup +from .components.change_password_popup import ChangePasswordPopup from .components.social_links_popup import SocialLinksPopup diff --git a/test/ui-test/src/screens/StatusCommunityScreen.py b/test/ui-test/src/screens/StatusCommunityScreen.py index 387ec60b43..8cd392d936 100644 --- a/test/ui-test/src/screens/StatusCommunityScreen.py +++ b/test/ui-test/src/screens/StatusCommunityScreen.py @@ -19,6 +19,7 @@ from drivers.SDKeyboardCommands import * from .StatusMainScreen import StatusMainScreen from utils.FileManager import * from screens.StatusChatScreen import MessageContentType +from screens.components.community_back_up_private_key_popup import BackUpCommunityPrivateKeyPopup from utils.ObjectAccess import * class CommunityCreateMethods(Enum): @@ -88,7 +89,7 @@ class CommunityWelcomeScreenComponents(Enum): WELCOME_SCREEN_CHECKLIST_ELEMENT1 = "community_welcome_screen_checkList_element1" WELCOME_SCREEN_CHECKLIST_ELEMENT2 = "community_welcome_screen_checkList_element2" WELCOME_SCREEN_CHECKLIST_ELEMENT3 = "community_welcome_screen_checkList_element3" - ADD_NEW_ITEM_BUTTON = "community_welcome_screen_add_new_item" + ADD_NEW_ITEM_BUTTON = "community_welcome_screen_add_new_item" class CommunityColorPanelComponents(Enum): HEX_COLOR_INPUT = "communitySettings_ColorPanel_HexColor_Input" @@ -109,6 +110,12 @@ class CreateOrEditCommunityCategoryPopup(Enum): COMMUNITY_CATEGORY_BUTTON: str = "createOrEditCommunityCategoryBtn_StatusButton" MODAL_CLOSE_BUTTON = "modal_Close_Button" +class CommunityOverviewScreenComponents(Enum): + # Constants definitions: + COMMUNITY_PRIVATE_KEY_LENGHT_UI = 35 # length of community PK on the Transfer Ownership popup + # Components: + COMMUNITY_OVERVIEW_BACK_UP_BUTTON ="communityOverview_Back_up_StatusButton" + class StatusCommunityScreen: def __init__(self): @@ -563,5 +570,12 @@ class StatusCommunityScreen: def verify_action_button_enabled(self, option:str): assert BaseElement(str(CommunityWelcomeScreenComponents.ADD_NEW_ITEM_BUTTON.value)).is_enabled button_title = get_obj(CommunityWelcomeScreenComponents.ADD_NEW_ITEM_BUTTON.value).text - verify_equals(option, str(button_title)) - \ No newline at end of file + verify_equals(option, str(button_title)) + + def verify_community_private_key(self): + Button(CommunityOverviewScreenComponents.COMMUNITY_OVERVIEW_BACK_UP_BUTTON.value).click() + transferOwnershipPopup = BackUpCommunityPrivateKeyPopup().wait_until_appears() + transferOwnershipPopup.copy_community_private_key() + community_private_key = transferOwnershipPopup.private_key + assert len(community_private_key) == (CommunityOverviewScreenComponents.COMMUNITY_PRIVATE_KEY_LENGHT_UI.value), f"Current key length: {len(community_private_key)}" + assert community_private_key.startswith("0x"), f"Current private key does not start with 0x: {community_private_key}" \ No newline at end of file diff --git a/test/ui-test/src/screens/components/cahange_password_popup.py b/test/ui-test/src/screens/components/change_password_popup.py similarity index 100% rename from test/ui-test/src/screens/components/cahange_password_popup.py rename to test/ui-test/src/screens/components/change_password_popup.py diff --git a/test/ui-test/src/screens/components/community_back_up_private_key_popup.py b/test/ui-test/src/screens/components/community_back_up_private_key_popup.py new file mode 100644 index 0000000000..c1d622fbac --- /dev/null +++ b/test/ui-test/src/screens/components/community_back_up_private_key_popup.py @@ -0,0 +1,18 @@ +from drivers.SquishDriver import * + +from .base_popup import BasePopup + + +class BackUpCommunityPrivateKeyPopup(BasePopup): + def __init__(self): + super(BackUpCommunityPrivateKeyPopup, self).__init__() + self._copy_private_key_button = Button('copyCommunityPrivateKeyButton') + self._community_private_key_text_edit = TextEdit('transferOwnerShipTextEdit') + + @property + def private_key(self) -> str: + return self._community_private_key_text_edit.text + + def copy_community_private_key(self): + self._copy_private_key_button.click() + diff --git a/test/ui-test/testSuites/suite_communities/shared/scripts/community_names.py b/test/ui-test/testSuites/suite_communities/shared/scripts/community_names.py index 2c9a9c1b7f..f454916914 100644 --- a/test/ui-test/testSuites/suite_communities/shared/scripts/community_names.py +++ b/test/ui-test/testSuites/suite_communities/shared/scripts/community_names.py @@ -85,6 +85,14 @@ communitySettings_EditCommunity_ColorPicker_Button = {"container": communitySett communitySettings_ColorPanel_HexColor_Input = {"container": statusDesktop_mainWindow_overlay, "objectName": "communityColorPanelHexInput", "type": "TextEdit", "visible": True} communitySettings_SaveColor_Button = {"container": statusDesktop_mainWindow_overlay, "objectName": "communityColorPanelSelectColorButton", "type": "StatusButton", "visible": True} +# Community Overview +communityOverview_Back_up_Banner = {"container": statusDesktop_mainWindow, "objectName": "backUpBanner", "type": "CommunityBanner", "visible": True} +communityOverview_Back_up_StatusButton = {"container": communityOverview_Back_up_Banner, "objectName": "communityBannerButton", "type": "StatusButton", "visible": True} +transferOwnerShipTextEdit = {"container": statusDesktop_mainWindow_overlay, "id": "edit", "type": "TextEdit", "unnamed": 1, "visible": True} + +# Community transfer ownership +copyCommunityPrivateKeyButton = {"container": statusDesktop_mainWindow, "objectName": "copyCommunityPrivateKeyButton", "type": "StatusButton", "visible": True} + # Community welcome screen community_welcome_screen_image = {"container": statusDesktop_mainWindow, "objectName": "welcomeSettingsImage", "type": "Image", "visible": True} community_welcome_screen_title = {"container": statusDesktop_mainWindow, "objectName": "welcomeSettingsTitle", "type": "StatusBaseText", "visible": True} diff --git a/test/ui-test/testSuites/suite_communities/shared/scripts/names.py b/test/ui-test/testSuites/suite_communities/shared/scripts/names.py index 56e8bca568..f94aa944e9 100644 --- a/test/ui-test/testSuites/suite_communities/shared/scripts/names.py +++ b/test/ui-test/testSuites/suite_communities/shared/scripts/names.py @@ -8,4 +8,4 @@ from scripts.settings_names import * from community_names import * from community_portal_names import * -from search_names import * \ No newline at end of file +from search_names import * 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 c4858fd1be..418f532f1a 100644 --- a/test/ui-test/testSuites/suite_communities/shared/steps/communitySteps.py +++ b/test/ui-test/testSuites/suite_communities/shared/steps/communitySteps.py @@ -266,7 +266,11 @@ def step(context, option:str, list): @Then("\"|any|\" button is present") def step (context, action_button_name): - _statusCommunityScreen.verify_action_button_enabled(action_button_name) + _statusCommunityScreen.verify_action_button_enabled(action_button_name) + +@Then("the user is able to open Back up modal and copy private key") +def step(context): + _statusCommunityScreen.verify_community_private_key() ########################################################################### diff --git a/test/ui-test/testSuites/suite_communities/suite.conf b/test/ui-test/testSuites/suite_communities/suite.conf index 7d2639ca30..989acd590d 100644 --- a/test/ui-test/testSuites/suite_communities/suite.conf +++ b/test/ui-test/testSuites/suite_communities/suite.conf @@ -4,6 +4,6 @@ HOOK_SUB_PROCESSES=true IMPLICITAUTSTART=0 LANGUAGE=Python OBJECTMAPSTYLE=script -TEST_CASES=tst_communityFlows tst_searchFlows tst_communityMessageFlows tst_communityMemberFlows tst_communityAdminFlows tst_communityManageCommunity tst_communityManagePermissions tst_communityManageMintTokens tst_communityManageAirdrops +TEST_CASES=tst_communityFlows tst_searchFlows tst_communityMessageFlows tst_communityMemberFlows tst_communityAdminFlows tst_communityManageCommunity tst_communityManageOverview tst_communityManageMembers tst_communityManagePermissions tst_communityManageMintTokens tst_communityManageAirdrops VERSION=3 WRAPPERS=Qt diff --git a/test/ui-test/testSuites/suite_communities/tst_communityManageCommunity/test.feature b/test/ui-test/testSuites/suite_communities/tst_communityManageCommunity/test.feature index 41b081faa8..d476df8da1 100644 --- a/test/ui-test/testSuites/suite_communities/tst_communityManageCommunity/test.feature +++ b/test/ui-test/testSuites/suite_communities/tst_communityManageCommunity/test.feature @@ -17,15 +17,4 @@ Background: | Members | | Permissions| | Mint Tokens| - | Airdrops | - - Scenario Outline: Manage community -> Overview: community admin edits the community name, description and color - When the admin renames the community to "" and description to "" and color to "" - Then the community overview name is "" - And the community overview description is "" - And the community overview color is "" - When the admin goes back to the community - Then the user lands on the community named "" - Examples: - | new_community_name | new_community_description | new_community_color | - | myCommunityNamedChanged | Cool new description 123 | #ff0000 | \ No newline at end of file + | Airdrops | \ No newline at end of file diff --git a/test/ui-test/testSuites/suite_communities/tst_communityManageMembers/test.feature b/test/ui-test/testSuites/suite_communities/tst_communityManageMembers/test.feature new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/ui-test/testSuites/suite_communities/tst_communityManageMembers/test.py b/test/ui-test/testSuites/suite_communities/tst_communityManageMembers/test.py new file mode 100644 index 0000000000..b081b9494d --- /dev/null +++ b/test/ui-test/testSuites/suite_communities/tst_communityManageMembers/test.py @@ -0,0 +1,13 @@ +source(findFile('scripts', 'python/bdd.py')) + +setupHooks('../../global_shared/scripts/bdd_hooks.py') +collectStepDefinitions('./steps', '../shared/steps/', '../../global_shared/steps/','../../suite_onboarding/shared/steps/') + +import configs + + +def main(): + testSettings.throwOnFailure = True + configs.path.TMP.mkdir(parents=True, exist_ok=True) + runFeatureFile('test.feature') + configs.path.TMP.rmtree(ignore_errors=True) \ No newline at end of file diff --git a/test/ui-test/testSuites/suite_communities/tst_communityManageOverview/test.feature b/test/ui-test/testSuites/suite_communities/tst_communityManageOverview/test.feature new file mode 100644 index 0000000000..6d13463d91 --- /dev/null +++ b/test/ui-test/testSuites/suite_communities/tst_communityManageOverview/test.feature @@ -0,0 +1,31 @@ +#****************************************************************************** +# User flows that could be done (intiated) from Overview page, accessile by Open community - Manage button +#*****************************************************************************/ + +Feature: Community -> Manage Community -> Overview page + +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: Community admin is able to back up community key from community overview page + When "Manage Community" is clicked in the community sidebar + And "Overview" section is selected + Then the user is able to open Back up modal and copy private key + + + Scenario Outline: Manage community -> Overview: community admin edits the community name, description and color + When the admin renames the community to "" and description to "" and color to "" + Then the community overview name is "" + And the community overview description is "" + And the community overview color is "" + When the admin goes back to the community + Then the user lands on the community named "" + Examples: + | new_community_name | new_community_description | new_community_color | + | myCommunityNamedChanged | Cool new description 123 | #ff0000 | \ No newline at end of file diff --git a/test/ui-test/testSuites/suite_communities/tst_communityManageOverview/test.py b/test/ui-test/testSuites/suite_communities/tst_communityManageOverview/test.py new file mode 100644 index 0000000000..b081b9494d --- /dev/null +++ b/test/ui-test/testSuites/suite_communities/tst_communityManageOverview/test.py @@ -0,0 +1,13 @@ +source(findFile('scripts', 'python/bdd.py')) + +setupHooks('../../global_shared/scripts/bdd_hooks.py') +collectStepDefinitions('./steps', '../shared/steps/', '../../global_shared/steps/','../../suite_onboarding/shared/steps/') + +import configs + + +def main(): + testSettings.throwOnFailure = True + configs.path.TMP.mkdir(parents=True, exist_ok=True) + runFeatureFile('test.feature') + configs.path.TMP.rmtree(ignore_errors=True) \ No newline at end of file diff --git a/ui/app/AppLayouts/Chat/panels/communities/CommunityOverviewSettingsPanel.qml b/ui/app/AppLayouts/Chat/panels/communities/CommunityOverviewSettingsPanel.qml index 1dcb3b86f9..e656f5de28 100644 --- a/ui/app/AppLayouts/Chat/panels/communities/CommunityOverviewSettingsPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/communities/CommunityOverviewSettingsPanel.qml @@ -136,6 +136,7 @@ StackLayout { RowLayout { CommunityBanner { + objectName: "invitePeopleBanner" text: qsTr("Welcome to your community!") buttonText: qsTr("Invite new people") icon.name: "invite-users" @@ -145,6 +146,7 @@ StackLayout { Layout.fillWidth: true } CommunityBanner { + objectName: "airdropBanner" text: qsTr("Try an airdrop to reward your community for engagement!") buttonText: qsTr("Airdrop Tokens") icon.name: "airdrop" @@ -156,6 +158,7 @@ StackLayout { } CommunityBanner { + objectName: "backUpBanner" text: qsTr("Back up community key") buttonText: qsTr("Back up") icon.name: "objects" diff --git a/ui/app/AppLayouts/Chat/popups/community/TransferOwnershipPopup.qml b/ui/app/AppLayouts/Chat/popups/community/TransferOwnershipPopup.qml index 3c2f3a12c2..97ab106a52 100644 --- a/ui/app/AppLayouts/Chat/popups/community/TransferOwnershipPopup.qml +++ b/ui/app/AppLayouts/Chat/popups/community/TransferOwnershipPopup.qml @@ -53,6 +53,7 @@ StatusDialog { borderColor: Theme.palette.primaryColor1 size: StatusBaseButton.Size.Tiny text: qsTr("Copy") + objectName: "copyCommunityPrivateKeyButton" onClicked: { text = qsTr("Copied") root.store.copyToClipboard(root.privateKey)