chore: several changes for wallet settings tests (#317)

* chore: fix several wallet tests

* disable account ordering because of bug

* remove test self as not needed anymore

* add log level

* click the revert button 2 times
This commit is contained in:
Anastasiya 2023-11-17 17:27:51 +03:00 committed by GitHub
parent a67646ec99
commit e6c5443d3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 48 additions and 38 deletions

View File

@ -25,3 +25,7 @@ SQUISH_DIR = SystemPath(os.getenv('SQUISH_DIR'))
# Status Application
STATUS_DATA: SystemPath = RUN / 'status'
# Sets log level, can be one of: "ERROR", "WARN", "INFO", "DEBUG", "TRACE". "INFO"
LOG_LEVEL = 'DEBUG'

View File

@ -107,6 +107,7 @@ class AUT:
f'--port={self.port}',
f'"{self.path}"',
f'-d={self.app_data}',
f'--LOG_LEVEL={configs.testpath.LOG_LEVEL}',
options
]
self.pid = local_system.execute(command)

View File

@ -75,7 +75,7 @@ class AccountPopup(BasePopup):
def set_origin_watched_address(self, value: str):
self._origin_combobox.click()
self._watched_address_origin_item.click()
assert self._origin_combobox.__getattr__('title') == WalletOrigin.WATCHED_ADDRESS_ORIGIN.value
assert getattr(self._origin_combobox.object, 'title') == WalletOrigin.WATCHED_ADDRESS_ORIGIN.value
self._address_text_edit.text = value
return self

View File

@ -249,10 +249,16 @@ class EditNetworkSettings(WalletSettingsView):
self._test_network_tab.click()
@allure.step('Click Revert to default button and redirect to Networks screen')
def click_revert_to_default_and_go_to_networks_main_screen(self):
def click_revert_to_default_and_go_to_networks_main_screen(self, attempts: int=2):
self._network_edit_scroll.vertical_down_to(self._network_revert_to_default)
self._network_revert_to_default.click()
return NetworkWalletSettings().wait_until_appears()
try:
return NetworkWalletSettings().wait_until_appears()
except AssertionError:
if attempts:
return self.click_revert_to_default_and_go_to_networks_main_screen(attempts - 1)
else:
raise f"Networks screen was not opened"
@allure.step('Check toast message')
def check_toast_message(self, network_tab):

View File

@ -65,7 +65,7 @@ class LeftPanel(QObject):
@close_exists(BasePopup())
def open_saved_addresses(self) -> 'SavedAddressesView':
self._saved_addresses_button.click()
return SavedAdressesView().wait_until_appears()
return SavedAddressesView().wait_until_appears()
@allure.step('Select account from list')
@close_exists(BasePopup())
@ -130,10 +130,10 @@ class LeftPanel(QObject):
raise
class SavedAdressesView(QObject):
class SavedAddressesView(QObject):
def __init__(self):
super(SavedAdressesView, self).__init__('mainWindow_SavedAddressesView')
super(SavedAddressesView, self).__init__('mainWindow_SavedAddressesView')
self._add_new_address_button = Button('mainWallet_Saved_Addreses_Add_Buttton')
self._address_list_item = QObject('savedAddressView_Delegate')
self._send_button = Button('send_StatusRoundButton')

View File

@ -2,10 +2,11 @@ import allure
import pytest
from allure_commons._allure import step
import configs
import driver
from gui.components.signing_phrase_popup import SigningPhrasePopup
from gui.components.wallet.authenticate_popup import AuthenticatePopup
from gui.main_window import MainWindow
from gui.main_window import MainWindow, LeftPanel
from scripts.tools import image
@ -18,6 +19,7 @@ from scripts.tools import image
pytest.param('0xea123F7beFF45E3C9fdF54B324c29DBdA14a639A', 'Status account',
'WatchOnly', '#2a4af5', 'sunglasses', '😎 ', 'Generated', '#216266', 'thumbsup', '👍 ')
])
@pytest.mark.skip(reason="https://github.com/status-im/status-desktop/issues/12777")
def test_change_account_order_by_drag_and_drop(main_screen: MainWindow, user_account, address: str, default_name,
name: str, color: str, emoji: str, acc_emoji: str, second_name: str,
second_color: str, second_emoji: str, second_acc_emoji: str):
@ -53,14 +55,16 @@ def test_change_account_order_by_drag_and_drop(main_screen: MainWindow, user_acc
with step('Verify the account order'):
with step('Account order is correct in wallet settings'):
assert driver.waitFor(lambda: account_order.accounts[0].name == name)
assert driver.waitFor(lambda: account_order.accounts[1].name == second_name)
assert driver.waitFor(lambda: account_order.accounts[2].name == default_name)
assert driver.waitFor(lambda: account_order.accounts[0].name == name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
assert driver.waitFor(lambda: account_order.accounts[1].name == second_name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
assert driver.waitFor(lambda: account_order.accounts[2].name == default_name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
with step('Account order is correct in wallet'):
wallet = main_screen.left_panel.open_wallet()
assert driver.waitFor(lambda: wallet.left_panel.accounts[0].name == name)
assert driver.waitFor(lambda: wallet.left_panel.accounts[1].name == second_name)
assert driver.waitFor(lambda: wallet.left_panel.accounts[2].name == default_name)
wallet.left_panel.select_account(default_name)
assert driver.waitFor(lambda: wallet.left_panel.accounts[0].name == name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
assert driver.waitFor(lambda: wallet.left_panel.accounts[1].name == second_name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
assert driver.waitFor(lambda: wallet.left_panel.accounts[2].name == default_name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
with step('Drag second account to the top of the list'):
account_order = main_screen.left_panel.open_settings().left_panel.open_wallet_settings().open_account_order()
@ -68,14 +72,16 @@ def test_change_account_order_by_drag_and_drop(main_screen: MainWindow, user_acc
with step('Verify the account order'):
with step('Account order is correct in wallet settings'):
assert driver.waitFor(lambda: account_order.accounts[0].name == second_name)
assert driver.waitFor(lambda: account_order.accounts[1].name == name)
assert driver.waitFor(lambda: account_order.accounts[2].name == default_name)
assert driver.waitFor(lambda: account_order.accounts[0].name == second_name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
assert driver.waitFor(lambda: account_order.accounts[1].name == name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
assert driver.waitFor(lambda: account_order.accounts[2].name == default_name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
with step('Account order is correct in wallet'):
wallet = main_screen.left_panel.open_wallet()
assert driver.waitFor(lambda: wallet.left_panel.accounts[0].name == second_name)
assert driver.waitFor(lambda: wallet.left_panel.accounts[1].name == name)
assert driver.waitFor(lambda: wallet.left_panel.accounts[2].name == default_name)
wallet.left_panel.select_account(default_name)
assert driver.waitFor(lambda: wallet.left_panel.accounts[0].name == second_name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
assert driver.waitFor(lambda: wallet.left_panel.accounts[1].name == name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
assert driver.waitFor(lambda: wallet.left_panel.accounts[2].name == default_name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/edit/703416',

View File

@ -2,6 +2,7 @@ import allure
import pytest
from allure import step
import configs.system
from constants.wallet import WalletNetworkSettings, WalletNetworkNaming
from gui.components.wallet.testnet_mode_banner import TestnetModeBanner
from gui.components.wallet.wallet_toast_message import WalletToastMessage
@ -33,7 +34,8 @@ def test_switch_testnet_mode(main_screen: MainWindow):
message = WalletToastMessage().get_toast_messages[0]
assert message == WalletNetworkSettings.TESTNET_ENABLED_TOAST_MESSAGE.value, \
f"Toast message is incorrect, current message is {message}"
TestnetModeBanner().wait_until_appears()
if not configs.system.TEST_MODE:
TestnetModeBanner().wait_until_appears()
assert networks.is_testnet_mode_toggle_checked(), f"Testnet toggle if off when it should not"
with step('Verify networks are switched to testnets'):
@ -53,7 +55,8 @@ def test_switch_testnet_mode(main_screen: MainWindow):
message = WalletToastMessage().get_toast_messages[1]
assert message == WalletNetworkSettings.TESTNET_DISABLED_TOAST_MESSAGE.value, \
f"Toast message is incorrect, current message is {message}"
TestnetModeBanner().wait_until_hidden()
if not configs.system.TEST_MODE:
TestnetModeBanner().wait_until_appears()
assert not networks.is_testnet_mode_toggle_checked(), f"Testnet toggle is on when it should not"
@ -79,7 +82,8 @@ def test_toggle_testnet_toggle_on_and_close_the_confirmation(main_screen: MainWi
with step('Verify that Testnet mode is not turned off'):
assert not WalletToastMessage().is_visible
assert not TestnetModeBanner().is_visible, f"Testnet banner is present when it should not"
if not configs.system.TEST_MODE:
assert not TestnetModeBanner().is_visible, f"Testnet banner is present when it should not"
assert not networks.is_testnet_mode_toggle_checked(), \
f"Testnet toggle is turned on when it should not"
@ -105,7 +109,9 @@ def test_switch_testnet_off_by_toggle_and_cancel_in_confirmation(main_screen: Ma
message = WalletToastMessage().get_toast_messages[0]
assert message == WalletNetworkSettings.TESTNET_ENABLED_TOAST_MESSAGE.value, \
f"Toast message is incorrect, current message is {message}"
TestnetModeBanner().wait_until_appears()
if not configs.system.TEST_MODE:
assert TestnetModeBanner().wait_until_appears(), f"Testnet banner is not present when it should"
assert networks.is_testnet_mode_toggle_checked(), f"testnet toggle is off"
with step('Toggle the Testnet mode toggle Off'):
@ -116,4 +122,5 @@ def test_switch_testnet_off_by_toggle_and_cancel_in_confirmation(main_screen: Ma
assert networks.is_testnet_mode_toggle_checked(), f"Testnet toggle is turned OFF when it should not"
with step('Verify that Testnet mode is not turned off'):
assert TestnetModeBanner().is_visible, f"Testnet banner is not present when it should"
if not configs.system.TEST_MODE:
assert TestnetModeBanner().wait_until_appears(), f"Testnet banner is not present when it should"

View File

@ -1,14 +0,0 @@
import logging
import allure
import pytest
from allure_commons._allure import step
_logger = logging.getLogger(__name__)
pytestmark = allure.suite("Self")
@pytest.mark.self
def test_start_aut(main_window):
with step("Verify: 'main_window' fixture launched test app and prepared main window"):
assert main_window.exists