diff --git a/test/e2e/configs/system.py b/test/e2e/configs/system.py index 69fd13ee27..f32f6855ef 100644 --- a/test/e2e/configs/system.py +++ b/test/e2e/configs/system.py @@ -9,3 +9,5 @@ def get_platform(): DISPLAY = os.getenv('DISPLAY', ':0') TEST_MODE = os.getenv('STATUS_RUNTIME_TEST_MODE') +CLOSE_KEYCARD_CONTROLLER = True + diff --git a/test/e2e/gui/main_window.py b/test/e2e/gui/main_window.py index 10e4d89c84..aa34f304f3 100644 --- a/test/e2e/gui/main_window.py +++ b/test/e2e/gui/main_window.py @@ -169,9 +169,8 @@ class MainWindow(Window): super(MainWindow, self).__init__(names.statusDesktop_mainWindow) self.left_panel = LeftPanel() - # TODO: we need to handle all the issues with keycard mock var before using keycard window in tests def prepare(self) -> 'Window': - MockedKeycardController().wait_until_appears().hide() + MockedKeycardController.keycard_handler() return super().prepare() @allure.step('Sign Up user') @@ -192,6 +191,7 @@ class MainWindow(Window): SplashScreen().wait_until_appears().wait_until_hidden() if not configs.system.TEST_MODE: BetaConsentPopup().confirm() + MockedKeycardController.keycard_handler() return self @allure.step('Log in user') @@ -200,6 +200,7 @@ class MainWindow(Window): SplashScreen().wait_until_appears().wait_until_hidden() if not configs.system.TEST_MODE: BetaConsentPopup().confirm() + MockedKeycardController.keycard_handler() return self @allure.step('Authorize user') diff --git a/test/e2e/gui/mocked_keycard_controller.py b/test/e2e/gui/mocked_keycard_controller.py index 04870de63f..8a2929c4ed 100644 --- a/test/e2e/gui/mocked_keycard_controller.py +++ b/test/e2e/gui/mocked_keycard_controller.py @@ -14,6 +14,13 @@ from gui.objects_map import names class MockedKeycardController(Window): + @staticmethod + def keycard_handler(): + mocked_keycard = MockedKeycardController() + if configs.system.TEST_MODE and configs.system.CLOSE_KEYCARD_CONTROLLER: + if mocked_keycard.is_visible: + mocked_keycard.hide() + def __init__(self): super(MockedKeycardController, self).__init__(names.QQuickApplicationWindow) self._plugin_reader_button = Button(names.plugin_Reader_StatusButton) diff --git a/test/e2e/gui/screens/settings.py b/test/e2e/gui/screens/settings.py index fa38c0b7f4..19922d3151 100644 --- a/test/e2e/gui/screens/settings.py +++ b/test/e2e/gui/screens/settings.py @@ -23,20 +23,19 @@ from functools import wraps def handle_settings_opening(view_class, menu_item): - def decorator(func): + def open_settings_decorator(func): @wraps(func) def wrapper(self, click_attempts=2): - if MockedKeycardController().exists: - MockedKeycardController().wait_until_appears().hide() + MockedKeycardController().keycard_handler() self._open_settings(menu_item) - if configs.system.TEST_MODE: - if click_attempts: - time.sleep(0.5) - return func(self, click_attempts - 1) + if click_attempts: + if configs.system.TEST_MODE: + time.sleep(1) + return func(self, click_attempts - 1) return wrapper - return decorator + return open_settings_decorator class LeftPanel(QObject):