chore: update test with accounts with custom derivation paths

This commit is contained in:
Anastasiya Semenkevich 2024-02-02 12:49:09 +03:00 committed by Anastasiya
parent 472aeed2e7
commit fa40ce940c
1 changed files with 35 additions and 18 deletions

View File

@ -12,21 +12,25 @@ from gui.components.toast_message import ToastMessage
from gui.main_window import MainWindow
pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703028', 'Manage a custom generated account')
@pytest.mark.case(703028)
@pytest.mark.parametrize('user_account', [constants.user.user_account_one])
@pytest.mark.parametrize('derivation_path, generated_address_index, name, color, emoji, emoji_unicode', [
pytest.param('Ethereum', '5', 'Ethereum', '#216266', 'sunglasses', '1f60e'),
pytest.param('Ethereum Testnet (Ropsten)', '10', 'Ethereum Testnet ', '#7140fd', 'sunglasses', '1f60e'),
pytest.param('Ethereum (Ledger)', '15', 'Ethereum Ledger', '#2a799b', 'sunglasses', '1f60e'),
pytest.param('Ethereum (Ledger Live/KeepKey)', '20', 'Ethereum Ledger Live', '#7140fd', 'sunglasses', '1f60e'),
pytest.param('N/A', '95', 'Custom path', '#216266', 'sunglasses', '1f60e')
@pytest.mark.parametrize('derivation_path, generated_address_index, name, color, emoji, emoji_unicode, new_name, new_color, new_emoji, new_emoji_unicode',
[
pytest.param('Ethereum', '5', 'Ethereum', '#216266', 'sunglasses', '1f60e', 'EthEdited', '#216266', 'thumbsup', '1f44d'),
pytest.param('Ethereum Testnet (Ropsten)', '10', 'Ethereum Testnet ', '#7140fd', 'sunglasses', '1f60e', 'RopstenEdited', '#216266', 'thumbsup', '1f44d'),
pytest.param('Ethereum (Ledger)', '15', 'Ethereum Ledger', '#2a799b', 'sunglasses', '1f60e', 'LedgerEdited', '#216266', 'thumbsup', '1f44d'),
pytest.param('Ethereum (Ledger Live/KeepKey)', '20', 'Ethereum Ledger Live', '#7140fd', 'sunglasses', '1f60e', 'LiveEdited', '#216266', 'thumbsup', '1f44d'),
pytest.param('N/A', '95', 'Custom path', '#216266', 'sunglasses', '1f60e', 'CustomEdited', '#216266', 'thumbsup', '1f44d')
])
@pytest.mark.skip(reason='https://github.com/status-im/desktop-qa-automation/issues/220')
@pytest.mark.xfail(reason="https://github.com/status-im/status-desktop/issues/12914")
def test_plus_button_manage_generated_account_custom_derivation_path(main_screen: MainWindow, user_account,
derivation_path: str, generated_address_index: int,
name: str, color: str, emoji: str, emoji_unicode: str):
name: str, color: str, emoji: str,
emoji_unicode: str,
new_name: str, new_color: str, new_emoji: str,
new_emoji_unicode: str):
with step('Create generated wallet account'):
wallet = main_screen.left_panel.open_wallet()
SigningPhrasePopup().wait_until_appears().confirm_phrase()
@ -35,11 +39,6 @@ def test_plus_button_manage_generated_account_custom_derivation_path(main_screen
generated_address_index,
user_account.password).save()
with step('Verify toast message notification when adding account'):
assert len(ToastMessage().get_toast_messages) == 1, \
f"Multiple toast messages appeared"
message = ToastMessage().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)
@ -49,14 +48,32 @@ def test_plus_button_manage_generated_account_custom_derivation_path(main_screen
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(ToastMessage().get_toast_messages) == 1, \
f"Multiple toast messages appeared"
message = ToastMessage().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)
account_popup.set_name(new_name).set_emoji(new_emoji).set_color(new_color).save()
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(new_name, new_color.lower(), new_emoji_unicode)
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('Delete wallet account with agreement'):
wallet.left_panel.delete_account_from_context_menu(name).agree_and_confirm()
wallet.left_panel.delete_account_from_context_menu(new_name).agree_and_confirm()
with step('Verify toast message notification when removing account'):
messages = ToastMessage().get_toast_messages
assert f'"{name}" successfully removed' in messages, \
assert f'"{new_name}" successfully removed' in messages, \
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'