2023-10-13 15:55:44 +00:00
|
|
|
import allure
|
|
|
|
|
|
|
|
import configs.timeouts
|
|
|
|
import driver
|
2023-11-08 14:33:16 +00:00
|
|
|
from gui.components.settings.keycard_popup import KeycardPopup
|
2023-10-13 15:55:44 +00:00
|
|
|
from gui.elements.button import Button
|
|
|
|
from gui.elements.object import QObject
|
|
|
|
from gui.elements.scroll import Scroll
|
2024-07-09 10:05:39 +00:00
|
|
|
from gui.objects_map import settings_names
|
2023-10-13 15:55:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
class KeycardSettingsView(QObject):
|
|
|
|
|
|
|
|
def __init__(self):
|
2024-07-09 10:05:39 +00:00
|
|
|
super(KeycardSettingsView, self).__init__(settings_names.mainWindow_KeycardView)
|
2024-07-10 05:00:53 +00:00
|
|
|
self._scroll = Scroll(settings_names.settingsContentBase_ScrollView)
|
2024-07-09 10:05:39 +00:00
|
|
|
self._setup_keycard_with_existing_account_button = Button(settings_names.setupFromExistingKeycardAccount_StatusListItem)
|
|
|
|
self._create_new_keycard_account_button = Button(settings_names.createNewKeycardAccount_StatusListItem)
|
|
|
|
self._import_restore_via_seed_phrase_button = Button(settings_names.importRestoreKeycard_StatusListItem)
|
|
|
|
self._import_from_keycard_button = Button(settings_names.importFromKeycard_StatusListItem)
|
|
|
|
self._check_whats_on_keycard_button = Button(settings_names.checkWhatsNewKeycard_StatusListItem)
|
|
|
|
self._factory_reset_keycard_button = Button(settings_names.factoryResetKeycard_StatusListItem)
|
2023-10-13 15:55:44 +00:00
|
|
|
|
2024-07-19 06:43:44 +00:00
|
|
|
@allure.step('Wait until appears {0}')
|
|
|
|
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
|
|
|
self._create_new_keycard_account_button.wait_until_appears(timeout_msec)
|
|
|
|
return self
|
|
|
|
|
2023-10-13 15:55:44 +00:00
|
|
|
@allure.step('Check that keycard screen displayed')
|
|
|
|
def check_keycard_screen_loaded(self):
|
|
|
|
assert KeycardSettingsView().is_visible
|
|
|
|
|
2023-11-02 13:51:38 +00:00
|
|
|
@allure.step('Choose create new keycard account with new seed phrase')
|
|
|
|
def click_create_new_account_with_new_seed_phrase(self):
|
|
|
|
self._create_new_keycard_account_button.click()
|
2023-11-08 14:33:16 +00:00
|
|
|
return KeycardPopup().wait_until_appears()
|
|
|
|
|
|
|
|
@allure.step('Choose import or restore keycard via seed phrase')
|
|
|
|
def click_import_restore_via_seed_phrase(self):
|
2024-07-19 06:43:44 +00:00
|
|
|
self._scroll.vertical_scroll_down(self._import_restore_via_seed_phrase_button)
|
2023-11-08 14:33:16 +00:00
|
|
|
self._import_restore_via_seed_phrase_button.click()
|
|
|
|
return KeycardPopup().wait_until_appears()
|
2023-11-02 13:51:38 +00:00
|
|
|
|
2023-11-10 11:34:49 +00:00
|
|
|
@allure.step('Choose setup keycard with an existing account')
|
|
|
|
def click_setup_keycard_with_existing_account(self):
|
2024-07-19 06:43:44 +00:00
|
|
|
self._scroll.vertical_scroll_down(self._setup_keycard_with_existing_account_button)
|
2023-11-10 11:34:49 +00:00
|
|
|
self._setup_keycard_with_existing_account_button.click()
|
|
|
|
return KeycardPopup().wait_until_appears()
|
|
|
|
|
2023-11-10 15:30:47 +00:00
|
|
|
@allure.step('Choose check whats on keycard')
|
|
|
|
def click_check_whats_on_keycard(self):
|
2024-07-19 06:43:44 +00:00
|
|
|
self._scroll.vertical_scroll_down(self._check_whats_on_keycard_button)
|
2023-11-10 15:30:47 +00:00
|
|
|
self._check_whats_on_keycard_button.click()
|
|
|
|
return KeycardPopup().wait_until_appears()
|
|
|
|
|
2023-11-15 16:28:11 +00:00
|
|
|
@allure.step('Choose factory reset a keycard')
|
|
|
|
def click_factory_reset_keycard(self):
|
2024-07-19 06:43:44 +00:00
|
|
|
self._scroll.vertical_scroll_down(self._factory_reset_keycard_button)
|
2023-11-15 16:28:11 +00:00
|
|
|
self._factory_reset_keycard_button.click()
|
|
|
|
return KeycardPopup().wait_until_appears()
|
|
|
|
|
2023-10-13 15:55:44 +00:00
|
|
|
@allure.step('Check that all keycard options displayed')
|
|
|
|
def all_keycard_options_available(self):
|
|
|
|
assert self._setup_keycard_with_existing_account_button.is_visible, f'Setup keycard with existing account not visible'
|
|
|
|
assert self._create_new_keycard_account_button.is_visible, f'Create new keycard button not visible'
|
|
|
|
assert self._import_restore_via_seed_phrase_button.is_visible, f'Import and restore via seed phrase button not visible'
|
2024-07-10 05:00:53 +00:00
|
|
|
self._scroll.vertical_scroll_down(self._import_from_keycard_button)
|
2023-10-13 15:55:44 +00:00
|
|
|
assert driver.waitFor(lambda: self._import_from_keycard_button.is_visible,
|
|
|
|
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), f'Import keycard button not visible'
|
2024-07-19 06:43:44 +00:00
|
|
|
self._scroll.vertical_scroll_down(self._check_whats_on_keycard_button)
|
2023-10-13 15:55:44 +00:00
|
|
|
assert driver.waitFor(lambda: self._check_whats_on_keycard_button.is_visible,
|
|
|
|
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), f'Check whats new keycard button not visible'
|
2024-07-10 05:00:53 +00:00
|
|
|
self._scroll.vertical_scroll_down(self._factory_reset_keycard_button)
|
2023-10-13 15:55:44 +00:00
|
|
|
assert driver.waitFor(lambda: self._factory_reset_keycard_button.is_visible,
|
|
|
|
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), f'Factory reset keycard button not visible'
|