From fe78d6f01f64c9a1e2e204c696d45e4250933251 Mon Sep 17 00:00:00 2001 From: Valentina Novgorodtceva Date: Fri, 19 Jul 2024 16:09:50 +0700 Subject: [PATCH] chore: fleet change --- test/e2e/conftest.py | 22 +++++++++++++- test/e2e/driver/aut.py | 1 + .../gui/components/settings/fleet_popup.py | 30 +++++++++++++++++++ test/e2e/gui/components/splash_screen.py | 2 ++ test/e2e/gui/objects_map/names.py | 8 ++++- test/e2e/gui/objects_map/settings_names.py | 1 + test/e2e/gui/screens/settings_advanced.py | 7 +++++ test/e2e/tests/settings/test_switch_fleet.py | 16 ++++++++++ .../AppLayouts/Profile/popups/FleetsModal.qml | 2 ++ .../AppLayouts/Profile/views/AdvancedView.qml | 1 + 10 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 test/e2e/gui/components/settings/fleet_popup.py create mode 100644 test/e2e/tests/settings/test_switch_fleet.py diff --git a/test/e2e/conftest.py b/test/e2e/conftest.py index 5eb5aa823e..ef44712599 100644 --- a/test/e2e/conftest.py +++ b/test/e2e/conftest.py @@ -1,4 +1,5 @@ import logging +import time from datetime import datetime import os @@ -10,6 +11,10 @@ from PIL import ImageGrab import configs from configs.system import get_platform from fixtures.path import generate_test_info +from gui.components.onboarding.beta_consent_popup import BetaConsentPopup +from gui.components.splash_screen import SplashScreen +from gui.main_window import MainWindow +from gui.screens.onboarding import LoginView from scripts.utils.system_path import SystemPath # Send logs to pytest.log as well @@ -45,7 +50,8 @@ def setup_function_scope( generate_test_data, check_result, application_logs, - keycard_controller + keycard_controller, + switch_to_status_staging ): # FIXME: broken due to KeyError: <_pytest.stash.StashKey object at 0x7fd1ba6d78c0> # caplog.set_level(configs.LOG_LEVEL) @@ -73,3 +79,17 @@ def pytest_exception_interact(node): ) except FileNotFoundError: print("Screenshot was not generated or saved") + + +@pytest.fixture +def switch_to_status_staging(aut, main_screen, user_account, request): + if request.module.marks.mark.name in ['communities', 'settings_messaging', + 'messaging'] and 'tests-e2e-new' in str(configs.AUT_PATH): + LOG.info(f"Path is {str(request.path)}") + settings = main_screen.left_panel.open_settings() + settings.left_panel.open_advanced_settings().switch_fleet().choose_fleet('statusStagingOption').confirm() + aut.restart() + LoginView().log_in(user_account) + SplashScreen().wait_until_appears().wait_until_hidden() + if not configs.system.TEST_MODE: + BetaConsentPopup().confirm() diff --git a/test/e2e/driver/aut.py b/test/e2e/driver/aut.py index 3af4cd0392..97a969c808 100644 --- a/test/e2e/driver/aut.py +++ b/test/e2e/driver/aut.py @@ -102,6 +102,7 @@ class AUT: f'--port={self.port}', str(self.path), f'--datadir={self.app_data}', + '--enable-fleet-selection', f'--LOG_LEVEL={configs.testpath.LOG_LEVEL}', ] try: diff --git a/test/e2e/gui/components/settings/fleet_popup.py b/test/e2e/gui/components/settings/fleet_popup.py new file mode 100644 index 0000000000..0e17a35ec6 --- /dev/null +++ b/test/e2e/gui/components/settings/fleet_popup.py @@ -0,0 +1,30 @@ +import allure + +import configs +from gui.components.base_popup import BasePopup +from gui.elements.button import Button +from gui.objects_map import names + + +class FleetPopup(BasePopup): + + def __init__(self): + super().__init__() + self._fleet_option_template = Button(names.fleet_option_template) + self._confirm_button = Button(names.confirm_change_fleet_statusButton) + + @allure.step('Wait until appears {0}') + def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC): + self._fleet_option_template.wait_until_appears(timeout_msec) + return self + + @allure.step('Choose fleet') + def choose_fleet(self, fleet_object_name: str): + self._fleet_option_template.real_name['objectName'] = fleet_object_name + self._fleet_option_template.click() + return self + + @allure.step('Confirm') + def confirm(self): + self._confirm_button.click(timeout=None) + self.wait_until_hidden() \ No newline at end of file diff --git a/test/e2e/gui/components/splash_screen.py b/test/e2e/gui/components/splash_screen.py index 5f51d13825..3d59df7268 100644 --- a/test/e2e/gui/components/splash_screen.py +++ b/test/e2e/gui/components/splash_screen.py @@ -1,6 +1,7 @@ import allure import configs +from driver.toplevel_window import set_focus from gui.elements.object import QObject from gui.objects_map import names @@ -17,4 +18,5 @@ class SplashScreen(QObject): @allure.step('Wait until hidden {0}') def wait_until_hidden(self, timeout_msec: int = configs.timeouts.APP_LOAD_TIMEOUT_MSEC): + self.click() super().wait_until_hidden(timeout_msec) diff --git a/test/e2e/gui/objects_map/names.py b/test/e2e/gui/objects_map/names.py index 5cd6264e16..8471ccfcdb 100644 --- a/test/e2e/gui/objects_map/names.py +++ b/test/e2e/gui/objects_map/names.py @@ -7,7 +7,7 @@ mainWindow_StatusWindow = {"name": "mainWindow", "type": "StatusWindow", "visibl statusDesktop_mainWindow_overlay = {"container": statusDesktop_mainWindow, "type": "Overlay", "unnamed": 1, "visible": True} 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"} +splashScreen = {"container": statusDesktop_mainWindow, "objectName": "splashScreen", "type": "DidYouKnowSplashScreen", "visible": True} mainWindow_LoadingAnimation = {"container": statusDesktop_mainWindow, "objectName": "loadingAnimation", "type": "LoadingAnimation", "visible": True} # Common names @@ -438,6 +438,12 @@ mainWindow_settingsDirtyToastMessage_SettingsDirtyToastMessage = {"container": " # Confirm switch waku mode popup iUnderstandStatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "id": "confirmButton", "type": "StatusButton", "unnamed": 1, "visible": True} +# Fleet popup +fleet_option_template = {"container": statusDesktop_mainWindow_overlay, "objectName": "shardsTestOption", "type": "FleetRadioSelector", "visible": True} +shardsTestOption_FleetRadioSelector = {"container": statusDesktop_mainWindow_overlay, "objectName": "shardsTestOption", "type": "FleetRadioSelector", "visible": True} +statusStagingOption_FleetRadioSelector = {"container": statusDesktop_mainWindow_overlay, "objectName": "statusStagingOption", "type": "FleetRadioSelector", "visible": True} +confirm_change_fleet_statusButton = {"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} diff --git a/test/e2e/gui/objects_map/settings_names.py b/test/e2e/gui/objects_map/settings_names.py index cec1df5797..7fead4dcc2 100644 --- a/test/e2e/gui/objects_map/settings_names.py +++ b/test/e2e/gui/objects_map/settings_names.py @@ -179,3 +179,4 @@ manageCommunitiesOnTestnetButton_StatusSettingsLineButton = {"container": mainWi 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} +settingsContentBaseScrollView_fleetButton_StatusSettingsLineButton = {"container": mainWindow_settingsContentBaseScrollView_StatusScrollView, "objectName": "fleetButton", "type": "StatusSettingsLineButton", "visible": True} diff --git a/test/e2e/gui/screens/settings_advanced.py b/test/e2e/gui/screens/settings_advanced.py index ed11820ff4..a419d0ab64 100644 --- a/test/e2e/gui/screens/settings_advanced.py +++ b/test/e2e/gui/screens/settings_advanced.py @@ -1,6 +1,7 @@ import allure from gui.components.settings.confirm_switch_waku_mode_popup import SwitchWakuModePopup +from gui.components.settings.fleet_popup import FleetPopup from gui.elements.button import Button from gui.elements.object import QObject from gui.elements.scroll import Scroll @@ -17,6 +18,7 @@ class AdvancedSettingsView(QObject): self._enable_creation_community_button = Button(settings_names.enableCreateCommunityButton_StatusSettingsLineButton) self._light_mode_button = Button(settings_names.settingsContentBaseScrollViewLightWakuModeBloomSelectorButton) self._relay_mode_button = Button(settings_names.settingsContentBaseScrollViewRelayWakuModeBloomSelectorButton) + self._fleet_button = Button(settings_names.settingsContentBaseScrollView_fleetButton_StatusSettingsLineButton) @allure.step('Switch manage community on testnet option') def switch_manage_on_community(self): @@ -46,3 +48,8 @@ class AdvancedSettingsView(QObject): return self._light_mode_button.is_checked elif mode == 'relay': return self._relay_mode_button.is_checked + + @allure.step('Switch fleet') + def switch_fleet(self): + self._fleet_button.click() + return FleetPopup().wait_until_appears() diff --git a/test/e2e/tests/settings/test_switch_fleet.py b/test/e2e/tests/settings/test_switch_fleet.py new file mode 100644 index 0000000000..a6f93cf121 --- /dev/null +++ b/test/e2e/tests/settings/test_switch_fleet.py @@ -0,0 +1,16 @@ +import allure +import pytest + +from . import marks + +import constants +from gui.main_window import MainWindow + +pytestmark = marks + + +@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703630', 'Create community') +@pytest.mark.case(703630) +@pytest.mark.parametrize('params', [constants.community_params]) +def test_switch_fleet(aut, user_account, main_screen: MainWindow, params, switch_to_status_staging): + pass \ No newline at end of file diff --git a/ui/app/AppLayouts/Profile/popups/FleetsModal.qml b/ui/app/AppLayouts/Profile/popups/FleetsModal.qml index 239902125f..73565289dc 100644 --- a/ui/app/AppLayouts/Profile/popups/FleetsModal.qml +++ b/ui/app/AppLayouts/Profile/popups/FleetsModal.qml @@ -42,12 +42,14 @@ ModalPopup { } FleetRadioSelector { + objectName: "shardsTestOption" advancedStore: popup.advancedStore fleetName: Constants.shards_test buttonGroup: fleetSettings } FleetRadioSelector { + objectName: "statusStagingOption" advancedStore: popup.advancedStore fleetName: Constants.status_staging buttonGroup: fleetSettings diff --git a/ui/app/AppLayouts/Profile/views/AdvancedView.qml b/ui/app/AppLayouts/Profile/views/AdvancedView.qml index 7b82f3ecc8..556be96fc4 100644 --- a/ui/app/AppLayouts/Profile/views/AdvancedView.qml +++ b/ui/app/AppLayouts/Profile/views/AdvancedView.qml @@ -59,6 +59,7 @@ SettingsContentBase { anchors.leftMargin: 0 anchors.rightMargin: 0 text: qsTr("Fleet") + objectName: "fleetButton" currentValue: root.advancedStore.fleet onClicked: fleetModal.open() visible: root.isFleetSelectionEnabled