test: test_import_restore_keycard_via_seed_phrase added (#258)
This commit is contained in:
parent
5902bbbeee
commit
026d0ebb06
|
@ -6,6 +6,7 @@ class Keycard(Enum):
|
||||||
KEYCARD_NAME = 'Test Keycard'
|
KEYCARD_NAME = 'Test Keycard'
|
||||||
ACCOUNT_NAME = 'Test Account'
|
ACCOUNT_NAME = 'Test Account'
|
||||||
KEYCARD_POPUP_HEADER = 'Create a new Keycard account with a new seed phrase'
|
KEYCARD_POPUP_HEADER = 'Create a new Keycard account with a new seed phrase'
|
||||||
|
KEYCARD_POPUP_HEADER_IMPORT = 'Import or restore a Keycard via a seed phrase'
|
||||||
KEYCARD_INSTRUCTIONS_PLUG_IN = 'Plug in Keycard reader...'
|
KEYCARD_INSTRUCTIONS_PLUG_IN = 'Plug in Keycard reader...'
|
||||||
KEYCARD_INSTRUCTIONS_INSERT_KEYCARD = 'Insert Keycard...'
|
KEYCARD_INSTRUCTIONS_INSERT_KEYCARD = 'Insert Keycard...'
|
||||||
KEYCARD_RECOGNIZED = 'Keycard recognized'
|
KEYCARD_RECOGNIZED = 'Keycard recognized'
|
||||||
|
@ -16,3 +17,4 @@ class Keycard(Enum):
|
||||||
KEYCARD_NAME_IT = 'Name this Keycard'
|
KEYCARD_NAME_IT = 'Name this Keycard'
|
||||||
KEYCARD_NAME_ACCOUNTS = 'Name accounts'
|
KEYCARD_NAME_ACCOUNTS = 'Name accounts'
|
||||||
KEYCARD_NEW_ACCOUNT_CREATED = 'New account successfully created'
|
KEYCARD_NEW_ACCOUNT_CREATED = 'New account successfully created'
|
||||||
|
KEYCARD_READY = 'Keycard is ready to use!'
|
||||||
|
|
|
@ -7,11 +7,12 @@ import driver
|
||||||
from gui.components.base_popup import BasePopup
|
from gui.components.base_popup import BasePopup
|
||||||
from gui.elements.button import Button
|
from gui.elements.button import Button
|
||||||
from gui.elements.object import QObject
|
from gui.elements.object import QObject
|
||||||
|
from gui.elements.text_edit import TextEdit
|
||||||
from gui.elements.text_label import TextLabel
|
from gui.elements.text_label import TextLabel
|
||||||
from scripts.tools.image import Image
|
from scripts.tools.image import Image
|
||||||
|
|
||||||
|
|
||||||
class CreateNewKeycardAccountSeedPhrasePopup(BasePopup):
|
class KeycardPopup(BasePopup):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
@ -24,6 +25,10 @@ class CreateNewKeycardAccountSeedPhrasePopup(BasePopup):
|
||||||
self._seed_phrase_first_word_component = QObject('word0_StatusInput')
|
self._seed_phrase_first_word_component = QObject('word0_StatusInput')
|
||||||
self._seed_phrase_second_word_component = QObject('word1_StatusInput')
|
self._seed_phrase_second_word_component = QObject('word1_StatusInput')
|
||||||
self._seed_phrase_third_word_component = QObject('word2_StatusInput')
|
self._seed_phrase_third_word_component = QObject('word2_StatusInput')
|
||||||
|
self._seed_phrase_word_text_edit = TextEdit('statusSeedPhraseInputField_TextEdit')
|
||||||
|
self._seed_phrase_12_words_button = Button('switchTabBar_12_words_StatusSwitchTabButton')
|
||||||
|
self._seed_phrase_18_words_button = Button('switchTabBar_18_words_StatusSwitchTabButton')
|
||||||
|
self._seed_phrase_24_words_button = Button('switchTabBar_24_words_StatusSwitchTabButton')
|
||||||
self._field_object = QObject('edit_TextEdit')
|
self._field_object = QObject('edit_TextEdit')
|
||||||
self._keypair_item = QObject('o_KeyPairItem')
|
self._keypair_item = QObject('o_KeyPairItem')
|
||||||
self._keypair_tag = QObject('o_StatusListItemTag')
|
self._keypair_tag = QObject('o_StatusListItemTag')
|
||||||
|
@ -128,3 +133,23 @@ class CreateNewKeycardAccountSeedPhrasePopup(BasePopup):
|
||||||
self.click_next().name_keycard(keycard_name)
|
self.click_next().name_keycard(keycard_name)
|
||||||
self.click_next().name_account(account_name)
|
self.click_next().name_account(account_name)
|
||||||
self.click_next()
|
self.click_next()
|
||||||
|
|
||||||
|
@allure.step('Import keycard via seed phrase')
|
||||||
|
def import_keycard_via_seed_phrase(self, seed_phrase_words: list, pin: str, keycard_name: str, account_name: str):
|
||||||
|
if len(seed_phrase_words) == 12:
|
||||||
|
self._seed_phrase_12_words_button.click()
|
||||||
|
elif len(seed_phrase_words) == 18:
|
||||||
|
self._seed_phrase_18_words_button.click()
|
||||||
|
elif len(seed_phrase_words) == 24:
|
||||||
|
self._seed_phrase_24_words_button.click()
|
||||||
|
else:
|
||||||
|
raise RuntimeError("Wrong amount of seed words", len(seed_phrase_words))
|
||||||
|
for count, word in enumerate(seed_phrase_words, start=1):
|
||||||
|
self._seed_phrase_word_text_edit.real_name['objectName'] = f'statusSeedPhraseInputField{count}'
|
||||||
|
self._seed_phrase_word_text_edit.text = word
|
||||||
|
self.click_next()
|
||||||
|
self.input_pin(pin)
|
||||||
|
self.input_pin(pin)
|
||||||
|
self.click_next().name_keycard(keycard_name)
|
||||||
|
self.click_next().name_account(account_name)
|
||||||
|
self.click_next()
|
||||||
|
|
|
@ -335,3 +335,8 @@ word1_StatusInput = {"container": statusDesktop_mainWindow_overlay, "id": "word1
|
||||||
word2_StatusInput = {"container": statusDesktop_mainWindow_overlay, "id": "word2", "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_KeyPairItem = {"container": statusDesktop_mainWindow_overlay, "type": "KeyPairItem", "unnamed": 1, "visible": True}
|
||||||
o_StatusListItemTag = {"container": statusDesktop_mainWindow_overlay, "type": "StatusListItemTag", "unnamed": 1, "visible": True}
|
o_StatusListItemTag = {"container": statusDesktop_mainWindow_overlay, "type": "StatusListItemTag", "unnamed": 1, "visible": True}
|
||||||
|
statusSeedPhraseInputField_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "statusSeedPhraseInputField", "type": "TextEdit", "visible": True}
|
||||||
|
switchTabBar_StatusSwitchTabBar = {"container": statusDesktop_mainWindow_overlay, "id": "switchTabBar", "type": "StatusSwitchTabBar", "unnamed": 1, "visible": True}
|
||||||
|
switchTabBar_12_words_StatusSwitchTabButton = {"checkable": True, "container": switchTabBar_StatusSwitchTabBar, "objectName": "12SeedButton", "text": "12 words", "type": "StatusSwitchTabButton", "visible": True}
|
||||||
|
switchTabBar_18_words_StatusSwitchTabButton = {"checkable": True, "container": switchTabBar_StatusSwitchTabBar, "objectName": "18SeedButton", "text": "18 words", "type": "StatusSwitchTabButton", "visible": True}
|
||||||
|
switchTabBar_24_words_StatusSwitchTabButton = {"checkable": True, "container": switchTabBar_StatusSwitchTabBar, "objectName": "24SeedButton", "text": "24 words", "type": "StatusSwitchTabButton", "visible": True}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import allure
|
||||||
|
|
||||||
import configs.timeouts
|
import configs.timeouts
|
||||||
import driver
|
import driver
|
||||||
from gui.components.settings.keycard_popup import CreateNewKeycardAccountSeedPhrasePopup
|
from gui.components.settings.keycard_popup import KeycardPopup
|
||||||
from gui.elements.button import Button
|
from gui.elements.button import Button
|
||||||
from gui.elements.object import QObject
|
from gui.elements.object import QObject
|
||||||
from gui.elements.scroll import Scroll
|
from gui.elements.scroll import Scroll
|
||||||
|
@ -27,7 +27,12 @@ class KeycardSettingsView(QObject):
|
||||||
@allure.step('Choose create new keycard account with new seed phrase')
|
@allure.step('Choose create new keycard account with new seed phrase')
|
||||||
def click_create_new_account_with_new_seed_phrase(self):
|
def click_create_new_account_with_new_seed_phrase(self):
|
||||||
self._create_new_keycard_account_button.click()
|
self._create_new_keycard_account_button.click()
|
||||||
return CreateNewKeycardAccountSeedPhrasePopup().wait_until_appears()
|
return KeycardPopup().wait_until_appears()
|
||||||
|
|
||||||
|
@allure.step('Choose import or restore keycard via seed phrase')
|
||||||
|
def click_import_restore_via_seed_phrase(self):
|
||||||
|
self._import_restore_via_seed_phrase_button.click()
|
||||||
|
return KeycardPopup().wait_until_appears()
|
||||||
|
|
||||||
@allure.step('Check that all keycard options displayed')
|
@allure.step('Check that all keycard options displayed')
|
||||||
def all_keycard_options_available(self):
|
def all_keycard_options_available(self):
|
||||||
|
|
|
@ -15,7 +15,7 @@ from gui.mocked_keycard_controller import MockedKeycardController
|
||||||
@pytest.mark.case(703624)
|
@pytest.mark.case(703624)
|
||||||
@pytest.mark.parametrize('options', [aut_options.MOCK_KEYCARD])
|
@pytest.mark.parametrize('options', [aut_options.MOCK_KEYCARD])
|
||||||
@pytest.mark.skip(reason="https://github.com/status-im/desktop-qa-automation/issues/274")
|
@pytest.mark.skip(reason="https://github.com/status-im/desktop-qa-automation/issues/274")
|
||||||
def test_create_keycard_account_with_new_seed_phrase(main_screen: MainWindow):
|
def test_create_keycard_account_with_new_seed_phrase(main_screen: MainWindow, options):
|
||||||
with step('Choose option Create a new Keycard account with a new seed phrase in settings'):
|
with step('Choose option Create a new Keycard account with a new seed phrase in settings'):
|
||||||
main_screen.prepare()
|
main_screen.prepare()
|
||||||
keycard_settings = main_screen.left_panel.open_settings().left_panel.open_keycard_settings()
|
keycard_settings = main_screen.left_panel.open_settings().left_panel.open_keycard_settings()
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
import allure
|
||||||
|
import pytest
|
||||||
|
from allure import step
|
||||||
|
|
||||||
|
import configs
|
||||||
|
import constants
|
||||||
|
import driver
|
||||||
|
from constants import ColorCodes, aut_options
|
||||||
|
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/703625',
|
||||||
|
'Import or restore a Keycard via a seed phrase')
|
||||||
|
@pytest.mark.case(703625)
|
||||||
|
@pytest.mark.parametrize('user_account', [constants.user.user_account_one])
|
||||||
|
@pytest.mark.parametrize('options', [aut_options.MOCK_KEYCARD])
|
||||||
|
@pytest.mark.skip(reason="https://github.com/status-im/desktop-qa-automation/issues/274")
|
||||||
|
def test_import_restore_keycard_via_seed_phrase(main_screen: MainWindow, user_account, options):
|
||||||
|
with step('Choose option Import or restore account via 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_import_restore_via_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_IMPORT.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('Import keycard via seed phrase'):
|
||||||
|
pin = Keycard.KEYCARD_PIN.value
|
||||||
|
keycard_name = Keycard.KEYCARD_NAME.value
|
||||||
|
account_name = Keycard.ACCOUNT_NAME.value
|
||||||
|
keycard_popup.import_keycard_via_seed_phrase(user_account.seed_phrase, pin, 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_READY.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()
|
Loading…
Reference in New Issue