From 9661e9d247f830a62cad875a5a936bd8b71701a7 Mon Sep 17 00:00:00 2001 From: Anastasiya <82375995+anastasiyaig@users.noreply.github.com> Date: Mon, 30 Oct 2023 09:58:45 +0300 Subject: [PATCH] test: test_delete_generated_account_from_wallet_settings implemented (#226) Update test_wallet_settings_acct_interactions_delete_account.py --- test/e2e/constants/wallet.py | 1 + .../popup_delete_account_from_settings.py | 21 ++++++ test/e2e/gui/objects_map/component_names.py | 6 ++ test/e2e/gui/objects_map/settings_names.py | 2 +- test/e2e/gui/screens/settings_wallet.py | 14 ++-- ...ttings_acct_interactions_delete_account.py | 71 +++++++++++++++++++ ...s_acct_interactions_edit_status_account.py | 2 +- .../__init__.py | 0 .../test_wallet_main_manage_accounts.py | 0 .../test_wallet_main_saved_addresses.py | 0 10 files changed, 111 insertions(+), 6 deletions(-) create mode 100644 test/e2e/gui/components/wallet/popup_delete_account_from_settings.py create mode 100644 test/e2e/tests/settings/settings_wallet/test_wallet_settings_acct_interactions_delete_account.py rename test/e2e/tests/{wallet => wallet_main_screen}/__init__.py (100%) rename test/e2e/tests/{wallet => wallet_main_screen}/test_wallet_main_manage_accounts.py (100%) rename test/e2e/tests/{wallet => wallet_main_screen}/test_wallet_main_saved_addresses.py (100%) diff --git a/test/e2e/constants/wallet.py b/test/e2e/constants/wallet.py index 6a0c7a74b8..8f7de1f74c 100644 --- a/test/e2e/constants/wallet.py +++ b/test/e2e/constants/wallet.py @@ -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): diff --git a/test/e2e/gui/components/wallet/popup_delete_account_from_settings.py b/test/e2e/gui/components/wallet/popup_delete_account_from_settings.py new file mode 100644 index 0000000000..0d7c96cbd4 --- /dev/null +++ b/test/e2e/gui/components/wallet/popup_delete_account_from_settings.py @@ -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() diff --git a/test/e2e/gui/objects_map/component_names.py b/test/e2e/gui/objects_map/component_names.py index 5657d0b2ee..ef06d7ccd4 100644 --- a/test/e2e/gui/objects_map/component_names.py +++ b/test/e2e/gui/objects_map/component_names.py @@ -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} diff --git a/test/e2e/gui/objects_map/settings_names.py b/test/e2e/gui/objects_map/settings_names.py index acd232e15f..431f9dc055 100644 --- a/test/e2e/gui/objects_map/settings_names.py +++ b/test/e2e/gui/objects_map/settings_names.py @@ -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"} diff --git a/test/e2e/gui/screens/settings_wallet.py b/test/e2e/gui/screens/settings_wallet.py index 2013631804..4d99aa3efd 100644 --- a/test/e2e/gui/screens/settings_wallet.py +++ b/test/e2e/gui/screens/settings_wallet.py @@ -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): diff --git a/test/e2e/tests/settings/settings_wallet/test_wallet_settings_acct_interactions_delete_account.py b/test/e2e/tests/settings/settings_wallet/test_wallet_settings_acct_interactions_delete_account.py new file mode 100644 index 0000000000..491edb0024 --- /dev/null +++ b/test/e2e/tests/settings/settings_wallet/test_wallet_settings_acct_interactions_delete_account.py @@ -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' + diff --git a/test/e2e/tests/settings/settings_wallet/test_wallet_settings_acct_interactions_edit_status_account.py b/test/e2e/tests/settings/settings_wallet/test_wallet_settings_acct_interactions_edit_status_account.py index 03b04bce45..c9af1168c8 100644 --- a/test/e2e/tests/settings/settings_wallet/test_wallet_settings_acct_interactions_edit_status_account.py +++ b/test/e2e/tests/settings/settings_wallet/test_wallet_settings_acct_interactions_edit_status_account.py @@ -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" diff --git a/test/e2e/tests/wallet/__init__.py b/test/e2e/tests/wallet_main_screen/__init__.py similarity index 100% rename from test/e2e/tests/wallet/__init__.py rename to test/e2e/tests/wallet_main_screen/__init__.py diff --git a/test/e2e/tests/wallet/test_wallet_main_manage_accounts.py b/test/e2e/tests/wallet_main_screen/test_wallet_main_manage_accounts.py similarity index 100% rename from test/e2e/tests/wallet/test_wallet_main_manage_accounts.py rename to test/e2e/tests/wallet_main_screen/test_wallet_main_manage_accounts.py diff --git a/test/e2e/tests/wallet/test_wallet_main_saved_addresses.py b/test/e2e/tests/wallet_main_screen/test_wallet_main_saved_addresses.py similarity index 100% rename from test/e2e/tests/wallet/test_wallet_main_saved_addresses.py rename to test/e2e/tests/wallet_main_screen/test_wallet_main_saved_addresses.py