|
| 1 | +import allure |
| 2 | +import pytest |
| 3 | +from allure_commons._allure import step |
| 4 | + |
| 5 | +from constants.wallet import WalletRenameKeypair |
| 6 | +from gui.components.wallet.authenticate_popup import AuthenticatePopup |
| 7 | +from tests.wallet_main_screen import marks |
| 8 | + |
| 9 | +import constants |
| 10 | +from gui.components.signing_phrase_popup import SigningPhrasePopup |
| 11 | +from gui.main_window import MainWindow |
| 12 | + |
| 13 | +pytestmark = marks |
| 14 | + |
| 15 | + |
| 16 | +@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703420', |
| 17 | + 'Wallet -> Settings -> Keypair interactions: Rename keypair') |
| 18 | +@pytest.mark.case(703420) |
| 19 | +@pytest.mark.parametrize('user_account', [constants.user.user_with_random_attributes_1]) |
| 20 | +@pytest.mark.parametrize( |
| 21 | + 'name, color, emoji, acc_emoji, second_name, third_name, new_name, new_name_1, seed_phrase', |
| 22 | + [pytest.param('Acc01', '#2a4af5', 'sunglasses', '😎 ', |
| 23 | + 'SPAcc24', 'PrivAcc', 'New name', 'New name 1', |
| 24 | + 'elite dinosaur flavor canoe garbage palace antique dolphin virtual mixed sand ' |
| 25 | + 'impact solution inmate hair pipe affair cage vote estate gloom lamp robust like')]) |
| 26 | +@pytest.mark.parametrize('address_pair', [constants.user.private_key_address_pair_1]) |
| 27 | +def test_rename_keypair_test(main_screen: MainWindow, user_account, name: str, color: str, emoji: str, acc_emoji: str, |
| 28 | + second_name: str, third_name: str, new_name, new_name_1, seed_phrase, address_pair): |
| 29 | + with step('Get display name'): |
| 30 | + profile_display_name = main_screen.left_panel.open_settings().left_panel.open_profile_settings().get_display_name |
| 31 | + |
| 32 | + with step('Create generated wallet account'): |
| 33 | + wallet = main_screen.left_panel.open_wallet() |
| 34 | + SigningPhrasePopup().wait_until_appears().confirm_phrase() |
| 35 | + account_popup = wallet.left_panel.open_add_account_popup() |
| 36 | + account_popup.set_name(name).set_emoji(emoji).set_color(color).save() |
| 37 | + AuthenticatePopup().wait_until_appears().authenticate(user_account.password) |
| 38 | + account_popup.wait_until_hidden() |
| 39 | + |
| 40 | + with step('Create imported seed phrase wallet account'): |
| 41 | + account_popup = wallet.left_panel.open_add_account_popup() |
| 42 | + account_popup.set_name(second_name).set_emoji(emoji).set_color(color).set_origin_seed_phrase( |
| 43 | + seed_phrase.split()).save() |
| 44 | + AuthenticatePopup().wait_until_appears().authenticate(user_account.password) |
| 45 | + account_popup.wait_until_hidden() |
| 46 | + |
| 47 | + with step('Import an account within private key'): |
| 48 | + account_popup = wallet.left_panel.open_add_account_popup() |
| 49 | + account_popup.set_name(third_name).set_emoji(emoji).set_color(color).set_origin_private_key( |
| 50 | + address_pair.private_key).save() |
| 51 | + AuthenticatePopup().wait_until_appears().authenticate(user_account.password) |
| 52 | + account_popup.wait_until_hidden() |
| 53 | + |
| 54 | + with step('Open wallet settings and verify Status keypair title'): |
| 55 | + settings = main_screen.left_panel.open_settings().left_panel.open_wallet_settings() |
| 56 | + status_keypair_title = settings.get_keypairs_names()[0] |
| 57 | + assert profile_display_name == status_keypair_title, \ |
| 58 | + f"Status keypair name should be equal to display name but currently it is {status_keypair_title}, \ |
| 59 | + when display name is {profile_display_name}" |
| 60 | + |
| 61 | + with step('Click 3 dots menu on Status keypair and check that there is no option to rename keypair'): |
| 62 | + settings.click_open_menu_button(profile_display_name) |
| 63 | + assert not settings.is_rename_keypair_menu_item_visible() |
| 64 | + |
| 65 | + with step('Click 3 dots menu on imported seed phrase account, open rename keypair popup and verify it was renamed'): |
| 66 | + settings.click_open_menu_button('2daa3') |
| 67 | + settings.click_rename_keypair().rename_keypair(new_name) |
| 68 | + assert settings.get_keypairs_names()[1] == new_name |
| 69 | + |
| 70 | + with step('Verify toast message with successful renaming appears'): |
| 71 | + messages = main_screen.wait_for_notification() |
| 72 | + assert WalletRenameKeypair.WALLET_SUCCESSFUL_RENAMING.value + 'from "2daa3" ' + 'to "' + new_name + '"' in messages, \ |
| 73 | + f"Toast message have not appeared" |
| 74 | + |
| 75 | + with step('Click 3 dots menu on private key account, open rename keypair popup and verify it was renamed'): |
| 76 | + settings.click_open_menu_button('edfcgpadvm') |
| 77 | + settings.click_rename_keypair().rename_keypair(new_name_1) |
| 78 | + assert settings.get_keypairs_names()[2] == new_name_1 |
| 79 | + |
| 80 | + with (step('Verify toast message with successful renaming appears')): |
| 81 | + messages = main_screen.wait_for_notification() |
| 82 | + assert WalletRenameKeypair.WALLET_SUCCESSFUL_RENAMING.value + 'from "edfcgpadvm" ' + 'to "' + new_name_1 + '"' in messages, \ |
| 83 | + f"Toast message have not appeared" |
0 commit comments