diff --git a/test/e2e/constants/colors.py b/test/e2e/constants/colors.py index 9a4db292b4..7cd9917b93 100644 --- a/test/e2e/constants/colors.py +++ b/test/e2e/constants/colors.py @@ -51,4 +51,5 @@ boundaries = { class ColorCodes(Enum): GREEN = '#4ebc60' + BLUE = '#4360df' diff --git a/test/e2e/constants/keycard.py b/test/e2e/constants/keycard.py new file mode 100644 index 0000000000..13a636ef0d --- /dev/null +++ b/test/e2e/constants/keycard.py @@ -0,0 +1,18 @@ +from enum import Enum + + +class Keycard(Enum): + KEYCARD_PIN = '000000' + KEYCARD_NAME = 'Test Keycard' + ACCOUNT_NAME = 'Test Account' + KEYCARD_POPUP_HEADER = 'Create a new Keycard account with a new seed phrase' + KEYCARD_INSTRUCTIONS_PLUG_IN = 'Plug in Keycard reader...' + KEYCARD_INSTRUCTIONS_INSERT_KEYCARD = 'Insert Keycard...' + KEYCARD_RECOGNIZED = 'Keycard recognized' + KEYCARD_CHOOSE_PIN = 'Choose a Keycard PIN' + KEYCARD_NOTE = 'It is very important that you do not lose this PIN' + KEYCARD_REPEAT_PIN = 'Repeat Keycard PIN' + KEYCARD_PIN_SET = 'Keycard PIN set' + KEYCARD_NAME_IT = 'Name this Keycard' + KEYCARD_NAME_ACCOUNTS = 'Name accounts' + KEYCARD_NEW_ACCOUNT_CREATED = 'New account successfully created' diff --git a/test/e2e/ext/vp/settings/settings_keycard/test_keycard/test_create_keycard_account_with_new_seed_phrase/keycard_image_plugin_reader.png b/test/e2e/ext/vp/settings/settings_keycard/test_keycard/test_create_keycard_account_with_new_seed_phrase/keycard_image_plugin_reader.png new file mode 100644 index 0000000000..5216027e66 Binary files /dev/null and b/test/e2e/ext/vp/settings/settings_keycard/test_keycard/test_create_keycard_account_with_new_seed_phrase/keycard_image_plugin_reader.png differ diff --git a/test/e2e/gui/components/settings/keycard_popup.py b/test/e2e/gui/components/settings/keycard_popup.py new file mode 100644 index 0000000000..237a9b2cc3 --- /dev/null +++ b/test/e2e/gui/components/settings/keycard_popup.py @@ -0,0 +1,130 @@ +import time +import typing + +import allure + +import driver +from gui.components.base_popup import BasePopup +from gui.elements.button import Button +from gui.elements.object import QObject +from gui.elements.text_label import TextLabel +from scripts.tools.image import Image + + +class CreateNewKeycardAccountSeedPhrasePopup(BasePopup): + + def __init__(self): + super().__init__() + self._keycard_image = QObject('image_KeycardImage') + self._keycard_popup_header = TextLabel('headerTitle') + self._keycard_instruction_text = TextLabel('keycard_reader_instruction_text') + self._next_button = Button('nextStatusButton') + self._reveal_seed_phrase_button = Button('revealSeedPhraseButton') + self._seed_phrase_panel = QObject('seedPhraseWordAtIndex_Placeholder') + self._seed_phrase_first_word_component = QObject('word0_StatusInput') + self._seed_phrase_second_word_component = QObject('word1_StatusInput') + self._seed_phrase_third_word_component = QObject('word2_StatusInput') + self._field_object = QObject('edit_TextEdit') + self._keypair_item = QObject('o_KeyPairItem') + self._keypair_tag = QObject('o_StatusListItemTag') + + @property + @allure.step('Get keycard image') + def keycard_image(self) -> Image: + return self._keycard_image.image + + @property + @allure.step('Get keycard popup header') + def keycard_header(self) -> str: + return self._keycard_popup_header.text + + @property + @allure.step('Get keycard instructions') + def keycard_instructions(self) -> typing.List[str]: + return [str(getattr(instruction, 'text', '')) for instruction in + driver.findAllObjects(self._keycard_instruction_text.real_name)] + + @property + @allure.step('Get all text fields') + def get_text_fields(self) -> typing.List[str]: + return driver.findAllObjects(self._field_object.real_name) + + @property + @allure.step('Get seed phrases list') + def get_seed_phrases(self) -> typing.List[str]: + phrases = [] + for phrase_n in range(1, 13): + object_name = f'SeedPhraseWordAtIndex-{phrase_n}' + self._seed_phrase_panel.real_name['objectName'] = object_name + phrases.append(str(self._seed_phrase_panel.object.textEdit.input.edit.text)) + return phrases + + @property + @allure.step('Get keycard name in preview') + def keycard_preview_name(self) -> str: + return self._keypair_item.object.title + + @property + @allure.step('Get account name in preview') + def account_preview_name(self) -> str: + return self._keypair_tag.object.title + + @property + @allure.step('Get color in preview') + def preview_color(self) -> str: + return str(self._keypair_item.object.beneathTagsIconColor.name) + + @allure.step('Set pin') + def input_pin(self, pin): + driver.nativeType(pin) + + @allure.step('Click Next button') + def click_next(self): + self._next_button.click() + time.sleep(1) + return self + + @allure.step('Click reveal seed phrase button') + def reveal_seed_phrase(self): + self._reveal_seed_phrase_button.click() + return self + + @allure.step('Confirm first word in seed phrase') + def confirm_first_word(self, seed_phrase: typing.List[str]): + word_index = int(str(self._seed_phrase_first_word_component.object.label).split('Word #')[1]) + seed_word = seed_phrase[word_index - 1] + driver.type(self.get_text_fields[0], seed_word) + return self + + @allure.step('Confirm second word in seed phrase') + def confirm_second_word(self, seed_phrase: typing.List[str]): + word_index = int(str(self._seed_phrase_second_word_component.object.label).split('Word #')[1]) + seed_word = seed_phrase[word_index - 1] + driver.type(self.get_text_fields[1], seed_word) + return self + + @allure.step('Confirm third word in seed phrase') + def confirm_third_word(self, seed_phrase: typing.List[str]): + word_index = int(str(self._seed_phrase_third_word_component.object.label).split('Word #')[1]) + seed_word = seed_phrase[word_index - 1] + driver.type(self.get_text_fields[2], seed_word) + return self + + @allure.step('Name keycard') + def name_keycard(self, name: str): + driver.type(self.get_text_fields[0], name) + + @allure.step('Name account') + def name_account(self, name: str): + driver.type(self.get_text_fields[0], name) + + @allure.step('Create keycard account with seed phrase') + def create_keycard_account_with_seed_phrase(self, keycard_name: str, account_name: str): + time.sleep(1) + self.click_next().reveal_seed_phrase() + seed_phrases = self.get_seed_phrases + self.click_next() + self.confirm_first_word(seed_phrases).confirm_second_word(seed_phrases).confirm_third_word(seed_phrases) + self.click_next().name_keycard(keycard_name) + self.click_next().name_account(account_name) + self.click_next() diff --git a/test/e2e/gui/mocked_keycard_controller.py b/test/e2e/gui/mocked_keycard_controller.py new file mode 100644 index 0000000000..c7dafab4d5 --- /dev/null +++ b/test/e2e/gui/mocked_keycard_controller.py @@ -0,0 +1,44 @@ +import time + +import allure + +from gui.elements.button import Button +from gui.elements.object import QObject +from gui.elements.window import Window + + +class MockedKeycardController(Window): + + def __init__(self): + super(MockedKeycardController, self).__init__('QQuickApplicationWindow') + self._plugin_reader_button = Button('plugin_Reader_StatusButton') + self._unplug_reader_button = Button('unplug_Reader_StatusButton') + self._insert_keycard_1_button = Button('insert_Keycard_1_StatusButton') + self._insert_keycard_2_button = Button('insert_Keycard_2_StatusButton') + self._remove_keycard_button = Button('remove_Keycard_StatusButton') + self._reader_unplugged_button = Button('set_initial_reader_state_StatusButton') + self._empty_keycard_button = Button('set_initial_keycard_state_StatusButton') + self._register_keycard_button = Button('register_Keycard_StatusButton') + self._reader_unplugged_item = QObject('reader_Unplugged_StatusMenuItem') + self._keycard_not_inserted_item = QObject('keycard_Not_Inserted_StatusMenuItem') + self._keycard_inserted_item = QObject('keycard_Inserted_StatusMenuItem') + + @allure.step('Click Plug in reader') + def plugin_reader(self): + time.sleep(1) + self._plugin_reader_button.click() + time.sleep(2) + return self + + @allure.step('Click Register keycard') + def register_keycard(self): + time.sleep(1) + self._register_keycard_button.click() + time.sleep(1) + return self + + @allure.step('Click Insert Keycard 1') + def insert_keycard_1(self): + self._insert_keycard_1_button.click() + time.sleep(1) + return self diff --git a/test/e2e/gui/objects_map/__init__.py b/test/e2e/gui/objects_map/__init__.py index 7829d70605..84d7e68333 100644 --- a/test/e2e/gui/objects_map/__init__.py +++ b/test/e2e/gui/objects_map/__init__.py @@ -6,3 +6,4 @@ from .onboarding_names import * from .os_names import * from .settings_names import * from .wallet_names import * +from .mocked_keycard_controller_names import * diff --git a/test/e2e/gui/objects_map/component_names.py b/test/e2e/gui/objects_map/component_names.py index ef06d7ccd4..afabd7ba50 100644 --- a/test/e2e/gui/objects_map/component_names.py +++ b/test/e2e/gui/objects_map/component_names.py @@ -128,6 +128,8 @@ send_Contact_Request_StatusButton = {"container": statusDesktop_mainWindow_overl """ Common """ +edit_TextEdit = {"container": statusDesktop_mainWindow_overlay, "type": "TextEdit", "unnamed": 1, "visible": True} + # Select Color Popup 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} @@ -296,7 +298,6 @@ placeholder_StatusBaseText = {"container": statusDesktop_mainWindow_overlay, "id social_links_back_StatusBackButton = {"container": statusDesktop_mainWindow_overlay, "type": "StatusBackButton", "unnamed": 1, "visible": True} social_links_add_StatusBackButton = {"container": statusDesktop_mainWindow_overlay, "type": "StatusButton", "unnamed": 1, "visible": True} linksView = {"container": statusDesktop_mainWindow, "id": "linksView", "type": "StatusListView", "unnamed": 1, "visible": True} -edit_TextEdit = {"container": statusDesktop_mainWindow_overlay, "type": "TextEdit", "unnamed": 1, "visible": True} # Changes detected popup mainWindow_settingsDirtyToastMessage_SettingsDirtyToastMessage = {"container": ":statusDesktop_mainWindow", "id": "settingsDirtyToastMessage", "type": "SettingsDirtyToastMessage", "unnamed": 1, "visible": True} @@ -317,3 +318,20 @@ save_changes_StatusButton = {"checkable": False, "container": statusDesktop_main # Leave group popup leave_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "leaveGroupConfirmationDialogLeaveButton", "type": "StatusButton", "visible": True} + +# Create Keycard account with new seed phrase popup +cancel_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "id": "cancelButton", "type": "StatusButton", "visible": True} +image_KeycardImage = {"container": statusDesktop_mainWindow_overlay, "id": "image", "type": "KeycardImage", "unnamed": 1, "visible": True} +headerTitle = {"container": statusDesktop_mainWindow_overlay, "objectName": "headerTitle", "type": "StatusBaseText", "visible": True} +o_KeycardInit = {"container": statusDesktop_mainWindow_overlay, "type": "KeycardInit", "unnamed": 1, "visible": True} +keycard_reader_instruction_text = {"container": statusDesktop_mainWindow_overlay, "type": "StatusBaseText", "visible": True} +pinInputField_StatusPinInput = {"container": statusDesktop_mainWindow_overlay, "id": "pinInputField", "type": "StatusPinInput", "unnamed": 1, "visible": True} +inputText_TextInput = {"container": statusDesktop_mainWindow_overlay, "id": "inputText", "type": "TextInput", "unnamed": 1, "visible": False} +nextStatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "PrimaryButton", "type": "StatusButton", "visible": True} +revealSeedPhraseButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "AddAccountPopup-RevealSeedPhrase", "type": "StatusButton", "visible": True} +seedPhraseWordAtIndex_Placeholder = {"container": statusDesktop_mainWindow_overlay, "objectName": "SeedPhraseWordAtIndex-%WORD-INDEX%", "type": "StatusSeedPhraseInput", "visible": True} +word0_StatusInput = {"container": statusDesktop_mainWindow_overlay, "id": "word0", "type": "StatusInput", "unnamed": 1, "visible": True} +word1_StatusInput = {"container": statusDesktop_mainWindow_overlay, "id": "word1", "type": "StatusInput", "unnamed": 1, "visible": True} +word2_StatusInput = {"container": statusDesktop_mainWindow_overlay, "id": "word2", "type": "StatusInput", "unnamed": 1, "visible": True} +o_KeyPairItem = {"container": statusDesktop_mainWindow_overlay, "type": "KeyPairItem", "unnamed": 1, "visible": True} +o_StatusListItemTag = {"container": statusDesktop_mainWindow_overlay, "type": "StatusListItemTag", "unnamed": 1, "visible": True} diff --git a/test/e2e/gui/objects_map/mocked_keycard_controller_names.py b/test/e2e/gui/objects_map/mocked_keycard_controller_names.py new file mode 100644 index 0000000000..2f04384ae0 --- /dev/null +++ b/test/e2e/gui/objects_map/mocked_keycard_controller_names.py @@ -0,0 +1,25 @@ +QQuickApplicationWindow = {"type": "QQuickApplicationWindow", "unnamed": 1, "visible": True} +mocked_Keycard_Lib_Controller_Overlay = {"container": QQuickApplicationWindow, "type": "Overlay", "unnamed": 1, "visible": True} + +plugin_Reader_StatusButton = {"checkable": False, "container": QQuickApplicationWindow, "objectName": "pluginReaderButton", "type": "StatusButton", "visible": True} +unplug_Reader_StatusButton = {"checkable": False, "container": QQuickApplicationWindow, "objectName": "unplugReaderButton", "type": "StatusButton", "visible": True} +insert_Keycard_1_StatusButton = {"checkable": False, "container": QQuickApplicationWindow, "objectName": "insertKeycard1Button", "type": "StatusButton", "visible": True} +insert_Keycard_2_StatusButton = {"checkable": False, "container": QQuickApplicationWindow, "objectName": "insertKeycard2Button", "type": "StatusButton", "visible": True} +remove_Keycard_StatusButton = {"checkable": False, "container": QQuickApplicationWindow, "objectName": "removeKeycardButton", "type": "StatusButton", "visible": True} +set_initial_reader_state_StatusButton = {"checkable": False, "container": QQuickApplicationWindow, "id": "selectReaderStateButton", "type": "StatusButton", "visible": True} +keycardSettingsTab = {"container": QQuickApplicationWindow, "type": "KeycardSettingsTab", "visible": True} +set_initial_keycard_state_StatusButton = {"checkable": False, "container": keycardSettingsTab, "id": "selectKeycardsStateButton", "type": "StatusButton", "visible": True} +register_Keycard_StatusButton = {"checkable": False, "container": keycardSettingsTab, "objectName": "registerKeycardButton", "type": "StatusButton", "visible": True} + +not_Status_Keycard_StatusMenuItem = {"checkable": False, "container": mocked_Keycard_Lib_Controller_Overlay, "enabled": True, "objectName": "notStatusKeycardAction", "type": "StatusMenuItem", "unnamed": 1, "visible": True} +empty_Keycard_StatusMenuItem = {"checkable": False, "container": mocked_Keycard_Lib_Controller_Overlay, "enabled": True, "objectName": "emptyKeycardAction", "type": "StatusMenuItem", "unnamed": 1, "visible": True} +max_Pairing_Slots_Reached_StatusMenuItem = {"checkable": False, "container": mocked_Keycard_Lib_Controller_Overlay, "enabled": True, "objectName": "maxPairingSlotsReachedAction", "type": "StatusMenuItem", "unnamed": 1, "visible": True} +max_PIN_Retries_Reached_StatusMenuItem = {"checkable": False, "container": mocked_Keycard_Lib_Controller_Overlay, "enabled": True, "objectName": "maxPINRetriesReachedAction", "type": "StatusMenuItem", "unnamed": 1, "visible": True} +max_PUK_Retries_Reached_StatusMenuItem = {"checkable": False, "container": mocked_Keycard_Lib_Controller_Overlay, "enabled": True, "objectName": "maxPUKRetriesReachedAction", "type": "StatusMenuItem", "unnamed": 1, "visible": True} +keycard_With_Mnemonic_Only_StatusMenuItem = {"checkable": False, "container": mocked_Keycard_Lib_Controller_Overlay, "enabled": True, "objectName": "keycardWithMnemonicOnlyAction", "type": "StatusMenuItem", "unnamed": 1, "visible": True} +keycard_With_Mnemonic_Metadata_StatusMenuItem = {"checkable": False, "container": mocked_Keycard_Lib_Controller_Overlay, "enabled": True, "objectName": "keycardWithMnemonicAndMedatadaAction", "type": "StatusMenuItem", "unnamed": 1, "visible": True} +custom_Keycard_StatusMenuItem = {"checkable": False, "container": mocked_Keycard_Lib_Controller_Overlay, "enabled": True, "objectName": "customKeycardAction", "type": "StatusMenuItem", "unnamed": 1, "visible": True} + +reader_Unplugged_StatusMenuItem = {"checkable": False, "container": mocked_Keycard_Lib_Controller_Overlay, "enabled": True, "objectName": "readerStateReaderUnpluggedAction", "type": "StatusMenuItem", "unnamed": 1, "visible": True} +keycard_Not_Inserted_StatusMenuItem = {"checkable": False, "container": mocked_Keycard_Lib_Controller_Overlay, "enabled": True, "objectName": "readerStateKeycardNotInsertedAction", "type": "StatusMenuItem", "unnamed": 1, "visible": True} +keycard_Inserted_StatusMenuItem = {"checkable": False, "container": mocked_Keycard_Lib_Controller_Overlay, "enabled": True, "objectName": "readerStateKeycardInsertedAction", "type": "StatusMenuItem", "unnamed": 1, "visible": True} diff --git a/test/e2e/gui/screens/settings.py b/test/e2e/gui/screens/settings.py index 541b450ddd..5fc8709915 100644 --- a/test/e2e/gui/screens/settings.py +++ b/test/e2e/gui/screens/settings.py @@ -4,6 +4,7 @@ from gui.components.back_up_your_seed_phrase_popup import BackUpYourSeedPhrasePo from gui.elements.object import QObject from gui.elements.scroll import Scroll from gui.screens.settings_communities import CommunitiesSettingsView +from gui.screens.settings_keycard import KeycardSettingsView from gui.screens.settings_messaging import MessagingSettingsView from gui.screens.settings_profile import ProfileSettingsView from gui.screens.settings_syncing import SyncingSettingsView @@ -62,13 +63,14 @@ class LeftPanel(QObject): def sign_out_and_quit(self): self._open_settings('16-ExtraMenuItem') + @allure.step('Open keycard settings') + def open_keycard_settings(self): + self._open_settings('13-MainMenuItem') + return KeycardSettingsView() + class SettingsScreen(QObject): def __init__(self): super().__init__('mainWindow_ProfileLayout') self.left_panel = LeftPanel() - - - - diff --git a/test/e2e/gui/screens/settings_keycard.py b/test/e2e/gui/screens/settings_keycard.py index 0e8e69556c..01dd0d2fa1 100644 --- a/test/e2e/gui/screens/settings_keycard.py +++ b/test/e2e/gui/screens/settings_keycard.py @@ -2,6 +2,7 @@ import allure import configs.timeouts import driver +from gui.components.settings.keycard_popup import CreateNewKeycardAccountSeedPhrasePopup from gui.elements.button import Button from gui.elements.object import QObject from gui.elements.scroll import Scroll @@ -23,6 +24,11 @@ class KeycardSettingsView(QObject): def check_keycard_screen_loaded(self): assert KeycardSettingsView().is_visible + @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() + return CreateNewKeycardAccountSeedPhrasePopup().wait_until_appears() + @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' diff --git a/test/e2e/tests/settings/settings_keycard/__init__.py b/test/e2e/tests/settings/settings_keycard/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/e2e/tests/settings/settings_keycard/test_create_keycard_account_with_new_seed_phrase.py b/test/e2e/tests/settings/settings_keycard/test_create_keycard_account_with_new_seed_phrase.py new file mode 100644 index 0000000000..b2561ea20a --- /dev/null +++ b/test/e2e/tests/settings/settings_keycard/test_create_keycard_account_with_new_seed_phrase.py @@ -0,0 +1,78 @@ +import allure +import pytest +from allure import step + +import configs +import driver +from constants import ColorCodes +from constants.keycard import Keycard +from gui.main_window import MainWindow +from gui.mocked_keycard_controller import MockedKeycardController + + +@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703624', + 'Create a new keycard account with a new seed phrase') +@pytest.mark.case(703624) +@pytest.mark.skip(reason="https://github.com/status-im/desktop-qa-automation/issues/256") +def test_create_keycard_account_with_new_seed_phrase(main_screen: MainWindow): + with step('Choose option Create a new Keycard account with a new seed phrase in settings'): + main_screen.prepare() + keycard_settings = main_screen.left_panel.open_settings().left_panel.open_keycard_settings() + keycard_popup = keycard_settings.click_create_new_account_with_new_seed_phrase() + + with (step('Verify displayed keycard popup instructions are correct')): + with step('Verify header is correct'): + assert keycard_popup.keycard_header == Keycard.KEYCARD_POPUP_HEADER.value, "The header is incorrect" + with step('Verify instructions are correct'): + assert Keycard.KEYCARD_INSTRUCTIONS_PLUG_IN.value in keycard_popup.keycard_instructions, \ + "There is no correct keycard instruction" + + with step('Plug in reader'): + main_screen.hide() + keycard_controller = MockedKeycardController().wait_until_appears() + keycard_controller.plugin_reader() + main_screen.show() + + with step('Verify displayed keycard popup instructions are correct'): + assert driver.waitFor( + lambda: Keycard.KEYCARD_INSTRUCTIONS_INSERT_KEYCARD.value in keycard_popup.keycard_instructions, + configs.timeouts.UI_LOAD_TIMEOUT_MSEC), "There is no correct keycard instruction" + + with step('Register and insert keycard'): + main_screen.hide() + keycard_controller.register_keycard() + keycard_controller.insert_keycard_1() + main_screen.show() + + with step('Verify displayed keycard popup instructions are correct'): + with step('Verify keycard is recognized'): + assert driver.waitFor(lambda: Keycard.KEYCARD_RECOGNIZED.value in keycard_popup.keycard_instructions, + configs.timeouts.UI_LOAD_TIMEOUT_MSEC), "There is no correct keycard instruction" + with step('Verify that asked to choose PIN'): + assert driver.waitFor(lambda: Keycard.KEYCARD_CHOOSE_PIN.value in keycard_popup.keycard_instructions, + configs.timeouts.UI_LOAD_TIMEOUT_MSEC), "There is no correct keycard instruction" + assert Keycard.KEYCARD_NOTE.value in keycard_popup.keycard_instructions + + with step('Insert PIN and repeat PIN and verify keycard popup instructions are correct'): + pin = Keycard.KEYCARD_PIN.value + keycard_popup.input_pin(pin) + assert driver.waitFor(lambda: Keycard.KEYCARD_REPEAT_PIN.value in keycard_popup.keycard_instructions), \ + "There is no correct keycard instruction" + keycard_popup.input_pin(pin) + assert driver.waitFor(lambda: Keycard.KEYCARD_PIN_SET.value in keycard_popup.keycard_instructions), \ + "There is no correct keycard instruction" + + with step('Create keycard account using new seed phrase'): + keycard_name = Keycard.KEYCARD_NAME.value + account_name = Keycard.ACCOUNT_NAME.value + keycard_popup.create_keycard_account_with_seed_phrase(keycard_name, account_name) + + with step('Verify that preview shows correct keycard and account name and color and instructions are correct'): + assert driver.waitFor(lambda: Keycard.KEYCARD_NEW_ACCOUNT_CREATED.value in keycard_popup.keycard_instructions), \ + "There is no correct keycard instruction" + + assert keycard_popup.keycard_preview_name == keycard_name, "Keycard name in preview is incorrect" + assert keycard_popup.account_preview_name == account_name, "Account name in preview is incorrect" + assert keycard_popup.preview_color == ColorCodes.BLUE.value, "Color in preview is incorrect" + + keycard_popup.click_next()