chore: replaced locator for account item, refactored method using index and added index in tests

This commit is contained in:
Valentina Novgorodtceva 2024-03-04 17:45:06 +07:00 committed by Anastasiya
parent 2117675172
commit d0fc8ddc3d
8 changed files with 24 additions and 11 deletions

View File

@ -527,7 +527,7 @@ networkSettingsNetworks_Arbitrum_Goerli = {"container": settingsContentBase_Scro
networkSettingsNetworks_Mainnet_Goerli_sensor = {"container": networkSettingsNetworks_Mainnet_Goerli, "objectName": "walletNetworkDelegate_Mainnet_5_sensor", "id": "sensor", "type": "MouseArea", "unnamed": 1, "visible": True} networkSettingsNetworks_Mainnet_Goerli_sensor = {"container": networkSettingsNetworks_Mainnet_Goerli, "objectName": "walletNetworkDelegate_Mainnet_5_sensor", "id": "sensor", "type": "MouseArea", "unnamed": 1, "visible": True}
networkSettingsNetowrks_Mainnet_Testlabel = {"container": networkSettingsNetworks_Mainnet_Goerli_sensor, "objectName": "testnetLabel_Mainnet", "type": "StatusBaseText", "visible": True} networkSettingsNetowrks_Mainnet_Testlabel = {"container": networkSettingsNetworks_Mainnet_Goerli_sensor, "objectName": "testnetLabel_Mainnet", "type": "StatusBaseText", "visible": True}
settingsWalletAccountDelegate_Status_account = {"container": settingsContentBase_ScrollView, "objectName": "Status account", "type": "WalletAccountDelegate", "visible": True} settingsWalletAccountDelegate_Status_account = {"container": settingsContentBase_ScrollView, "objectName": "Status account", "type": "WalletAccountDelegate", "visible": True}
settingsWalletAccountDelegate = {"container": settingsContentBase_ScrollView, "objectName": RegularExpression("*"), "type": "WalletAccountDelegate", "visible": True} settingsWalletAccountDelegate = {"container": settingsContentBase_ScrollView, "index": 0, "objectName": RegularExpression("*"), "type": "WalletAccountDelegate", "visible": True}
settingsWalletKeyPairDelegate = {"container": settingsContentBase_ScrollView, "objectName": "walletKeyPairDelegate", "type": "StatusListItem", "visible": True} settingsWalletKeyPairDelegate = {"container": settingsContentBase_ScrollView, "objectName": "walletKeyPairDelegate", "type": "StatusListItem", "visible": True}
settingsWalletAccountTotalBalance = {"container": settingsContentBase_ScrollView, "objectName": "includeTotalBalanceListItem", "type": "StatusListItem", "visible": True} settingsWalletAccountTotalBalance = {"container": settingsContentBase_ScrollView, "objectName": "includeTotalBalanceListItem", "type": "StatusListItem", "visible": True}
settingsWalletAccountTotalBalanceToggle = {"checkable": True, "container": settingsWalletAccountTotalBalance, "type": "StatusSwitch", "visible": True} settingsWalletAccountTotalBalanceToggle = {"checkable": True, "container": settingsWalletAccountTotalBalance, "type": "StatusSwitch", "visible": True}

View File

@ -93,8 +93,9 @@ class WalletSettingsView(QObject):
return keypair_names return keypair_names
@allure.step('Open account view in wallet settings by name') @allure.step('Open account view in wallet settings by name')
def open_account_in_settings(self, name): def open_account_in_settings(self, name: str, index: int):
self._wallet_account_from_keypair.real_name['objectName'] = name self._wallet_account_from_keypair.real_name['objectName'] = name
self._wallet_account_from_keypair.real_name['index'] = index
self._wallet_account_from_keypair.click() self._wallet_account_from_keypair.click()
return AccountDetailsView().wait_until_appears() return AccountDetailsView().wait_until_appears()

View File

@ -35,7 +35,7 @@ def keys_screen(main_window) -> KeysView:
pytest.param(False, 'Account 1'), pytest.param(False, 'Account 1'),
pytest.param(True, 'Account 1', marks=pytest.mark.critical) pytest.param(True, 'Account 1', marks=pytest.mark.critical)
]) ])
def test_import_seed_phrase(aut: AUT, keys_screen, main_window, user_account, default_name, autocomplete: bool): def test_import_seed_phrase(aut: AUT, keys_screen, main_window, user_account, default_name: str, autocomplete: bool):
with step('Open import seed phrase view and enter seed phrase'): with step('Open import seed phrase view and enter seed phrase'):
input_view = keys_screen.open_import_seed_phrase_view().open_seed_phrase_input_view() input_view = keys_screen.open_import_seed_phrase_view().open_seed_phrase_input_view()
input_view.input_seed_phrase(user_account.seed_phrase, autocomplete) input_view.input_seed_phrase(user_account.seed_phrase, autocomplete)
@ -54,8 +54,10 @@ def test_import_seed_phrase(aut: AUT, keys_screen, main_window, user_account, de
BetaConsentPopup().confirm() BetaConsentPopup().confirm()
with (step('Verify that restored account reveals correct status wallet address')): with (step('Verify that restored account reveals correct status wallet address')):
status_account_index = 0
status_acc_view = ( status_acc_view = (
LeftPanel().open_settings().left_panel.open_wallet_settings().open_account_in_settings(default_name)) LeftPanel().open_settings().left_panel.open_wallet_settings().open_account_in_settings(default_name,
status_account_index))
address = status_acc_view.get_account_address_value() address = status_acc_view.get_account_address_value()
assert address == user_account.status_address, \ assert address == user_account.status_address, \
f"Recovered account should have address {user_account.status_address}, but has {address}" f"Recovered account should have address {user_account.status_address}, but has {address}"

View File

@ -22,7 +22,7 @@ pytestmark = marks
pytest.param('0xea123F7beFF45E3C9fdF54B324c29DBdA14a639A', 'Account 1', pytest.param('0xea123F7beFF45E3C9fdF54B324c29DBdA14a639A', 'Account 1',
'WatchOnly', '#2a4af5', 'sunglasses', '😎 ', 'Generated', '#216266', 'thumbsup', '👍 ') 'WatchOnly', '#2a4af5', 'sunglasses', '😎 ', 'Generated', '#216266', 'thumbsup', '👍 ')
]) ])
#@pytest.mark.skip(reason='https://github.com/status-im/desktop-qa-automation/issues/519') @pytest.mark.skip(reason='https://github.com/status-im/desktop-qa-automation/issues/519')
def test_change_account_order_by_drag_and_drop(main_screen: MainWindow, user_account, address: str, default_name, 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, name: str, color: str, emoji: str, acc_emoji: str, second_name: str,
second_color: str, second_emoji: str, second_acc_emoji: str): second_color: str, second_emoji: str, second_acc_emoji: str):

View File

@ -40,7 +40,8 @@ def test_delete_generated_account_from_wallet_settings(
add_account_popup.wait_until_hidden() add_account_popup.wait_until_hidden()
with step('Open account details view for the generated account'): with step('Open account details view for the generated account'):
acc_view = WalletSettingsView().open_account_in_settings(account_name) account_index = 1
acc_view = WalletSettingsView().open_account_in_settings(account_name, account_index)
with step('Verify details view for the generated account'): with step('Verify details view for the generated account'):
assert acc_view.get_account_name_value() == account_name, \ assert acc_view.get_account_name_value() == account_name, \

View File

@ -33,8 +33,9 @@ def test_settings_edit_status_account(main_screen: MainWindow, new_name):
when display name is {profile_display_name}" when display name is {profile_display_name}"
with step('Open Status account view in wallet settings'): with step('Open Status account view in wallet settings'):
status_acc_view = ( status_account_index = 0
SettingsScreen().left_panel.open_wallet_settings().open_account_in_settings('Account 1')) status_acc_view = SettingsScreen().left_panel.open_wallet_settings().open_account_in_settings('Account 1',
status_account_index)
with step('Check the default values on the account details view for main account'): with step('Check the default values on the account details view for main account'):
assert status_acc_view.get_account_name_value() == WalletNetworkSettings.STATUS_ACCOUNT_DEFAULT_NAME.value, \ assert status_acc_view.get_account_name_value() == WalletNetworkSettings.STATUS_ACCOUNT_DEFAULT_NAME.value, \

View File

@ -14,6 +14,8 @@ from gui.main_window import MainWindow
from gui.screens.settings_wallet import WalletSettingsView from gui.screens.settings_wallet import WalletSettingsView
pytestmark = marks pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703508', @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703508',
'Watched addresses: Excl. / Include in total balance functionality for watched address') 'Watched addresses: Excl. / Include in total balance functionality for watched address')
@pytest.mark.case(703508) @pytest.mark.case(703508)
@ -46,7 +48,8 @@ def test_settings_include_in_total_balance(main_screen: MainWindow, name, watche
but currently the list is {keypairs_names}" but currently the list is {keypairs_names}"
with step('Open account details view for the watched address'): with step('Open account details view for the watched address'):
acc_view = WalletSettingsView().open_account_in_settings(name) account_index = 0
acc_view = WalletSettingsView().open_account_in_settings(name, account_index)
with step('Verify details view for the watched address'): with step('Verify details view for the watched address'):
assert driver.waitFor( assert driver.waitFor(

View File

@ -13,6 +13,8 @@ from gui.components.wallet.authenticate_popup import AuthenticatePopup
from gui.main_window import MainWindow from gui.main_window import MainWindow
pytestmark = marks pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703029', 'Manage a private key imported account') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703029', 'Manage a private key imported account')
@pytest.mark.case(703029) @pytest.mark.case(703029)
@pytest.mark.parametrize('user_account', [constants.user.user_account_one]) @pytest.mark.parametrize('user_account', [constants.user.user_account_one])
@ -24,7 +26,8 @@ pytestmark = marks
]) ])
def test_plus_button_manage_account_from_private_key(main_screen: MainWindow, user_account, address_pair, def test_plus_button_manage_account_from_private_key(main_screen: MainWindow, user_account, address_pair,
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): new_name: str, new_color: str, new_emoji: str,
new_emoji_unicode: str):
with step('Import an account within private key'): with step('Import an account within private key'):
wallet = main_screen.left_panel.open_wallet() wallet = main_screen.left_panel.open_wallet()
SigningPhrasePopup().wait_until_appears().confirm_phrase() SigningPhrasePopup().wait_until_appears().confirm_phrase()
@ -49,8 +52,10 @@ def test_plus_button_manage_account_from_private_key(main_screen: MainWindow, us
raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}') raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}')
with step('Verify that importing private key reveals correct wallet address'): with step('Verify that importing private key reveals correct wallet address'):
account_index = 0
settings_acc_view = ( settings_acc_view = (
main_screen.left_panel.open_settings().left_panel.open_wallet_settings().open_account_in_settings(name)) main_screen.left_panel.open_settings().left_panel.open_wallet_settings().open_account_in_settings(name,
account_index))
address = settings_acc_view.get_account_address_value() address = settings_acc_view.get_account_address_value()
assert address == address_pair.wallet_address, \ assert address == address_pair.wallet_address, \
f"Recovered account should have address {address_pair.wallet_address}, but has {address}" f"Recovered account should have address {address_pair.wallet_address}, but has {address}"