tests: keypair rename test simplified
This commit is contained in:
parent
273a960471
commit
9c04d2ee9b
|
@ -8,6 +8,7 @@ from allure_commons._allure import step
|
||||||
from constants import RandomUser
|
from constants import RandomUser
|
||||||
from constants.wallet import WalletRenameKeypair, WalletAccountPopup
|
from constants.wallet import WalletRenameKeypair, WalletAccountPopup
|
||||||
from helpers.WalletHelper import authenticate_with_password
|
from helpers.WalletHelper import authenticate_with_password
|
||||||
|
from scripts.utils.generators import random_wallet_account_name
|
||||||
from tests.wallet_main_screen import marks
|
from tests.wallet_main_screen import marks
|
||||||
|
|
||||||
import constants
|
import constants
|
||||||
|
@ -22,54 +23,30 @@ pytestmark = marks
|
||||||
@pytest.mark.case(703420)
|
@pytest.mark.case(703420)
|
||||||
@pytest.mark.parametrize('user_account', [RandomUser()])
|
@pytest.mark.parametrize('user_account', [RandomUser()])
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
'name, color, emoji, acc_emoji, second_name, third_name, new_name, new_name_1, seed_phrase',
|
'emoji',
|
||||||
[pytest.param('Acc01', '#2a4af5', 'sunglasses', '😎 ',
|
[pytest.param('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')])
|
|
||||||
@pytest.mark.parametrize('address_pair', [constants.user.private_key_address_pair_1])
|
@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,
|
def test_rename_keypair_test(main_screen: MainWindow, user_account, emoji: str, address_pair):
|
||||||
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
|
|
||||||
|
|
||||||
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()
|
wallet = main_screen.left_panel.open_wallet()
|
||||||
SigningPhrasePopup().wait_until_appears().confirm_phrase()
|
SigningPhrasePopup().wait_until_appears().confirm_phrase()
|
||||||
account_popup = wallet.left_panel.open_add_account_popup()
|
account_popup = wallet.left_panel.open_add_account_popup()
|
||||||
account_popup.set_name(name).set_emoji(emoji).save_changes()
|
account_popup.set_name(random_wallet_account_name()).set_emoji(emoji)
|
||||||
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)
|
|
||||||
|
|
||||||
with step('Enter private key name less than 5 characters and verify that error appears'):
|
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 = account_popup.open_add_new_account_popup()
|
||||||
new_account_popup.import_and_enter_private_key(address_pair.private_key).enter_private_key_name(
|
new_account_popup.import_and_enter_private_key(address_pair.private_key).enter_private_key_name(pk_name_short)
|
||||||
''.join(random.choices(string.ascii_letters + string.digits, k=4)))
|
|
||||||
assert new_account_popup.get_private_key_error_message() == WalletAccountPopup.WALLET_KEYPAIR_NAME_MIN.value
|
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'):
|
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()
|
account_popup.save_changes()
|
||||||
authenticate_with_password(user_account)
|
authenticate_with_password(user_account)
|
||||||
account_popup.wait_until_hidden()
|
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'):
|
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)
|
settings.click_open_menu_button(profile_display_name)
|
||||||
assert not settings.is_rename_keypair_menu_item_visible()
|
assert not settings.is_rename_keypair_menu_item_visible()
|
||||||
|
settings.click() # to close the menu
|
||||||
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"
|
|
||||||
|
|
||||||
with step('Click 3 dots menu on private key account, open rename keypair popup and verify it was renamed'):
|
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 = 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()
|
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'):
|
with step('Verify toast message with successful renaming appears'):
|
||||||
messages = main_screen.wait_for_notification()
|
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"
|
f"Toast message have not appeared"
|
||||||
|
|
|
@ -8,7 +8,6 @@ from . import marks
|
||||||
import configs
|
import configs
|
||||||
import driver
|
import driver
|
||||||
from gui.components.signing_phrase_popup import SigningPhrasePopup
|
from gui.components.signing_phrase_popup import SigningPhrasePopup
|
||||||
from gui.components.authenticate_popup import AuthenticatePopup
|
|
||||||
from gui.main_window import MainWindow
|
from gui.main_window import MainWindow
|
||||||
|
|
||||||
pytestmark = marks
|
pytestmark = marks
|
||||||
|
|
|
@ -6,15 +6,13 @@ import allure
|
||||||
import pytest
|
import pytest
|
||||||
from allure_commons._allure import step
|
from allure_commons._allure import step
|
||||||
|
|
||||||
from constants import UserAccount, RandomUser
|
from constants import RandomUser
|
||||||
from helpers.WalletHelper import authenticate_with_password
|
from helpers.WalletHelper import authenticate_with_password
|
||||||
from scripts.utils.generators import random_name_string, random_password_string
|
|
||||||
from constants.wallet import WalletAccountPopup
|
from constants.wallet import WalletAccountPopup
|
||||||
from . import marks
|
from . import marks
|
||||||
|
|
||||||
import constants
|
import constants
|
||||||
from gui.components.signing_phrase_popup import SigningPhrasePopup
|
from gui.components.signing_phrase_popup import SigningPhrasePopup
|
||||||
from gui.components.authenticate_popup import AuthenticatePopup
|
|
||||||
from gui.main_window import MainWindow
|
from gui.main_window import MainWindow
|
||||||
|
|
||||||
pytestmark = marks
|
pytestmark = marks
|
||||||
|
|
Loading…
Reference in New Issue