test(@wallet_settings): add account from wallet settings view (#121)

This commit is contained in:
Anastasiya Semenkevich 2023-09-25 11:39:22 +03:00 committed by GitHub
parent 963a5c8ea6
commit b742ec0ee8
4 changed files with 52 additions and 4 deletions

View File

@ -44,6 +44,7 @@ factoryResetKeycard_StatusListItem = {"container": settingsContentBase_ScrollVie
# Wallet Settings View
mainWindow_WalletView = {"container": statusDesktop_mainWindow, "type": "WalletView", "unnamed": 1, "visible": True}
settings_Wallet_MainView_Networks = {"container": statusDesktop_mainWindow, "objectName": "networksItem", "type": "StatusListItem"}
settings_Wallet_MainView_AddNewAccountButton = {"container": statusDesktop_mainWindow, "objectName": "settings_Wallet_MainView_AddNewAccountButton", "type": "StatusButton", "visible": True}
settingsContentBaseScrollView_accountOrderItem_StatusListItem = {"container": settingsContentBase_ScrollView, "objectName": "accountOrderItem", "type": "StatusListItem", "visible": True}
settingsContentBaseScrollView_WalletNetworkDelegate = {"container": settingsContentBase_ScrollView, "type": "WalletNetworkDelegate", "unnamed": 1, "visible": True}
settingsContentBaseScrollView_StatusListItem = {"container": settingsContentBase_ScrollView, "type": "StatusListItem", "unnamed": 1, "visible": True}

View File

@ -14,6 +14,7 @@ from gui.components.change_password_popup import ChangePasswordPopup
from gui.components.settings.send_contact_request_popup import SendContactRequest
from gui.components.social_links_popup import SocialLinksPopup
from gui.components.wallet.testnet_mode_popup import TestnetModePopup
from gui.components.wallet.wallet_account_popups import AccountPopup
from gui.elements.qt.button import Button
from gui.elements.qt.list import List
from gui.elements.qt.object import QObject
@ -110,7 +111,8 @@ class ProfileSettingsView(QObject):
def social_links(self) -> dict:
self._scroll_view.vertical_scroll_to(self._add_more_links_label)
links = {}
for link_name in walk_children(driver.waitForObjectExists(self._links_list.real_name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC)):
for link_name in walk_children(
driver.waitForObjectExists(self._links_list.real_name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC)):
if getattr(link_name, 'id', '') == 'draggableDelegate':
for link_value in walk_children(link_name):
if getattr(link_value, 'id', '') == 'textMouseArea':
@ -325,18 +327,24 @@ class KeycardSettingsView(QObject):
assert driver.waitFor(lambda: self._import_from_keycard_button.is_visible,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), f'Import keycard button not visible'
assert driver.waitFor(lambda: self._check_whats_on_keycard_button.is_visible,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC ), f'Check whats new keycard button not visible'
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), f'Check whats new keycard button not visible'
assert driver.waitFor(lambda: self._factory_reset_keycard_button.is_visible,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC ), f'Factory reset keycard button not visible'
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), f'Factory reset keycard button not visible'
class WalletSettingsView(QObject):
def __init__(self):
super().__init__('mainWindow_WalletView')
self._wallet_settings_add_new_account_button = Button('settings_Wallet_MainView_AddNewAccountButton')
self._wallet_network_button = Button('settings_Wallet_MainView_Networks')
self._account_order_button = Button('settingsContentBaseScrollView_accountOrderItem_StatusListItem')
@allure.step('Open add account pop up in wallet settings')
def open_add_account_pop_up(self):
self._wallet_settings_add_new_account_button.click()
return AccountPopup().wait_until_appears()
@allure.step('Open networks in wallet settings')
def open_networks(self):
self._wallet_network_button.click()

View File

@ -106,7 +106,7 @@ def test_back_up_seed_phrase(main_screen: MainWindow):
settings = main_screen.left_panel.open_settings()
back_up = settings.left_panel.open_back_up_seed_phrase()
back_up.back_up_seed_phrase()
with step('Verify back up seed phrase banner dissapeared'):
with step('Verify back up seed phrase banner disappeared'):
assert not BackUpSeedPhraseBanner().is_visible, 'Secure your seed phrase banner visible'

View File

@ -1,8 +1,11 @@
import time
import allure
import pytest
from allure import step
import configs
import constants
import driver
from gui.components.signing_phrase_popup import SigningPhrasePopup
from gui.components.wallet.authenticate_popup import AuthenticatePopup
@ -149,3 +152,39 @@ def test_change_account_order_not_possible(main_screen: MainWindow, default_name
with step('Back button is present and text on top is correct'):
assert account_order.text_labels_from_edit_account_order_settings[0] == text_on_top
assert account_order.is_back_button_present() is True
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/edit/703598',
'Add new account from wallet settings screen')
@pytest.mark.case(703598)
@pytest.mark.parametrize('user_account', [constants.user.user_account_one])
@pytest.mark.parametrize('name, color, emoji, emoji_unicode, '
'new_name, new_color, new_emoji, new_emoji_unicode', [
pytest.param('GenAcc1', '#2a4af5', 'sunglasses', '1f60e',
'GenAcc1edited', '#216266', 'thumbsup', '1f44d')
])
def test_add_new_account_from_wallet_settings(main_screen: MainWindow, user_account,
color: str, emoji: str, emoji_unicode: str,
name: str, new_name: str, new_color: str, new_emoji: str, new_emoji_unicode: str):
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()
with step('Add a new generated account from wallet settings screen'):
add_account_popup.set_name(name).set_emoji(emoji).set_color(color).save()
AuthenticatePopup().wait_until_appears().authenticate(user_account.password)
add_account_popup.wait_until_hidden()
with step('Verify that the account is correctly displayed in accounts list'):
wallet = main_screen.left_panel.open_wallet()
SigningPhrasePopup().wait_until_appears().confirm_phrase()
expected_account = constants.user.account_list_item(name, color.lower(), 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}')