chore: verification for toast message, test decopling (#222)

- added toast message verification when adding account
- decoupled test for watch only account
This commit is contained in:
Anastasiya 2023-10-27 10:00:07 +03:00 committed by GitHub
parent df95604257
commit 5b693667b6
2 changed files with 55 additions and 8 deletions

View File

@ -34,7 +34,11 @@ def test_add_new_account_from_wallet_settings(
AuthenticatePopup().wait_until_appears().authenticate(user_account.password)
add_account_popup.wait_until_hidden()
# TODO: add toast verification when method is fixed
with step('Verify toast message notification when adding account'):
assert len(WalletToastMessage().get_toast_messages) == 1, \
f"Multiple toast messages appeared"
message = WalletToastMessage().get_toast_messages[0]
assert message == f'"{account_name}" successfully added'
with step('Verify that the account is correctly displayed in accounts list on main wallet screen'):

View File

@ -59,7 +59,11 @@ def test_manage_watch_only_account(main_screen: MainWindow, address: str, color:
account_popup.set_name(name).set_emoji(emoji).set_color(color).set_origin_eth_address(address).save()
account_popup.wait_until_hidden()
# TODO: add toast verification when method is fixed
with step('Verify toast message notification when adding account'):
assert len(WalletToastMessage().get_toast_messages) == 1, \
f"Multiple toast messages appeared"
message = WalletToastMessage().get_toast_messages[0]
assert message == f'"{name}" successfully added'
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name, color.lower(), emoji_unicode)
@ -78,12 +82,31 @@ def test_manage_watch_only_account(main_screen: MainWindow, address: str, color:
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'
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703026',
'Manage a watch-only account from context menu option')
@pytest.mark.case(703026)
@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')
])
def test_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):
with step('Create watch-only wallet account via context menu'):
wallet = main_screen.left_panel.open_wallet()
SigningPhrasePopup().wait_until_appears().confirm_phrase()
account_popup = wallet.left_panel.select_add_watched_address_from_context_menu()
account_popup.set_name(name).set_emoji(emoji).set_color(color).set_eth_address(address).save()
account_popup.wait_until_hidden()
# TODO: add toast verification when method is fixed
with step('Verify toast message notification when adding account'):
assert len(WalletToastMessage().get_toast_messages) == 1, \
f"Multiple toast messages appeared"
message = WalletToastMessage().get_toast_messages[0]
assert message == f'"{name}" successfully added'
with step('Edit wallet account'):
account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(name)
@ -117,7 +140,11 @@ def test_manage_generated_account(main_screen: MainWindow, user_account,
AuthenticatePopup().wait_until_appears().authenticate(user_account.password)
account_popup.wait_until_hidden()
# TODO: add toast verification when method is fixed
with step('Verify toast message notification when adding account'):
assert len(WalletToastMessage().get_toast_messages) == 1, \
f"Multiple toast messages appeared"
message = WalletToastMessage().get_toast_messages[0]
assert message == f'"{name}" successfully added'
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name, color.lower(), emoji_unicode)
@ -171,7 +198,11 @@ def test_manage_custom_generated_account(main_screen: MainWindow, user_account,
generated_address_index,
user_account.password).save()
# TODO: add toast verification when method is fixed
with step('Verify toast message notification when adding account'):
assert len(WalletToastMessage().get_toast_messages) == 1, \
f"Multiple toast messages appeared"
message = WalletToastMessage().get_toast_messages[0]
assert message == f'"{name}" successfully added'
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name, color.lower(), emoji_unicode)
@ -212,7 +243,11 @@ def test_private_key_imported_account(main_screen: MainWindow, user_account, add
AuthenticatePopup().wait_until_appears().authenticate(user_account.password)
account_popup.wait_until_hidden()
# TODO: add toast verification when method is fixed
with step('Verify toast message notification when adding account'):
assert len(WalletToastMessage().get_toast_messages) == 1, \
f"Multiple toast messages appeared"
message = WalletToastMessage().get_toast_messages[0]
assert message == f'"{name}" successfully added'
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name, color.lower(), emoji_unicode)
@ -282,7 +317,11 @@ def test_seed_phrase_imported_account(main_screen: MainWindow, user_account,
AuthenticatePopup().wait_until_appears().authenticate(user_account.password)
account_popup.wait_until_hidden()
# TODO: add toast verification when method is fixed
with step('Verify toast message notification when adding account'):
assert len(WalletToastMessage().get_toast_messages) == 1, \
f"Multiple toast messages appeared"
message = WalletToastMessage().get_toast_messages[0]
assert message == f'"{name}" successfully added'
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name, color.lower(), emoji_unicode)
@ -334,7 +373,11 @@ def test_seed_phrase_generated_account(main_screen: MainWindow, user_account,
AuthenticatePopup().wait_until_appears().authenticate(user_account.password)
account_popup.wait_until_hidden()
# TODO: add toast verification when method is fixed
with step('Verify toast message notification when adding account'):
assert len(WalletToastMessage().get_toast_messages) == 1, \
f"Multiple toast messages appeared"
message = WalletToastMessage().get_toast_messages[0]
assert message == f'"{name}" successfully added'
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name, color.lower(), emoji_unicode)