chore(@wallet_account_tests): add several verifications for wallet tests (#205)

- added methods to check values for details
- improve test for status account so it has more verifications
- clean up for add account test
- added object name for toast message
This commit is contained in:
Anastasiya 2023-10-25 15:33:18 +03:00 committed by GitHub
parent 2da105f727
commit 5f94f36a35
6 changed files with 76 additions and 16 deletions

View File

@ -7,6 +7,7 @@ class DerivationPath(Enum):
ETHEREUM_ROPSTEN = 'Ethereum Testnet (Ropsten)'
ETHEREUM_LEDGER = 'Ethereum (Ledger)'
ETHEREUM_LEDGER_LIVE = 'Ethereum (Ledger Live/KeepKey)'
STATUS_ACCOUNT_DERIVATION_PATH = "m / 44' / 60' / 0' / 0 / 0"
class WalletNetworkSettings(Enum):
@ -23,6 +24,11 @@ class WalletNetworkSettings(Enum):
STATUS_ACCOUNT_DEFAULT_COLOR = '#2a4af5'
class WalletAccountSettings(Enum):
STATUS_ACCOUNT_ORIGIN = 'Derived from your default Status keypair'
STORED_ON_DEVICE = 'On device'
class WalletNetworkNaming(Enum):
LAYER1_ETHEREUM = 'Mainnet'
LAYER2_OPTIMISIM = 'Optimism'

View File

@ -275,7 +275,7 @@ mainWindow_Turn_off_Button = {"checkable": False, "container": statusDesktop_mai
# Wallet toast message
mainWallet_Ephemeral_Notification_List = {"container": statusDesktop_mainWindow, "objectName": "ephemeralNotificationList", "type": "StatusListView"}
ephemeralNotificationList_StatusToastMessage = {"container": mainWallet_Ephemeral_Notification_List, "type": "StatusToastMessage", "unnamed": 1, "visible": True}
ephemeralNotificationList_StatusToastMessage = {"container": mainWallet_Ephemeral_Notification_List, "objectName": "statusToastMessage", "type": "StatusToastMessage"}
# Change password popup
change_password_menu_current_password = {"container": statusDesktop_mainWindow_overlay, "objectName": "passwordViewCurrentPassword", "type": "StatusPasswordInput", "visible": True}

View File

@ -105,6 +105,20 @@ class AccountDetailsView(WalletSettingsView):
emoji_id = str(self._wallet_account_emoji.get_object_attribute('emojiId'))
return emoji_id
@allure.step('Get account origin value')
def get_account_origin_value(self):
return str(self._wallet_account_origin.get_object_attribute('subTitle'))
@allure.step('Get account derivation path value')
def get_account_derivation_path_value(self):
return str(self._wallet_account_derivation_path.get_object_attribute('subTitle'))
@allure.step('Get account storage value')
def get_account_storage_value(self):
raw_value = str(self._wallet_account_stored.get_object_attribute('subTitle'))
storage = raw_value.split(">")[-1]
return storage
class NetworkWalletSettings(WalletSettingsView):

View File

@ -4,12 +4,12 @@ import string
import allure
import pytest
from constants.wallet import WalletNetworkSettings
from constants.wallet import WalletNetworkSettings, DerivationPath, WalletAccountSettings
from gui.main_window import MainWindow
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704433',
'Account view: Edit Status default account')
'Account view interactions: Edit Status default account')
@pytest.mark.case(704433)
@pytest.mark.parametrize('new_name', [
pytest.param(''.join(random.choices(string.ascii_letters +
@ -24,6 +24,15 @@ def test_settings_edit_status_account(main_screen: MainWindow, new_name):
assert status_acc_view.get_account_color_value() == WalletNetworkSettings.STATUS_ACCOUNT_DEFAULT_COLOR.value, \
f"Status main account color must be {WalletNetworkSettings.STATUS_ACCOUNT_DEFAULT_COLOR.value}"
assert status_acc_view.get_account_origin_value() == WalletAccountSettings.STATUS_ACCOUNT_ORIGIN.value, \
f"Status account origin label is incorrect"
assert status_acc_view.get_account_derivation_path_value() == DerivationPath.STATUS_ACCOUNT_DERIVATION_PATH.value, \
f"Status account derivation path must be {DerivationPath.STATUS_ACCOUNT_DERIVATION_PATH.value}"
assert status_acc_view.get_account_storage_value() == WalletAccountSettings.STORED_ON_DEVICE.value, \
f"Status account storage should be {WalletAccountSettings.STORED_ON_DEVICE.value}"
account_emoji_id_before = status_acc_view.get_account_emoji_id()
edit_acc_pop_up = status_acc_view.click_edit_account_button()

View File

@ -1,3 +1,5 @@
import random
import string
import time
import allure
@ -7,6 +9,7 @@ from allure_commons._allure import step
import constants
from gui.components.signing_phrase_popup import SigningPhrasePopup
from gui.components.wallet.authenticate_popup import AuthenticatePopup
from gui.components.wallet.wallet_toast_message import WalletToastMessage
from gui.main_window import MainWindow
@ -14,32 +17,32 @@ from gui.main_window import MainWindow
'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')
@pytest.mark.parametrize('account_name, color, emoji, emoji_unicode',
[
pytest.param(''.join(random.choices(string.ascii_letters +
string.digits, k=15)), '#2a4af5', 'sunglasses', '1f60e')
])
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):
def test_add_new_account_from_wallet_settings(
main_screen: MainWindow, user_account, account_name: str, color: str, emoji: str, 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()
add_account_popup.set_name(account_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'):
# TODO: add toast verification when method is fixed
with step('Verify that the account is correctly displayed in accounts list on main wallet screen'):
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)
expected_account = constants.user.account_list_item(account_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}')
raise LookupError(f'Account {account_name} not found in {wallet.left_panel.accounts}')

View File

@ -8,6 +8,7 @@ import constants
import driver
from gui.components.signing_phrase_popup import SigningPhrasePopup
from gui.components.wallet.authenticate_popup import AuthenticatePopup
from gui.components.wallet.wallet_toast_message import WalletToastMessage
from gui.main_window import MainWindow
from gui.screens.settings_keycard import KeycardSettingsView
@ -58,6 +59,8 @@ def test_manage_watch_only_account(main_screen: MainWindow, address: str, color:
account_popup.set_name(name).set_emoji(emoji).set_color(color).set_origin_eth_address(address).save()
account_popup.wait_until_hidden()
# TODO: add toast verification when method is fixed
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name, color.lower(), emoji_unicode)
started_at = time.monotonic()
@ -69,6 +72,8 @@ def test_manage_watch_only_account(main_screen: MainWindow, address: str, color:
with step('Delete wallet account'):
wallet.left_panel.delete_account_from_context_menu(name).confirm()
# TODO: add toast check for deletion when https://github.com/status-im/status-desktop/issues/12541 fixed
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'
@ -78,6 +83,8 @@ def test_manage_watch_only_account(main_screen: MainWindow, address: str, color:
account_popup.set_name(name).set_emoji(emoji).set_color(color).set_eth_address(address).save()
account_popup.wait_until_hidden()
# TODO: add toast verification when method is fixed
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()
@ -110,6 +117,8 @@ def test_manage_generated_account(main_screen: MainWindow, user_account,
AuthenticatePopup().wait_until_appears().authenticate(user_account.password)
account_popup.wait_until_hidden()
# TODO: add toast verification when method is fixed
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name, color.lower(), emoji_unicode)
started_at = time.monotonic()
@ -133,6 +142,8 @@ def test_manage_generated_account(main_screen: MainWindow, user_account,
with step('Delete wallet account with agreement'):
wallet.left_panel.delete_account_from_context_menu(new_name).agree_and_confirm()
# TODO: add toast check for deletion when https://github.com/status-im/status-desktop/issues/12541 fixed
with step('Verify that the account is not displayed in accounts list'):
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'
@ -159,6 +170,8 @@ def test_manage_custom_generated_account(main_screen: MainWindow, user_account,
generated_address_index,
user_account.password).save()
# TODO: add toast verification when method is fixed
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name, color.lower(), emoji_unicode)
started_at = time.monotonic()
@ -170,6 +183,8 @@ def test_manage_custom_generated_account(main_screen: MainWindow, user_account,
with step('Delete wallet account with agreement'):
wallet.left_panel.delete_account_from_context_menu(name).agree_and_confirm()
# TODO: add toast check for deletion when https://github.com/status-im/status-desktop/issues/12541 fixed
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'
@ -191,10 +206,13 @@ def test_private_key_imported_account(main_screen: MainWindow, user_account, add
wallet = main_screen.left_panel.open_wallet()
SigningPhrasePopup().wait_until_appears().confirm_phrase()
account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(name).set_emoji(emoji).set_color(color).set_origin_private_key(address_pair.private_key).save()
account_popup.set_name(name).set_emoji(emoji).set_color(color).set_origin_private_key(
address_pair.private_key).save()
AuthenticatePopup().wait_until_appears().authenticate(user_account.password)
account_popup.wait_until_hidden()
# TODO: add toast verification when method is fixed
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name, color.lower(), emoji_unicode)
started_at = time.monotonic()
@ -226,6 +244,8 @@ def test_private_key_imported_account(main_screen: MainWindow, user_account, add
with step('Delete wallet account'):
wallet.left_panel.delete_account_from_context_menu(new_name).confirm()
# TODO: add toast check for deletion when https://github.com/status-im/status-desktop/issues/12541 fixed
with step('Verify that the account is not displayed in accounts list'):
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'
@ -261,6 +281,8 @@ def test_seed_phrase_imported_account(main_screen: MainWindow, user_account,
AuthenticatePopup().wait_until_appears().authenticate(user_account.password)
account_popup.wait_until_hidden()
# TODO: add toast verification when method is fixed
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name, color.lower(), emoji_unicode)
started_at = time.monotonic()
@ -284,6 +306,8 @@ def test_seed_phrase_imported_account(main_screen: MainWindow, user_account,
with step('Delete wallet account with agreement'):
wallet.left_panel.delete_account_from_context_menu(new_name).agree_and_confirm()
# TODO: add toast check for deletion when https://github.com/status-im/status-desktop/issues/12541 fixed
with step('Verify that the account is not displayed in accounts list'):
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'
@ -309,6 +333,8 @@ def test_seed_phrase_generated_account(main_screen: MainWindow, user_account,
AuthenticatePopup().wait_until_appears().authenticate(user_account.password)
account_popup.wait_until_hidden()
# TODO: add toast verification when method is fixed
with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name, color.lower(), emoji_unicode)
started_at = time.monotonic()
@ -332,6 +358,8 @@ def test_seed_phrase_generated_account(main_screen: MainWindow, user_account,
with step('Delete wallet account with agreement'):
wallet.left_panel.delete_account_from_context_menu(new_name).agree_and_confirm()
# TODO: add toast check for deletion when https://github.com/status-im/status-desktop/issues/12541 fixed
with step('Verify that the account is not displayed in accounts list'):
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'