diff --git a/test/e2e/constants/wallet.py b/test/e2e/constants/wallet.py index 9a7005abe2..d027f63527 100644 --- a/test/e2e/constants/wallet.py +++ b/test/e2e/constants/wallet.py @@ -72,3 +72,6 @@ class WalletScreensHeaders(Enum): class WalletRenameKeypair(Enum): WALLET_SUCCESSFUL_RENAMING = 'You successfully renamed your keypair\n' + +class WalletSeedPhrase(Enum): + WALLET_SEED_PHRASE_ALREADY_ADDED = 'The entered seed phrase is already added' diff --git a/test/e2e/gui/components/wallet/wallet_account_popups.py b/test/e2e/gui/components/wallet/wallet_account_popups.py index a6f2621e91..8854c87205 100644 --- a/test/e2e/gui/components/wallet/wallet_account_popups.py +++ b/test/e2e/gui/components/wallet/wallet_account_popups.py @@ -123,17 +123,19 @@ class AccountPopup(BasePopup): @allure.step('Set new seed phrase for account') def set_origin_new_seed_phrase(self, value: str): - self._origin_combobox.click() - self._new_master_key_origin_item.click() - AddNewAccountPopup().wait_until_appears().generate_new_master_key(value) + self.open_add_new_account_popup().generate_new_master_key(value) return self @allure.step('Set seed phrase') def set_origin_seed_phrase(self, value: typing.List[str]): + self.open_add_new_account_popup().import_new_seed_phrase(value) + return self + + @allure.step('Open add new account popup') + def open_add_new_account_popup(self): self._origin_combobox.click() self._new_master_key_origin_item.click() - AddNewAccountPopup().wait_until_appears().import_new_seed_phrase(value) - return self + return AddNewAccountPopup().wait_until_appears() @allure.step('Set derivation path for account') def set_derivation_path(self, value: str, index: int, password: str): @@ -221,6 +223,7 @@ class AddNewAccountPopup(BasePopup): self._seed_phrase_word_text_edit = TextEdit(names.mainWindow_statusSeedPhraseInputField_TextEdit) self._seed_phrase_phrase_key_name_text_edit = TextEdit( names.mainWallet_AddEditAccountPopup_ImportedSeedPhraseKeyName) + self._already_added_error = QObject(names.enterSeedPhraseInvalidSeedText_StatusBaseText) @allure.step('Wait until appears {0}') def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC): @@ -235,8 +238,16 @@ class AddNewAccountPopup(BasePopup): self._continue_button.click() return private_key[:5] - @allure.step('Import new seed phrase') - def import_new_seed_phrase(self, seed_phrase_words: list) -> str: + @allure.step('Import new seed phrase and continue') + def import_new_seed_phrase(self, seed_phrase_words: list): + self.enter_new_seed_phrase(seed_phrase_words) + seed_phrase_name = ''.join([word[0] for word in seed_phrase_words[:10]]) + self._seed_phrase_phrase_key_name_text_edit.text = seed_phrase_name + self._continue_button.click() + return seed_phrase_name + + @allure.step('Enter new seed phrase') + def enter_new_seed_phrase(self, seed_phrase_words: list) -> str: self._import_seed_phrase_button.click() if len(seed_phrase_words) == 12: self._seed_phrase_12_words_button.click() @@ -249,16 +260,17 @@ class AddNewAccountPopup(BasePopup): for count, word in enumerate(seed_phrase_words, start=1): self._seed_phrase_word_text_edit.real_name['objectName'] = f'enterSeedPhraseInputField{count}' self._seed_phrase_word_text_edit.text = word - seed_phrase_name = ''.join([word[0] for word in seed_phrase_words[:10]]) - self._seed_phrase_phrase_key_name_text_edit.text = seed_phrase_name - self._continue_button.click() - return seed_phrase_name @allure.step('Generate new seed phrase') def generate_new_master_key(self, name: str): self._generate_master_key_button.click() BackUpYourSeedPhrasePopUp().wait_until_appears().generate_seed_phrase(name) + @allure.step('Get text of error') + def get_already_added_error(self): + assert self._already_added_error.is_visible + return self._already_added_error.object.text + class GeneratedAddressesList(QObject): diff --git a/test/e2e/gui/objects_map/names.py b/test/e2e/gui/objects_map/names.py index 13ec1c9054..dae6c8737b 100644 --- a/test/e2e/gui/objects_map/names.py +++ b/test/e2e/gui/objects_map/names.py @@ -337,6 +337,7 @@ mainWallet_AddEditAccountPopup_EnterSeedPhraseWord = {"container": mainWallet_Ad mainWallet_AddEditAccountPopup_12WordsButton = {"container": mainWallet_AddEditAccountPopup_Content, "objectName": "12SeedButton", "type": "StatusSwitchTabButton"} mainWallet_AddEditAccountPopup_18WordsButton = {"container": mainWallet_AddEditAccountPopup_Content, "objectName": "18SeedButton", "type": "StatusSwitchTabButton"} mainWallet_AddEditAccountPopup_24WordsButton = {"container": mainWallet_AddEditAccountPopup_Content, "objectName": "24SeedButton", "type": "StatusSwitchTabButton"} +enterSeedPhraseInvalidSeedText_StatusBaseText = {"container": statusDesktop_mainWindow_overlay, "objectName": "enterSeedPhraseInvalidSeedText", "type": "StatusBaseText", "visible": True} # Edit Account from settings popup editWalletSettings_renameButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "renameAccountModalSaveBtn", "type": "StatusButton"} diff --git a/test/e2e/tests/wallet_main_screen/wallet: plus button/test_plus_button_manage_account_from_seed_phrase.py b/test/e2e/tests/wallet_main_screen/wallet: plus button/test_plus_button_manage_account_from_seed_phrase.py index 98d6f7acd2..92eaece55a 100644 --- a/test/e2e/tests/wallet_main_screen/wallet: plus button/test_plus_button_manage_account_from_seed_phrase.py +++ b/test/e2e/tests/wallet_main_screen/wallet: plus button/test_plus_button_manage_account_from_seed_phrase.py @@ -3,6 +3,8 @@ import time import allure import pytest from allure_commons._allure import step + +from constants.wallet import WalletSeedPhrase from tests.wallet_main_screen import marks import constants @@ -83,3 +85,35 @@ def test_plus_button_manage_account_from_seed_phrase(main_screen: MainWindow, us with step('Verify that the account is not displayed in accounts list'): assert driver.waitFor(lambda: new_name not in [account.name for account in wallet.left_panel.accounts], 10000), \ f'Account with {new_name} is still displayed even it should not be' + + +@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/736371', + "Can't import the same seed phrase when adding account") +@pytest.mark.case(736371) +@pytest.mark.parametrize('user_account', [constants.user.user_with_random_attributes_1]) +@pytest.mark.parametrize('name, color, emoji, emoji_unicode, ' + 'new_name, new_color, new_emoji, new_emoji_unicode, seed_phrase', [ + pytest.param('SPAcc24', '#2a4af5', 'sunglasses', '1f60e', + 'SPAcc24edited', '#216266', 'thumbsup', '1f44d', + 'elite dinosaur flavor canoe garbage palace antique dolphin virtual mixed sand ' + 'impact solution inmate hair pipe affair cage vote estate gloom lamp robust like'), + ]) +def test_plus_button_re_importing_seed_phrase(main_screen: MainWindow, user_account, + name: str, color: str, emoji: str, emoji_unicode: str, + new_name: str, new_color: str, new_emoji: str, + new_emoji_unicode: str, + seed_phrase: str): + with step('Create imported seed phrase wallet account'): + wallet = main_screen.left_panel.open_wallet() + SigningPhrasePopup().wait_until_appears().confirm_phrase() + account_popup = wallet.left_panel.open_add_account_popup() + account_popup.set_name(name).set_emoji(emoji).set_color(color).set_origin_seed_phrase( + seed_phrase.split()).save() + AuthenticatePopup().wait_until_appears().authenticate(user_account.password) + account_popup.wait_until_hidden() + + with step('Try to re-import seed phrase and verify that correct error appears'): + account_popup = wallet.left_panel.open_add_account_popup() + add_new_account = account_popup.set_name(name).set_emoji(emoji).set_color(color).open_add_new_account_popup() + add_new_account.enter_new_seed_phrase(seed_phrase.split()) + assert add_new_account.get_already_added_error() == WalletSeedPhrase.WALLET_SEED_PHRASE_ALREADY_ADDED.value