test: test_delete_generated_account_from_wallet_settings implemented (#226)

Update test_wallet_settings_acct_interactions_delete_account.py
This commit is contained in:
Anastasiya 2023-10-30 09:58:45 +03:00 committed by GitHub
parent b25cbb5ce3
commit 9661e9d247
10 changed files with 111 additions and 6 deletions

View File

@ -8,6 +8,7 @@ class DerivationPath(Enum):
ETHEREUM_LEDGER = 'Ethereum (Ledger)'
ETHEREUM_LEDGER_LIVE = 'Ethereum (Ledger Live/KeepKey)'
STATUS_ACCOUNT_DERIVATION_PATH = "m / 44' / 60' / 0' / 0 / 0"
GENERATED_ACCOUNT_DERIVATION_PATH_1 = "m / 44' / 60' / 0' / 0 / 1"
class WalletNetworkSettings(Enum):

View File

@ -0,0 +1,21 @@
import allure
import configs
from gui.components.base_popup import BasePopup
from gui.elements.button import Button
from gui.elements.text_label import TextLabel
from gui.screens.settings_wallet import *
class RemoveAccountConfirmationSettings(BasePopup):
def __init__(self):
super(RemoveAccountConfirmationSettings, self).__init__()
self._remove_confirmation_close_button = Button('removeConfirmationCrossCloseButton')
self._remove_confirmation_title_text = TextLabel('removeConfirmationTextTitle')
self._remove_confirmation_body_text = TextLabel('removeConfirmationTextBody')
self._remove_confirmation_remove_account_button = Button('removeConfirmationRemoveButton')
@allure.step('Click Remove account button')
def click_remove_account_button(self):
self._remove_confirmation_remove_account_button.click()

View File

@ -263,6 +263,12 @@ editWalletSettings_EmojiSelector = {"container": statusDesktop_mainWindow_overla
editWalletSettings_ColorSelector = {"container": statusDesktop_mainWindow_overlay, "type": "StatusColorRadioButton", "unnamed": 1, "visible": True}
editWalletSettings_EmojiItem = {"container": statusDesktop_mainWindow_overlay, "objectName": RegularExpression("statusEmoji_*"), "type": "StatusEmoji"}
# Remove Account from settings popup
removeConfirmationCrossCloseButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "close-icon", "type": "StatusIcon", "visible": True}
removeConfirmationTextTitle = {"container": statusDesktop_mainWindow_overlay, "objectName": "headerTitle", "type": "StatusBaseText", "visible": True}
removeConfirmationTextBody = {"container": statusDesktop_mainWindow_overlay, "type": "StatusBaseText", "unnamed": 1, "visible": True}
removeConfirmationRemoveButton = {"container": statusDesktop_mainWindow_overlay, "objectName": RegularExpression("confirm*"), "type": "StatusButton"}
# Testnet mode popup
turn_on_testnet_mode_StatusButton = {"container": statusDesktop_mainWindow_overlay, "id": "acceptBtn", "text": "Turn on testnet mode", "type": "StatusButton", "unnamed": 1, "visible": True}
turn_off_testnet_mode_StatusButton = {"container": statusDesktop_mainWindow_overlay, "id": "acceptBtn", "text": "Turn off testnet mode", "type": "StatusButton", "unnamed": 1, "visible": True}

View File

@ -73,7 +73,7 @@ settingsWalletAccountDelegate = {"container": settingsContentBase_ScrollView, "o
walletAccountViewEditAccountButton = {"container": statusDesktop_mainWindow, "objectName": "walletAccountViewEditAccountButton", "type": "StatusButton"}
walletAccountViewAccountName = {"container": statusDesktop_mainWindow, "objectName": "walletAccountViewAccountName", "type": "StatusBaseText"}
walletAccountViewAccountEmoji = {"container": statusDesktop_mainWindow, "objectName": "walletAccountViewAccountImage", "type": "StatusEmoji", "visible": True}
walletAccountViewDeleteAccountButton = {"container": statusDesktop_mainWindow, "objectName": "deleteAccountButton", "type": "StatusButton"}
walletAccountViewRemoveAccountButton = {"container": statusDesktop_mainWindow, "objectName": "deleteAccountButton", "type": "StatusButton"}
walletAccountViewDetailsLabel = {"container": settingsContentBase_ScrollView, "objectName": "AccountDetails_TextLabel", "type": "StatusBaseText"}
walletAccountViewBalance = {"container": settingsContentBase_ScrollView, "objectName": "Balance_ListItem", "type": "WalletAccountDetailsListItem"}
walletAccountViewAddress = {"container": settingsContentBase_ScrollView, "objectName": "Address_ListItem", "type": "WalletAccountDetailsListItem"}

View File

@ -9,6 +9,7 @@ import driver
from constants import wallet_account_list_item
from constants.wallet import WalletNetworkSettings, WalletNetworkDefaultValues
from driver import objects_access
from gui.components.wallet.popup_delete_account_from_settings import RemoveAccountConfirmationSettings
from gui.components.wallet.testnet_mode_popup import TestnetModePopup
from gui.components.wallet.wallet_account_popups import AccountPopup, EditAccountFromSettingsPopup
@ -70,7 +71,7 @@ class AccountDetailsView(WalletSettingsView):
super(AccountDetailsView, self).__init__()
self._back_button = Button('main_toolBar_back_button')
self._edit_account_button = Button('walletAccountViewEditAccountButton')
self._delete_account_button = Button('walletAccountViewDeleteAccountButton')
self._remove_account_button = Button('walletAccountViewRemoveAccountButton')
self._wallet_account_title = TextLabel('walletAccountViewAccountName')
self._wallet_account_emoji = QObject('walletAccountViewAccountEmoji')
self._wallet_account_details_label = TextLabel('walletAccountViewDetailsLabel')
@ -87,9 +88,14 @@ class AccountDetailsView(WalletSettingsView):
self._edit_account_button.click()
return EditAccountFromSettingsPopup().wait_until_appears()
@allure.step('Verify Delete button presence')
def is_delete_account_button_present(self):
return self._delete_account_button.is_visible
@allure.step('Click Remove account button')
def click_remove_account_button(self):
self._remove_account_button.click()
return RemoveAccountConfirmationSettings().wait_until_appears()
@allure.step('Check if Remove account button is visible')
def is_remove_account_button_visible(self):
return self._remove_account_button.is_visible
@allure.step('Get account name')
def get_account_name_value(self):

View File

@ -0,0 +1,71 @@
import random
import string
import time
import allure
import pytest
from allure_commons._allure import step
import constants
import driver
from constants.wallet import WalletAccountSettings, DerivationPath
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_wallet import WalletSettingsView
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704454',
'Account view interactions: Delete generated account')
@pytest.mark.case(704454)
@pytest.mark.parametrize('user_account', [constants.user.user_account_one])
@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_delete_generated_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(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('Open account details view for the generated account'):
acc_view = WalletSettingsView().open_account_in_settings(account_name)
with step('Verify details view for the generated account'):
assert acc_view.get_account_name_value() == account_name, \
f"Generated account name is incorrect, current name is {acc_view.get_account_name_value()}, expected {account_name}"
assert acc_view.get_account_address_value() is not None, \
f"Generated account address is not present"
assert acc_view.get_account_origin_value() == WalletAccountSettings.STATUS_ACCOUNT_ORIGIN.value, \
f"Status account origin label is incorrect"
assert acc_view.get_account_derivation_path_value() == DerivationPath.GENERATED_ACCOUNT_DERIVATION_PATH_1.value, \
f"Status account derivation path must be {DerivationPath.GENERATED_ACCOUNT_DERIVATION_PATH_1.value}"
assert acc_view.get_account_storage_value() == WalletAccountSettings.STORED_ON_DEVICE.value, \
f"Status account storage should be {WalletAccountSettings.STORED_ON_DEVICE.value}"
with step('Delete generated account'):
delete_confirmation_popup = acc_view.click_remove_account_button()
delete_confirmation_popup.click_remove_account_button()
# TODO: verification for account removal toast (after https://github.com/status-im/status-desktop/issues/12541)
with step('Verify the removed account is not displayed in accounts list on main wallet screen'):
wallet = main_screen.left_panel.open_wallet()
SigningPhrasePopup().wait_until_appears().confirm_phrase()
assert driver.waitFor(
lambda: account_name not in [account.name for account in wallet.left_panel.accounts], 10000), \
f'Account with {account_name} is still displayed even it should not be'

View File

@ -44,7 +44,7 @@ def test_settings_edit_status_account(main_screen: MainWindow, new_name):
current_color = status_acc_view.get_account_color_value()
account_emoji_id_after = status_acc_view.get_account_emoji_id()
assert not status_acc_view.is_delete_account_button_present(), \
assert not status_acc_view.is_remove_account_button_visible(), \
f"Delete button should not be present for Status account"
assert status_acc_view.get_account_name_value() == new_name, f"Account name has not been changed"
assert account_emoji_id_before != account_emoji_id_after, f"Account emoji has not been changed"