chore(@e2e): simplify verification after account is added

This commit is contained in:
Anastasiya Semenkevich 2025-01-16 22:57:13 +03:00 committed by Anastasiya
parent 3dfb5de6c6
commit 040c15260c
5 changed files with 22 additions and 55 deletions

View File

@ -25,6 +25,8 @@ class EmojiPopup(QObject):
return self
@allure.step('Select emoji')
# FIXME: fix the method to handle multiple emojis with the same name (for example, person keyword returns
# multiple results with their own unicodes)
def select(self, name: str, attempts: int = 2):
self._search_text_edit.text = name
self._emoji_item.real_name['objectName'] = 'statusEmoji_' + name

View File

@ -50,13 +50,13 @@ class LeftPanel(QObject):
def accounts(self) -> typing.List[constants.user.account_list_item]:
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
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:
name = str(account_item.title)
# 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):

View File

@ -1,19 +1,16 @@
import time
import allure
import pyperclip
import pytest
from allure import step
import driver
from constants.wallet import WalletNetworkSettings
from helpers.WalletHelper import authenticate_with_password
import constants
from driver.aut import AUT
from gui.components.signing_phrase_popup import SigningPhrasePopup
from gui.main_window import MainWindow
from scripts.utils.generators import random_emoji_with_unicode, random_wallet_account_color, \
random_wallet_acc_keypair_name
from scripts.utils.generators import random_wallet_acc_keypair_name
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704459',
@ -24,13 +21,8 @@ from scripts.utils.generators import random_emoji_with_unicode, random_wallet_ac
def test_add_generated_account_restart_add_again(
aut: AUT, main_screen: MainWindow, user_account):
emoji_data1 = random_emoji_with_unicode()
name1 = random_wallet_acc_keypair_name()
color1 = random_wallet_account_color()
emoji_data2 = random_emoji_with_unicode()
name2 = random_wallet_acc_keypair_name()
color2 = random_wallet_account_color()
with step('Open wallet and choose default account'):
default_name = WalletNetworkSettings.STATUS_ACCOUNT_DEFAULT_NAME.value
@ -47,7 +39,7 @@ def test_add_generated_account_restart_add_again(
with step('Add the first generated wallet account'):
wallet = main_screen.left_panel.open_wallet()
account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(name1).set_emoji(emoji_data1[0]).set_color(color1).save_changes()
account_popup.set_name(name1).save_changes()
authenticate_with_password(user_account)
account_popup.wait_until_hidden()
@ -58,12 +50,8 @@ def test_add_generated_account_restart_add_again(
assert message == f'"{name1}" successfully added'
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name1, color1.lower(), emoji_data1[1].split('-')[0])
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: name1 in [account.name for account in wallet.left_panel.accounts], 10000), \
f'Account with {name1} is not displayed even it should be'
with step('Restart application'):
aut.restart()
@ -74,7 +62,7 @@ def test_add_generated_account_restart_add_again(
assert not SigningPhrasePopup().ok_got_it_button.is_visible, \
f"Signing phrase should not be present because it has been hidden in the first step"
account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(name2).set_emoji(emoji_data2[0]).set_color(color2).save_changes()
account_popup.set_name(name2).save_changes()
authenticate_with_password(user_account)
account_popup.wait_until_hidden()
@ -85,9 +73,5 @@ def test_add_generated_account_restart_add_again(
assert message == f'"{name2}" successfully added'
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item_2(name2, color2.lower(), emoji_data2[1].split('-')[0])
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: name2 in [account.name for account in wallet.left_panel.accounts], 10000), \
f'Account with {name2} is not displayed even it should be'

View File

@ -1,14 +1,10 @@
import time
import allure
import pytest
from allure_commons._allure import step
from helpers.WalletHelper import authenticate_with_password
from scripts.utils.generators import random_wallet_acc_keypair_name, random_emoji_with_unicode, \
random_wallet_account_color
from scripts.utils.generators import random_wallet_acc_keypair_name
import constants
import driver
from gui.main_window import MainWindow
@ -18,13 +14,11 @@ from gui.main_window import MainWindow
@pytest.mark.critical
def test_add_edit_delete_generated_account(main_screen: MainWindow, user_account,):
with step('Create generated wallet account'):
emoji_data = random_emoji_with_unicode()
name = random_wallet_acc_keypair_name()
color = random_wallet_account_color()
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).save_changes()
account_popup.set_name(name).save_changes()
authenticate_with_password(user_account)
account_popup.wait_until_hidden()
@ -35,27 +29,17 @@ def test_add_edit_delete_generated_account(main_screen: MainWindow, user_account
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_data[1].split('-')[0])
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: name in [account.name for account in wallet.left_panel.accounts], 10000), \
f'Account with {name} is not displayed even it should be'
with step('Edit wallet account'):
new_name = random_wallet_acc_keypair_name()
new_emoji_data = random_emoji_with_unicode()
new_color = random_wallet_account_color()
account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(name)
account_popup.set_name(new_name).set_emoji(new_emoji_data[0]).set_color(new_color).save_changes()
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, new_color.lower(), new_emoji_data[1].split('-')[0])
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 with agreement'):
wallet.left_panel.delete_account_from_context_menu(new_name).agree_and_confirm()

View File

@ -4,6 +4,7 @@ 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 tests.wallet_main_screen import marks
@ -46,9 +47,5 @@ def test_plus_button_add_watched_address(main_screen: MainWindow, address: str):
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_data[1].split('-')[0])
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: name in [account.name for account in wallet.left_panel.accounts], 10000), \
f'Account with {name} is not displayed even it should be'