From e1bb235b4ef8f5127609eca4fb38693ac5a2e1ac Mon Sep 17 00:00:00 2001 From: Valentina Novgorodtceva Date: Tue, 2 Jul 2024 14:24:03 +0700 Subject: [PATCH] chore: method to set waku mode added --- .../confirm_switch_waku_mode_popup.py | 22 +++++++++++++++++++ test/e2e/gui/elements/object.py | 15 ++++++++----- test/e2e/gui/objects_map/names.py | 14 +++++++----- test/e2e/gui/screens/onboarding.py | 4 ++++ test/e2e/gui/screens/settings_advanced.py | 22 +++++++++++++++++++ .../AppLayouts/Profile/views/AdvancedView.qml | 3 +++ ui/app/mainui/SplashScreen.qml | 1 + 7 files changed, 70 insertions(+), 11 deletions(-) create mode 100644 test/e2e/gui/components/settings/confirm_switch_waku_mode_popup.py diff --git a/test/e2e/gui/components/settings/confirm_switch_waku_mode_popup.py b/test/e2e/gui/components/settings/confirm_switch_waku_mode_popup.py new file mode 100644 index 0000000000..c81dcc3de4 --- /dev/null +++ b/test/e2e/gui/components/settings/confirm_switch_waku_mode_popup.py @@ -0,0 +1,22 @@ +import allure + +import configs +from gui.components.base_popup import BasePopup +from gui.elements.button import Button +from gui.objects_map import names + + +class SwitchWakuModePopup(BasePopup): + + def __init__(self): + super().__init__() + self._i_understand_button = Button(names.iUnderstandStatusButton) + + @allure.step('Wait until appears {0}') + def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC): + self._i_understand_button.wait_until_appears(timeout_msec) + return self + + @allure.step('Click i understand button') + def confirm(self): + self._i_understand_button.click(timeout=None) diff --git a/test/e2e/gui/elements/object.py b/test/e2e/gui/elements/object.py index b5010699c4..27202596a9 100644 --- a/test/e2e/gui/elements/object.py +++ b/test/e2e/gui/elements/object.py @@ -100,7 +100,7 @@ class QObject: x: int = None, y: int = None, button=None, - timeout=1, + timeout=1 ): driver.mouseClick( self.object, @@ -111,11 +111,16 @@ class QObject: LOG.info('%s: is clicked with Qt.LeftButton', self) LOG.info("Checking if application context is frozen") - if not isFrozen(timeout): + if timeout is None: pass - else: - LOG.info("Application context did not respond after click") - raise Exception(f'Application UI is not responding within {timeout} second(s)') + + if timeout is not None: + if not isFrozen(timeout): + pass + + else: + LOG.info("Application context did not respond after click") + raise Exception(f'Application UI is not responding within {timeout} second(s)') @allure.step('Native click {0}') def native_mouse_click( diff --git a/test/e2e/gui/objects_map/names.py b/test/e2e/gui/objects_map/names.py index f7b45f522a..13df38561a 100644 --- a/test/e2e/gui/objects_map/names.py +++ b/test/e2e/gui/objects_map/names.py @@ -8,6 +8,7 @@ statusDesktop_mainWindow_overlay = {"container": statusDesktop_mainWindow, "type statusDesktop_mainWindow_overlay_popup2 = {"container": statusDesktop_mainWindow_overlay, "occurrence": 2, "type": "PopupItem", "unnamed": 1, "visible": True} scrollView_StatusScrollView = {"container": statusDesktop_mainWindow_overlay, "id": "scrollView", "type": "StatusScrollView", "unnamed": 1, "visible": True} splashScreen = {"container": statusDesktop_mainWindow, "objectName": "splashScreen", "type": "DidYouKnowSplashScreen"} +mainWindow_LoadingAnimation = {"container": statusDesktop_mainWindow, "objectName": "loadingAnimation", "type": "LoadingAnimation", "visible": True} # Common names settingsSave_StatusButton = {"container": statusDesktop_mainWindow, "objectName": "settingsDirtyToastMessageSaveButton", "type": "StatusButton", "visible": True} @@ -406,6 +407,9 @@ linksView = {"container": statusDesktop_mainWindow, "id": "linksView", "type": " # Changes detected popup mainWindow_settingsDirtyToastMessage_SettingsDirtyToastMessage = {"container": ":statusDesktop_mainWindow", "id": "settingsDirtyToastMessage", "type": "SettingsDirtyToastMessage", "unnamed": 1, "visible": True} +# Confirm switch waku mode popup +iUnderstandStatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "id": "confirmButton", "type": "StatusButton", "unnamed": 1, "visible": True} + # Back up seed phrase banner mainWindow_secureYourSeedPhraseBanner_ModuleWarning = {"container": statusDesktop_mainWindow, "objectName": "secureYourSeedPhraseBanner", "type": "ModuleWarning", "visible": True} mainWindow_secureYourSeedPhraseBanner_Button = {"container": statusDesktop_mainWindow, "id": "button", "text": "Back up now", "type": "Button", "unnamed": 1, "visible": True} @@ -687,16 +691,13 @@ mainWindow_EnsRegisteredView = {"container": statusDesktop_mainWindow, "type": " mainWindow_AdvancedView = {"container": mainWindow_StatusWindow, "type": "AdvancedView", "unnamed": 1, "visible": True} mainWindow_settingsContentBaseScrollView_StatusScrollView = {"container": mainWindow_StatusWindow, "objectName": "settingsContentBaseScrollView", "type": "StatusScrollView", "visible": True} manageCommunitiesOnTestnetButton_StatusSettingsLineButton = {"container": mainWindow_settingsContentBaseScrollView_StatusScrollView, "objectName": "manageCommunitiesOnTestnetButton", "type": "StatusSettingsLineButton", "visible": True} +enableCreateCommunityButton_StatusSettingsLineButton = {"container": settingsContentBase_ScrollView, "objectName": "enableCreateCommunityButton", "type": "StatusSettingsLineButton", "visible": True} +settingsContentBaseScrollViewLightWakuModeBloomSelectorButton = {"container": mainWindow_settingsContentBaseScrollView_StatusScrollView, "objectName": "lightWakuModeButton", "type": "BloomSelectorButton", "visible": True} +settingsContentBaseScrollViewRelayWakuModeBloomSelectorButton = {"container": mainWindow_settingsContentBaseScrollView_StatusScrollView, "objectName": "relayWakuModeButton", "type": "BloomSelectorButton", "visible": True} # ONBOARDING NAMES mainWindow_onboardingBackButton_StatusRoundButton = {"container": statusDesktop_mainWindow, "objectName": "onboardingBackButton", "type": "StatusRoundButton", "visible": True} -# Advanced view -mainWindow_AdvancedView = {"container": mainWindow_StatusWindow, "type": "AdvancedView", "unnamed": 1, "visible": True} -mainWindow_settingsContentBaseScrollView_StatusScrollView = {"container": mainWindow_StatusWindow, "objectName": "settingsContentBaseScrollView", "type": "StatusScrollView", "visible": True} -manageCommunitiesOnTestnetButton_StatusSettingsLineButton = {"container": mainWindow_settingsContentBaseScrollView_StatusScrollView, "objectName": "manageCommunitiesOnTestnetButton", "type": "StatusSettingsLineButton", "visible": True} -enableCreateCommunityButton_StatusSettingsLineButton = {"container": settingsContentBase_ScrollView, "objectName": "enableCreateCommunityButton", "type": "StatusSettingsLineButton", "visible": True} - # Allow Notification View mainWindow_AllowNotificationsView = {"container": statusDesktop_mainWindow, "type": "AllowNotificationsView", "unnamed": 1, "visible": True} mainWindow_Start_using_Status_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow, "objectName": "allowNotificationsOnboardingOkButton", "type": "StatusButton", "visible": True} @@ -803,6 +804,7 @@ accountsView_accountListPanel = {"container": statusDesktop_mainWindow, "objectN mainWindow_txtPassword_Input = {"container": statusDesktop_mainWindow, "id": "txtPassword", "type": "Input", "unnamed": 1, "visible": True} loginView_addNewUserItem_AccountMenuItemPanel = {"container": statusDesktop_mainWindow_overlay, "index": 0, "objectName": "LoginView_addNewUserItem", "type": "AccountMenuItemPanel", "visible": True} o_AccountMenuItemPanel = {"container": statusDesktop_mainWindow_overlay, "index": 1, "type": "AccountMenuItemPanel", "unnamed": 1, "visible": True} +mainWindowUsePasswordInsteadStatusBaseText = {"container": statusDesktop_mainWindow, "text": "Use password instead", "type": "StatusBaseText", "unnamed": 1, "visible": True} # Touch ID Auth View mainWindow_TouchIDAuthView = {"container": statusDesktop_mainWindow, "type": "TouchIDAuthView", "unnamed": 1, "visible": True} diff --git a/test/e2e/gui/screens/onboarding.py b/test/e2e/gui/screens/onboarding.py index 851780354b..dbaa5f5125 100755 --- a/test/e2e/gui/screens/onboarding.py +++ b/test/e2e/gui/screens/onboarding.py @@ -613,6 +613,7 @@ class LoginView(QObject): self._password_object = QObject(names.mainWindow_txtPassword_Input) self._add_new_user_item = QObject(names.loginView_addNewUserItem_AccountMenuItemPanel) self._add_existing_user_item = QObject(names.o_AccountMenuItemPanel) + self._use_password_instead = QObject(names.mainWindowUsePasswordInsteadStatusBaseText) @property @allure.step('Get login error message') @@ -626,6 +627,9 @@ class LoginView(QObject): self._change_account_button.click() self.select_user_name(account.name) + if self._use_password_instead.is_visible: + self._use_password_instead.click() + self._password_text_edit.text = account.password self._arrow_right_button.click() diff --git a/test/e2e/gui/screens/settings_advanced.py b/test/e2e/gui/screens/settings_advanced.py index 168e90d37b..5c64b7f267 100644 --- a/test/e2e/gui/screens/settings_advanced.py +++ b/test/e2e/gui/screens/settings_advanced.py @@ -1,5 +1,6 @@ import allure +from gui.components.settings.confirm_switch_waku_mode_popup import SwitchWakuModePopup from gui.elements.button import Button from gui.elements.object import QObject from gui.elements.scroll import Scroll @@ -14,6 +15,8 @@ class AdvancedSettingsView(QObject): self._manage_community_on_testnet_button = Button( names.manageCommunitiesOnTestnetButton_StatusSettingsLineButton) self._enable_creation_community_button = Button(names.enableCreateCommunityButton_StatusSettingsLineButton) + self._light_mode_button = Button(names.settingsContentBaseScrollViewLightWakuModeBloomSelectorButton) + self._relay_mode_button = Button(names.settingsContentBaseScrollViewRelayWakuModeBloomSelectorButton) @allure.step('Switch manage community on testnet option') def switch_manage_on_community(self): @@ -24,3 +27,22 @@ class AdvancedSettingsView(QObject): def enable_creation_of_communities(self): self._scroll.vertical_down_to(self._enable_creation_community_button) self._enable_creation_community_button.click() + + @allure.step('Switch waku mode') + def switch_waku_mode(self, mode): + if not self._manage_community_on_testnet_button.is_visible: + self._scroll.vertical_down_to(self._manage_community_on_testnet_button) + if mode == 'light': + self._light_mode_button.click() + elif mode == 'relay': + self._relay_mode_button.click() + return SwitchWakuModePopup().wait_until_appears() + + @allure.step('Verify waku mode enabled states') + def is_waku_mode_enabled(self, mode): + if not self._manage_community_on_testnet_button.is_visible: + self._scroll.vertical_down_to(self._manage_community_on_testnet_button) + if mode == 'light': + return self._light_mode_button.is_checked + elif mode == 'relay': + return self._relay_mode_button.is_checked diff --git a/ui/app/AppLayouts/Profile/views/AdvancedView.qml b/ui/app/AppLayouts/Profile/views/AdvancedView.qml index 1c874ab208..7b82f3ecc8 100644 --- a/ui/app/AppLayouts/Profile/views/AdvancedView.qml +++ b/ui/app/AppLayouts/Profile/views/AdvancedView.qml @@ -287,6 +287,7 @@ SettingsContentBase { BloomSelectorButton { id: btnWakuV2Light + objectName: "lightWakuModeButton" buttonGroup: wakuV2Group checkedByDefault: root.advancedStore.wakuV2LightClientEnabled btnText: qsTr("Light mode") @@ -297,6 +298,7 @@ SettingsContentBase { BloomSelectorButton { id: btnWakuV2Full + objectName: "relayWakuModeButton" buttonGroup: wakuV2Group checkedByDefault: !root.advancedStore.wakuV2LightClientEnabled btnText: qsTr("Relay mode") @@ -721,6 +723,7 @@ SettingsContentBase { showCancelButton: true confirmationText: d.experimentalFeatureMessage confirmButtonLabel: qsTr("I understand") + confirmButtonObjectName: "leaveGroupConfirmationDialogLeaveButton" onConfirmButtonClicked: { root.advancedStore.toggleExperimentalFeature(experimentalFeature) experimentalFeature = "" diff --git a/ui/app/mainui/SplashScreen.qml b/ui/app/mainui/SplashScreen.qml index f477f01126..5d1bf793a1 100644 --- a/ui/app/mainui/SplashScreen.qml +++ b/ui/app/mainui/SplashScreen.qml @@ -11,6 +11,7 @@ Item { ColumnLayout { anchors.centerIn: parent LoadingAnimation { + objectName: "loadingAnimation" Layout.alignment: Qt.AlignHCenter Layout.preferredWidth: 128 Layout.preferredHeight: 128