chore(@e2e): switch to wallet account data class instance

This commit is contained in:
Anastasiya Semenkevich 2025-01-17 16:43:48 +03:00 committed by Anastasiya
parent dcd7dec04d
commit f8736e9ac4
12 changed files with 117 additions and 151 deletions

View File

@ -98,11 +98,8 @@ class RandomWalletAccount(WalletAccount):
)
account_list_item = namedtuple('AccountListItem', ['name', 'color', 'emoji'])
wallet_account_list_item = namedtuple('WalletAccountListItem', ['name', 'icon_color', 'icon_emoji', 'object'])
account_list_item_2 = namedtuple('AccountListItem', ['name2', 'color2', 'emoji2'])
wallet_account_list_item_2 = namedtuple('WalletAccountListItem', ['name', 'icon', 'object'])
wallet_account = namedtuple('PrivateKeyAddressPair', ['private_key', 'wallet_address'])
private_key_address_pair_1 = wallet_account('2daa36a3abe381a9c01610bf10fda272fbc1b8a22179a39f782c512346e3e470',

View File

@ -5,7 +5,7 @@ import allure
import pyperclip
import configs
import constants.user
import constants
import driver
from driver.objects_access import walk_children
from gui.components.context_menu import ContextMenu
@ -47,26 +47,26 @@ class LeftPanel(QObject):
@property
@allure.step('Get all accounts from list')
def accounts(self) -> typing.List[constants.user.account_list_item]:
def accounts(self) -> typing.List[constants.WalletAccount]:
if 'title' in self._wallet_account_item.real_name.keys():
del self._wallet_account_item.real_name['title']
time.sleep(1) # to give a chance for the left panel to refresh
raw_data = driver.findAllObjects(self._wallet_account_item.real_name)
accounts = []
if len(raw_data) > 0:
for account_item in raw_data:
# TODO: to fix properly with account data class implementation
name = str(account_item.title)
color = str(account_item.asset.color.name).lower()
emoji = ''
for child in walk_children(account_item):
if hasattr(child, 'emojiId'):
emoji = str(child.emojiId)
break
accounts.append(constants.user.account_list_item(name, color, emoji.split('-')[0]))
else:
raise LookupError("Account items were not found")
return accounts
try:
for account_item in raw_data:
name = str(account_item.title)
color = str(account_item.asset.color.name).lower()
emoji = ''
for child in walk_children(account_item):
if hasattr(child, 'emojiId'):
emoji = str(child.emojiId)
break
accounts.append(constants.WalletAccount(name, color, emoji.split('-')[0]))
return accounts
except LookupError as err:
raise err
@allure.step('Get total balance value from All accounts')
def get_total_balance_value(self):

View File

@ -30,7 +30,7 @@ def test_add_edit_delete_generated_account(main_screen: MainWindow, user_account
with step('Verify that the account is correctly displayed in accounts list'):
assert driver.waitFor(lambda: name in [account.name for account in wallet.left_panel.accounts], 10000), \
f'Account with {name} is not displayed even it should be'
f'Account with {name} is not found in {wallet.left_panel.accounts}'
with step('Edit wallet account'):
new_name = random_wallet_acc_keypair_name()
@ -39,7 +39,7 @@ def test_add_edit_delete_generated_account(main_screen: MainWindow, user_account
with step('Verify that the account is correctly displayed in accounts list'):
assert driver.waitFor(lambda: new_name in [account.name for account in wallet.left_panel.accounts], 10000), \
f'Account with {new_name} is not displayed even it should be'
f'Account with {new_name} is not found in {wallet.left_panel.accounts}'
with step('Delete wallet account with agreement'):
wallet.left_panel.delete_account_from_context_menu(new_name).agree_and_confirm()
@ -51,4 +51,4 @@ def test_add_edit_delete_generated_account(main_screen: MainWindow, user_account
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'
f'Account with {new_name} is found in {wallet.left_panel.accounts} after removal'

View File

@ -6,6 +6,8 @@ import allure
import pytest
from allure_commons._allure import step
import driver
from constants import RandomWalletAccount
from helpers.WalletHelper import authenticate_with_password
from constants.wallet import WalletAccountPopup
@ -24,6 +26,9 @@ from gui.main_window import MainWindow
])
def test_add_new_account_from_wallet_settings(
main_screen: MainWindow, user_account, account_name: str, color: str, emoji: str, emoji_unicode: str):
wallet_account = RandomWalletAccount()
with step('Open add account pop up from wallet settings'):
add_account_popup = \
main_screen.left_panel.open_settings().left_panel.open_wallet_settings().open_add_account_pop_up()
@ -35,7 +40,7 @@ def test_add_new_account_from_wallet_settings(
string.digits, k=4)))
assert add_account_popup.get_error_message() == WalletAccountPopup.WALLET_ACCOUNT_NAME_MIN.value
add_account_popup.set_name(account_name).save_changes()
add_account_popup.set_name(wallet_account.name).save_changes()
authenticate_with_password(user_account)
add_account_popup.wait_until_hidden()
@ -43,14 +48,9 @@ def test_add_new_account_from_wallet_settings(
assert len(main_screen.wait_for_notification()) == 1, \
f"Multiple toast messages appeared"
message = main_screen.wait_for_notification()[0]
assert message == f'"{account_name}" successfully added'
with step('Verify that the account is correctly displayed in accounts list on main wallet screen'):
assert message == f'"{wallet_account.name}" successfully added'
with step('Verify that the account is correctly displayed in accounts list'):
wallet = main_screen.left_panel.open_wallet()
expected_account = constants.user.account_list_item(account_name, None, None)
started_at = time.monotonic()
while expected_account not in wallet.left_panel.accounts:
time.sleep(1)
if time.monotonic() - started_at > 15:
raise LookupError(f'Account {account_name} not found in {wallet.left_panel.accounts}')
assert driver.waitFor(lambda: wallet_account.name in [account.name for account in wallet.left_panel.accounts], 10000), \
f'Account with {wallet_account.name} is not found in {wallet.left_panel.accounts}'

View File

@ -1,15 +1,11 @@
import time
import allure
import pytest
from allure_commons._allure import step
import driver
from scripts.utils.generators import random_emoji_with_unicode, random_wallet_acc_keypair_name, \
random_wallet_account_color
from constants import RandomWalletAccount
from tests.wallet_main_screen import marks
import constants
from gui.components.authenticate_popup import AuthenticatePopup
from gui.main_window import MainWindow
@ -25,15 +21,15 @@ pytestmark = marks
])
def test_plus_button_add_watched_address(main_screen: MainWindow, address: str):
emoji_data = random_emoji_with_unicode()
name = random_wallet_acc_keypair_name()
color = random_wallet_account_color()
wallet_account = RandomWalletAccount()
with step('Add watched address with plus action button'):
wallet = main_screen.left_panel.open_wallet()
account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(name).set_emoji(
emoji_data[0]).set_color(color).set_origin_watched_address(address).save_changes()
account_popup\
.set_name(wallet_account.name)\
.set_emoji(wallet_account.emoji[0])\
.set_color(wallet_account.color).set_origin_watched_address(address).save_changes()
account_popup.wait_until_hidden()
with step('Check authentication popup does not appear'):
@ -44,8 +40,8 @@ def test_plus_button_add_watched_address(main_screen: MainWindow, address: str):
assert len(main_screen.wait_for_notification()) == 1, \
f"Multiple toast messages appeared"
message = main_screen.wait_for_notification()[0]
assert message == f'"{name}" successfully added'
assert message == f'"{wallet_account.name}" successfully added'
with step('Verify that the account is correctly displayed in accounts list'):
assert driver.waitFor(lambda: name in [account.name for account in wallet.left_panel.accounts], 10000), \
f'Account with {name} is not displayed even it should be'
assert driver.waitFor(lambda: wallet_account.name in [account.name for account in wallet.left_panel.accounts], 10000), \
f'Account with {wallet_account.name} is not displayed even it should be'

View File

@ -1,15 +1,13 @@
import time
import allure
import pytest
from allure import step
import driver
from constants import RandomWalletAccount
from helpers.WalletHelper import authenticate_with_password
from scripts.utils.generators import random_wallet_acc_keypair_name
from tests.wallet_main_screen import marks
import constants
from gui.components.signing_phrase_popup import SigningPhrasePopup
from gui.main_window import MainWindow
pytestmark = marks
@ -19,13 +17,13 @@ pytestmark = marks
'Manage an account created from the generated seed phrase')
@pytest.mark.case(703036)
def test_plus_button_manage_account_added_for_new_seed(main_screen: MainWindow, user_account):
name = random_wallet_acc_keypair_name()
wallet_account = RandomWalletAccount()
keypair_name = random_wallet_acc_keypair_name()
with step('Create generated seed phrase wallet account'):
wallet = main_screen.left_panel.open_wallet()
account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(name).set_origin_new_seed_phrase(
account_popup.set_name(wallet_account.name).set_origin_new_seed_phrase(
keypair_name).save_changes()
authenticate_with_password(user_account)
account_popup.wait_until_hidden()
@ -34,13 +32,10 @@ def test_plus_button_manage_account_added_for_new_seed(main_screen: MainWindow,
assert len(main_screen.wait_for_notification()) == 1, \
f"Multiple toast messages appeared"
message = main_screen.wait_for_notification()[0]
assert message == f'"{name}" successfully added'
assert message == f'"{wallet_account.name}" successfully added'
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name, None, None)
started_at = time.monotonic()
while expected_account not in wallet.left_panel.accounts:
time.sleep(1)
if time.monotonic() - started_at > 15:
raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}')
assert driver.waitFor(lambda: wallet_account.name in [account.name for account in wallet.left_panel.accounts],
10000), \
f'Account with {wallet_account.name} is not displayed even it should be'

View File

@ -4,13 +4,13 @@ import allure
import pytest
from allure_commons._allure import step
from constants import RandomWalletAccount
from helpers.WalletHelper import authenticate_with_password
from scripts.utils.generators import random_wallet_acc_keypair_name
from tests.wallet_main_screen import marks
import constants
import driver
from gui.components.signing_phrase_popup import SigningPhrasePopup
from gui.main_window import MainWindow
pytestmark = marks
@ -21,13 +21,13 @@ pytestmark = marks
@pytest.mark.parametrize('address_pair', [constants.user.private_key_address_pair_1])
def test_plus_button_manage_account_from_private_key(main_screen: MainWindow, user_account, address_pair):
name = random_wallet_acc_keypair_name()
wallet_account = RandomWalletAccount()
new_name = random_wallet_acc_keypair_name()
with step('Import an account within private key'):
wallet = main_screen.left_panel.open_wallet()
account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(name).set_origin_private_key(
account_popup.set_name(wallet_account.name).set_origin_private_key(
address_pair.private_key, address_pair.private_key[:5]).save_changes()
authenticate_with_password(user_account)
account_popup.wait_until_hidden()
@ -36,20 +36,17 @@ def test_plus_button_manage_account_from_private_key(main_screen: MainWindow, us
assert len(main_screen.wait_for_notification()) == 1, \
f"Multiple toast messages appeared"
message = main_screen.wait_for_notification()[0]
assert message == f'"{name}" successfully added'
assert message == f'"{wallet_account.name}" successfully added'
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name, None, None)
started_at = time.monotonic()
while expected_account not in wallet.left_panel.accounts:
time.sleep(1)
if time.monotonic() - started_at > 15:
raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}')
assert driver.waitFor(lambda: wallet_account.name in [account.name for account in wallet.left_panel.accounts],
10000), \
f'Account with {wallet_account.name} is not displayed even it should be'
with step('Verify that importing private key reveals correct wallet address'):
account_index = 0
settings_acc_view = (
main_screen.left_panel.open_settings().left_panel.open_wallet_settings().open_account_in_settings(name,
main_screen.left_panel.open_settings().left_panel.open_wallet_settings().open_account_in_settings(wallet_account.name,
account_index))
address = settings_acc_view.get_account_address_value()
assert address == address_pair.wallet_address, \
@ -57,16 +54,13 @@ def test_plus_button_manage_account_from_private_key(main_screen: MainWindow, us
with step('Edit wallet account'):
main_screen.left_panel.open_wallet()
account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(name)
account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(wallet_account.name)
account_popup.set_name(new_name).save_changes()
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(new_name, None, None)
started_at = time.monotonic()
while expected_account not in wallet.left_panel.accounts:
time.sleep(1)
if time.monotonic() - started_at > 15:
raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}')
assert driver.waitFor(lambda: new_name in [account.name for account in wallet.left_panel.accounts],
10000), \
f'Account with {new_name} is not displayed even it should be'
with step('Delete wallet account'):
wallet.left_panel.delete_account_from_context_menu(new_name).agree_and_confirm()

View File

@ -1,17 +1,15 @@
import time
import allure
import pyperclip
import pytest
from allure_commons._allure import step
import driver
from constants import RandomWalletAccount
from constants.wallet import WalletSeedPhrase
from helpers.WalletHelper import authenticate_with_password
from scripts.utils.generators import random_mnemonic, random_wallet_acc_keypair_name
from tests.wallet_main_screen import marks
import constants
from gui.components.signing_phrase_popup import SigningPhrasePopup
from gui.main_window import MainWindow
from scripts.utils.generators import get_wallet_address_from_mnemonic
@ -21,14 +19,15 @@ pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703030', 'Manage a seed phrase imported account')
@pytest.mark.case(703030)
def test_plus_button_manage_account_from_seed_phrase(main_screen: MainWindow, user_account):
name = random_wallet_acc_keypair_name()
wallet_account = RandomWalletAccount()
new_name = random_wallet_acc_keypair_name()
with step('Create imported seed phrase wallet account'):
mnemonic_data = random_mnemonic()
wallet = main_screen.left_panel.open_wallet()
account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(name).open_add_new_account_popup().import_new_seed_phrase(mnemonic_data.split())
account_popup.set_name(wallet_account.name).open_add_new_account_popup().import_new_seed_phrase(mnemonic_data.split())
account_popup.save_changes()
authenticate_with_password(user_account)
account_popup.wait_until_hidden()
@ -37,35 +36,32 @@ def test_plus_button_manage_account_from_seed_phrase(main_screen: MainWindow, us
assert len(main_screen.wait_for_notification()) == 1, \
f"Multiple toast messages appeared"
message = main_screen.wait_for_notification()[0]
assert message == f'"{name}" successfully added'
assert message == f'"{wallet_account.name}" successfully added'
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name, None, None)
started_at = time.monotonic()
while expected_account not in wallet.left_panel.accounts:
time.sleep(1)
if time.monotonic() - started_at > 15:
raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}')
assert driver.waitFor(lambda: wallet_account.name in [account.name for account in wallet.left_panel.accounts],
10000), \
f'Account with {wallet_account.name} is not displayed even it should be'
with step('Verify account address from UI is correct for derived account '):
address_in_ui = wallet.left_panel.copy_account_address_in_context_menu(name).split(':')[-1]
address_in_ui = wallet.left_panel.copy_account_address_in_context_menu(wallet_account.name).split(':')[-1]
address_from_mnemonic = get_wallet_address_from_mnemonic(mnemonic_data)
assert address_in_ui == address_from_mnemonic, \
f'Expected to recover {address_from_mnemonic} but got {address_in_ui}'
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).open_add_new_account_popup()
add_new_account = account_popup.set_name(new_name).open_add_new_account_popup()
add_new_account.enter_new_seed_phrase(mnemonic_data.split())
assert add_new_account.get_already_added_error() == WalletSeedPhrase.WALLET_SEED_PHRASE_ALREADY_ADDED.value
with step('Delete account'):
with step('Delete wallet account'):
wallet.left_panel.delete_account_from_context_menu(name).agree_and_confirm()
wallet.left_panel.delete_account_from_context_menu(wallet_account.name).agree_and_confirm()
with step('Add the same account again and check derivation path'):
add_new_account_popup = wallet.left_panel.open_add_account_popup()
add_same_account = add_new_account_popup.set_name(name).open_add_new_account_popup()
add_same_account = add_new_account_popup.set_name(wallet_account.name).open_add_new_account_popup()
add_same_account.import_new_seed_phrase(mnemonic_data.split())
add_new_account_popup.save_changes()
authenticate_with_password(user_account)
@ -73,7 +69,7 @@ def test_plus_button_manage_account_from_seed_phrase(main_screen: MainWindow, us
with step('Verify derivation path'):
wallet.left_panel.click()
edit_account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(name)
edit_account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(wallet_account.name)
edit_account_popup.copy_derivation_path_button.click()
derivation_path = pyperclip.paste()
assert derivation_path.endswith('0')

View File

@ -5,6 +5,8 @@ import allure
import pytest
from allure_commons._allure import step
import driver
from constants import RandomWalletAccount
from constants.wallet import DerivationPathName
from scripts.utils.generators import random_wallet_acc_keypair_name
from tests.wallet_main_screen import marks
@ -20,25 +22,25 @@ pytestmark = marks
@pytest.mark.case(703028)
def test_plus_button_manage_generated_account_custom_derivation_path(main_screen: MainWindow, user_account):
with step('Create generated wallet account'):
name = random_wallet_acc_keypair_name()
wallet_account = RandomWalletAccount()
wallet = main_screen.left_panel.open_wallet()
account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(name).set_derivation_path(
account_popup.set_name(wallet_account.name).set_derivation_path(
DerivationPathName.select_random_path_name().value,
random.randrange(2, 100),
user_account.password).save_changes()
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name, None, None)
started_at = time.monotonic()
while expected_account not in wallet.left_panel.accounts:
time.sleep(1)
if time.monotonic() - started_at > 15:
raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}')
with step('Verify toast message notification when adding account'):
assert len(main_screen.wait_for_notification()) == 1, \
f"Multiple toast messages appeared"
message = main_screen.wait_for_notification()[0]
assert message == f'"{name}" successfully added'
assert message == f'"{wallet_account.name}" successfully added'
with step('Verify that the account is correctly displayed in accounts list'):
assert driver.waitFor(lambda: wallet_account.name in [account.name for account in wallet.left_panel.accounts],
10000), \
f'Account with {wallet_account.name} is not displayed even it should be'

View File

@ -4,6 +4,7 @@ import allure
import pytest
from allure_commons._allure import step
import driver
from constants.wallet import WalletNetworkSettings
from scripts.utils.generators import random_wallet_acc_keypair_name
from tests.wallet_main_screen import marks
@ -34,9 +35,6 @@ def test_context_menu_edit_default_account(main_screen: MainWindow, user_account
account_popup.set_name(new_name).save_changes()
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(new_name, None, None)
started_at = time.monotonic()
while expected_account not in wallet.left_panel.accounts:
time.sleep(1)
if time.monotonic() - started_at > 15:
raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}')
assert driver.waitFor(lambda: new_name in [account.name for account in wallet.left_panel.accounts],
10000), \
f'Account with {name} is not displayed even it should be'

View File

@ -1,15 +1,11 @@
import time
import allure
import pytest
from allure_commons._allure import step
import driver
from constants import RandomWalletAccount
from scripts.utils.generators import random_wallet_acc_keypair_name
from tests.wallet_main_screen import marks
import constants
from gui.components.signing_phrase_popup import SigningPhrasePopup
from gui.components.toast_message import ToastMessage
from gui.main_window import MainWindow
pytestmark = marks
@ -18,42 +14,38 @@ pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703100',
'Manage a watch-only account from context menu option')
@pytest.mark.case(703100)
@pytest.mark.parametrize('address, name, color, emoji, emoji_unicode, new_name, new_color,'
'new_emoji, new_emoji_unicode', [
pytest.param('0xea123F7beFF45E3C9fdF54B324c29DBdA14a639A', 'AccWatch1', '#2a4af5',
'sunglasses', '1f60e', 'AccWatch1edited', '#216266', 'thumbsup', '1f44d')
@pytest.mark.parametrize('address', [
pytest.param('0xea123F7beFF45E3C9fdF54B324c29DBdA14a639A')
])
def test_right_click_manage_watch_only_account_context_menu(main_screen: MainWindow, address: str, color: str, emoji: str,
emoji_unicode: str,
name: str, new_name: str, new_color: str, new_emoji: str,
new_emoji_unicode: str):
def test_right_click_manage_watch_only_account_context_menu(main_screen: MainWindow, address: str):
wallet_account = RandomWalletAccount()
new_name = random_wallet_acc_keypair_name()
with step('Open wallet main screen'):
wallet = main_screen.left_panel.open_wallet()
with step('Create watched address from context menu'):
account_popup = wallet.left_panel.select_add_watched_address_from_context_menu()
account_popup.set_name(name).set_eth_address(address).save_changes()
account_popup.set_name(wallet_account.name).set_eth_address(address).save_changes()
account_popup.wait_until_hidden()
with step('Verify toast message notification when adding account'):
assert len(main_screen.wait_for_notification()) == 1, \
f"Multiple toast messages appeared"
message = main_screen.wait_for_notification()[0]
assert message == f'"{name}" successfully added'
assert message == f'"{wallet_account.name}" successfully added'
with step('Right click recently watched address and select edit option'):
account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(name)
account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(wallet_account.name)
with step('Set new name, emoji and color for account and save'):
account_popup.set_name(new_name).save_changes()
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(new_name, None, None)
started_at = time.monotonic()
while expected_account not in wallet.left_panel.accounts:
time.sleep(1)
if time.monotonic() - started_at > 15:
raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}')
assert driver.waitFor(lambda: new_name in [account.name for account in wallet.left_panel.accounts],
10000), \
f'Account with {new_name} is not displayed even it should be'
with step('Delete watched account with agreement'):
wallet.left_panel.delete_account_from_context_menu(new_name).confirm()
@ -64,5 +56,5 @@ def test_right_click_manage_watch_only_account_context_menu(main_screen: MainWin
f"Toast message about account removal is not correct or not present. Current list of messages: {messages}"
with step('Verify that the account is not displayed in accounts list'):
assert driver.waitFor(lambda: name not in [account.name for account in wallet.left_panel.accounts], 10000), \
f'Account with {name} is still displayed even it should not be'
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'

View File

@ -5,13 +5,12 @@ import allure
import pytest
from allure import step
from gui.components.toast_message import ToastMessage
from gui.screens.wallet import SavedAddressesView
from scripts.utils.generators import random_wallet_acc_keypair_name
from tests.wallet_main_screen import marks
import configs
import driver
from gui.components.signing_phrase_popup import SigningPhrasePopup
from gui.main_window import MainWindow
pytestmark = marks
@ -19,14 +18,11 @@ pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703021', 'Manage a saved address')
@pytest.mark.case(703021, 704987, 704988)
@pytest.mark.parametrize('name, address, new_name',
[
pytest.param(
''.join(random.choices(string.ascii_letters, k=24)),
'0x8397bc3c5a60a1883174f722403d63a8833312b7',
''.join(random.choices(string.ascii_letters, k=24)))
])
def test_manage_saved_address(main_screen: MainWindow, name: str, address: str, new_name: str):
@pytest.mark.parametrize('address', [pytest.param('0x8397bc3c5a60a1883174f722403d63a8833312b7',)])
def test_manage_saved_address(main_screen: MainWindow, address: str):
name = random_wallet_acc_keypair_name()
new_name = random_wallet_acc_keypair_name()
with step('Add new saved address'):
wallet = main_screen.left_panel.open_wallet()
wallet.left_panel.open_saved_addresses().open_add_saved_address_popup().add_saved_address(name, address)
@ -44,10 +40,10 @@ def test_manage_saved_address(main_screen: MainWindow, name: str, address: str,
with step('Edit saved address to new name'):
SavedAddressesView().open_edit_address_popup(name).edit_saved_address(new_name)
with step('Verify that saved address with new name is in the list of saved addresses'):
with step('Verify that saved address is in the list of saved addresses'):
assert driver.waitFor(
lambda: new_name in SavedAddressesView().address_names,
configs.timeouts.LOADING_LIST_TIMEOUT_MSEC), f'Address: {new_name} not found'
lambda: new_name in wallet.left_panel.open_saved_addresses().address_names,
10000), f'Address: {new_name} is not present when it should be'
with step('Verify toast message when editing saved address'):
messages = main_screen.wait_for_notification()
@ -63,6 +59,6 @@ def test_manage_saved_address(main_screen: MainWindow, name: str, address: str,
f"Toast message about deleting saved address is not correct or not present. Current list of messages: {messages}"
with step('Verify that saved address with new name is not in the list of saved addresses'):
assert not driver.waitFor(
lambda: new_name in wallet.left_panel.open_saved_addresses().get_saved_addresses_list(),
configs.timeouts.LOADING_LIST_TIMEOUT_MSEC), f'Address: {new_name} is still present'
assert driver.waitFor(
lambda: new_name not in wallet.left_panel.open_saved_addresses().get_saved_addresses_list(),
10000), f'Address: {new_name} is still present'