diff --git a/test/e2e/tests/settings/settings_wallet/test_wallet_rename_keypair.py b/test/e2e/tests/settings/settings_wallet/test_wallet_rename_keypair.py index e70bcc6c88..c449a137f4 100644 --- a/test/e2e/tests/settings/settings_wallet/test_wallet_rename_keypair.py +++ b/test/e2e/tests/settings/settings_wallet/test_wallet_rename_keypair.py @@ -8,6 +8,7 @@ from allure_commons._allure import step from constants import RandomUser from constants.wallet import WalletRenameKeypair, WalletAccountPopup from helpers.WalletHelper import authenticate_with_password +from scripts.utils.generators import random_wallet_account_name from tests.wallet_main_screen import marks import constants @@ -22,54 +23,30 @@ pytestmark = marks @pytest.mark.case(703420) @pytest.mark.parametrize('user_account', [RandomUser()]) @pytest.mark.parametrize( - 'name, color, emoji, acc_emoji, second_name, third_name, new_name, new_name_1, seed_phrase', - [pytest.param('Acc01', '#2a4af5', 'sunglasses', '😎 ', - 'SPAcc24', 'PrivAcc', 'New name', 'New name 1', - 'elite dinosaur flavor canoe garbage palace antique dolphin virtual mixed sand ' - 'impact solution inmate hair pipe affair cage vote estate gloom lamp robust like')]) + 'emoji', + [pytest.param('sunglasses')]) @pytest.mark.parametrize('address_pair', [constants.user.private_key_address_pair_1]) -def test_rename_keypair_test(main_screen: MainWindow, user_account, name: str, color: str, emoji: str, acc_emoji: str, - second_name: str, third_name: str, new_name, new_name_1, seed_phrase, address_pair): - seed_phrase_name = ''.join([word[0] for word in seed_phrase[:10]]) - with step('Get display name'): - profile_display_name = main_screen.left_panel.open_settings().left_panel.open_profile_settings().get_display_name +def test_rename_keypair_test(main_screen: MainWindow, user_account, emoji: str, address_pair): - with step('Create generated wallet account'): + with step('Get display name'): + profile_display_name = \ + main_screen.left_panel.open_settings().left_panel.open_profile_settings().get_display_name + + with step('To import an account within private key open add account popup and set name, emoji and color'): 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).save_changes() - authenticate_with_password(user_account) - account_popup.wait_until_hidden() - - with step('To create imported seed phrase account open add account popup and set name, emoji and color'): - account_popup = wallet.left_panel.open_add_account_popup() - account_popup.set_name(second_name).set_emoji(emoji) - - with step('Enter seed phrase and name with less then 5 characters and verify correct error appears'): - new_account_popup = account_popup.open_add_new_account_popup() - new_account_popup.enter_new_seed_phrase(seed_phrase.split()).enter_seed_phrase_name( - ''.join(random.choices(string.ascii_letters + string.digits, k=4))) - assert new_account_popup.get_error_message() == WalletAccountPopup.WALLET_KEYPAIR_NAME_MIN.value - - with step('Enter seed phrase name with more than 5 characters and continue creating of seed phrase account'): - new_account_popup.enter_seed_phrase_name(seed_phrase_name).click_continue() - account_popup.save_changes() - authenticate_with_password(user_account) - account_popup.wait_until_hidden() - - with step('To import an account within private key open add account popup and set name, emoji and color'): - account_popup = wallet.left_panel.open_add_account_popup() - account_popup.set_name(third_name).set_emoji(emoji) + account_popup.set_name(random_wallet_account_name()).set_emoji(emoji) with step('Enter private key name less than 5 characters and verify that error appears'): + pk_name_short = ''.join(random.choices(string.ascii_letters + string.digits, k=4)) new_account_popup = account_popup.open_add_new_account_popup() - new_account_popup.import_and_enter_private_key(address_pair.private_key).enter_private_key_name( - ''.join(random.choices(string.ascii_letters + string.digits, k=4))) + new_account_popup.import_and_enter_private_key(address_pair.private_key).enter_private_key_name(pk_name_short) assert new_account_popup.get_private_key_error_message() == WalletAccountPopup.WALLET_KEYPAIR_NAME_MIN.value with step('Enter private key name more than 5 characters and continue creating of import private key account'): - new_account_popup.enter_private_key_name(address_pair.private_key[:5]).click_continue() + pk_name = ''.join(random.choices(string.ascii_letters + string.digits, k=5)) + new_account_popup.enter_private_key_name(pk_name).click_continue() account_popup.save_changes() authenticate_with_password(user_account) account_popup.wait_until_hidden() @@ -84,33 +61,17 @@ def test_rename_keypair_test(main_screen: MainWindow, user_account, name: str, c with step('Click 3 dots menu on Status keypair and check that there is no option to rename keypair'): settings.click_open_menu_button(profile_display_name) assert not settings.is_rename_keypair_menu_item_visible() - - with step('Click 3 dots menu on imported seed phrase account, open rename keypair popup'): - settings.click_open_menu_button('2daa3') - rename_keypair_popup = settings.click_rename_keypair() - - with step('Verify that error appears when name of keypair consists of less then 5 characters'): - rename_keypair_popup.rename_keypair('abc') - assert rename_keypair_popup.get_error_message() == WalletAccountPopup.WALLET_KEYPAIR_MIN.value - - with step('Enter correct new name and verify that it was changed correctly'): - rename_keypair_popup.rename_keypair(new_name) - rename_keypair_popup.save_changes() - assert settings.get_keypairs_names()[1] == new_name - - with step('Verify toast message with successful renaming appears'): - messages = main_screen.wait_for_notification() - assert WalletRenameKeypair.WALLET_SUCCESSFUL_RENAMING.value + 'from "2daa3" ' + 'to "' + new_name + '"' in messages, \ - f"Toast message have not appeared" + settings.click() # to close the menu with step('Click 3 dots menu on private key account, open rename keypair popup and verify it was renamed'): - settings.click_open_menu_button('elite dino') + pk_new_name = ''.join(random.choices(string.ascii_letters + string.digits, k=5)) + settings.click_open_menu_button(pk_name) rename_keypair_popup = settings.click_rename_keypair() - rename_keypair_popup.rename_keypair(new_name_1) + rename_keypair_popup.rename_keypair(pk_new_name) rename_keypair_popup.save_changes() - assert settings.get_keypairs_names()[2] == new_name_1 + assert pk_new_name in settings.get_keypairs_names() with step('Verify toast message with successful renaming appears'): messages = main_screen.wait_for_notification() - assert WalletRenameKeypair.WALLET_SUCCESSFUL_RENAMING.value + 'from "elite dino" ' + 'to "' + new_name_1 + '"' in messages, \ + assert WalletRenameKeypair.WALLET_SUCCESSFUL_RENAMING.value + 'from "' + pk_name + '" to "' + pk_new_name + '"' in messages, \ f"Toast message have not appeared" diff --git a/test/e2e/tests/settings/settings_wallet/test_wallet_settings_account_order.py b/test/e2e/tests/settings/settings_wallet/test_wallet_settings_account_order.py index 52c82d8098..b0594999d4 100644 --- a/test/e2e/tests/settings/settings_wallet/test_wallet_settings_account_order.py +++ b/test/e2e/tests/settings/settings_wallet/test_wallet_settings_account_order.py @@ -8,7 +8,6 @@ from . import marks import configs import driver from gui.components.signing_phrase_popup import SigningPhrasePopup -from gui.components.authenticate_popup import AuthenticatePopup from gui.main_window import MainWindow pytestmark = marks diff --git a/test/e2e/tests/settings/settings_wallet/test_wallet_settings_add_account.py b/test/e2e/tests/settings/settings_wallet/test_wallet_settings_add_account.py index 6bd685e927..0fb95668b3 100644 --- a/test/e2e/tests/settings/settings_wallet/test_wallet_settings_add_account.py +++ b/test/e2e/tests/settings/settings_wallet/test_wallet_settings_add_account.py @@ -6,15 +6,13 @@ import allure import pytest from allure_commons._allure import step -from constants import UserAccount, RandomUser +from constants import RandomUser from helpers.WalletHelper import authenticate_with_password -from scripts.utils.generators import random_name_string, random_password_string from constants.wallet import WalletAccountPopup from . import marks import constants from gui.components.signing_phrase_popup import SigningPhrasePopup -from gui.components.authenticate_popup import AuthenticatePopup from gui.main_window import MainWindow pytestmark = marks