From 4db703f2b3e50f01fb04973fac84b95cbdc2eff7 Mon Sep 17 00:00:00 2001 From: Anastasiya Semenkevich Date: Tue, 9 Jan 2024 17:43:56 +0300 Subject: [PATCH] chore: fix saved addresses test according to new designs --- test/e2e/gui/components/context_menu.py | 10 ++++++++ .../components/wallet/confirmation_popup.py | 12 ++++++++-- test/e2e/gui/objects_map/component_names.py | 11 ++++++--- test/e2e/gui/objects_map/wallet_names.py | 2 +- test/e2e/gui/screens/wallet.py | 9 ++++---- .../test_saved_addresses.py | 23 ++++++++++++++----- 6 files changed, 51 insertions(+), 16 deletions(-) diff --git a/test/e2e/gui/components/context_menu.py b/test/e2e/gui/components/context_menu.py index 0d2e3ffb06..d59686c073 100644 --- a/test/e2e/gui/components/context_menu.py +++ b/test/e2e/gui/components/context_menu.py @@ -12,12 +12,22 @@ class ContextMenu(QObject): self._context_delete_account_option = QObject('contextMenuItem_Delete') self._context_edit_account_option = QObject('contextMenuItem_Edit') self._context_hide_include_in_total_balance = QObject('contextMenuItem_HideInclude') + self._context_edit_saved_address_option = QObject('contextSavedAddressEdit') + self._context_delete_saved_address_option = QObject('contextSavedAddressDelete') @allure.step('Select in context menu') def select(self, value: str): self._menu_item.real_name['text'] = value self._menu_item.click() + @allure.step('Click Edit saved address option') + def select_edit_saved_address(self): + self._context_edit_saved_address_option.click() + + @allure.step('Click Delete saved address option') + def select_delete_saved_address(self): + self._context_delete_saved_address_option.click() + @allure.step('Select add watched address option from context menu') def select_add_watched_address_from_context_menu(self): self._context_add_watched_address_option.click() diff --git a/test/e2e/gui/components/wallet/confirmation_popup.py b/test/e2e/gui/components/wallet/confirmation_popup.py index 08ba5074ba..9d0c9341a6 100644 --- a/test/e2e/gui/components/wallet/confirmation_popup.py +++ b/test/e2e/gui/components/wallet/confirmation_popup.py @@ -2,15 +2,23 @@ import allure from gui.elements.button import Button from gui.elements.object import QObject +from gui.elements.text_label import TextLabel class ConfirmationPopup(QObject): def __init__(self): super(ConfirmationPopup, self).__init__('contextMenu_PopupItem') - self._confirm_button = Button('confirmButton') + self._confirm_button = Button('mainWallet_Saved_Addresses_More_Confirm_Delete') + self._cancel_button = Button('mainWallet_Saved_Addresses_More_Confirm_Cancel') + self._confirmation_notification = TextLabel('mainWallet_Saved_Addresses_More_Confirm_Notification') - @allure.step('Confirm action') + @allure.step('Confirm delete action') def confirm(self): self._confirm_button.click() self.wait_until_hidden() + + @allure.step('Get confirmation text') + def get_confirmation_text(self): + return self._confirmation_notification.text + diff --git a/test/e2e/gui/objects_map/component_names.py b/test/e2e/gui/objects_map/component_names.py index 8b50c6df03..69de187943 100644 --- a/test/e2e/gui/objects_map/component_names.py +++ b/test/e2e/gui/objects_map/component_names.py @@ -170,9 +170,9 @@ mainWallet_Saved_Addreses_Popup_Add_Network_Selector_Tag = {"container": statusD mainWallet_Saved_Addresses_Popup_Add_Network_Selector_Mainnet_checkbox = {"container": statusDesktop_mainWindow_overlay, "objectName": "networkSelectionCheckbox_Mainnet", "type": "StatusCheckBox", "visible": True} mainWallet_Saved_Addresses_Popup_Add_Network_Selector_Optimism_checkbox = {"container": statusDesktop_mainWindow_overlay, "objectName": "networkSelectionCheckbox_Optimism", "type": "StatusCheckBox", "visible": True} mainWallet_Saved_Addresses_Popup_Add_Network_Selector_Arbitrum_checkbox = {"container": statusDesktop_mainWindow_overlay, "objectName": "networkSelectionCheckbox_Arbitrum", "type": "StatusCheckBox", "visible": True} -mainWallet_Saved_Addresses_Popup_Network_Selector_Mainnet_network_tag = {"container": statusDesktop_mainWindow_overlay, "objectName": "networkTagRectangle_Mainnet", "type": "Rectangle", "visible": True} -mainWallet_Saved_Addresses_Popup_Network_Selector_Optimism_network_tag = {"container": statusDesktop_mainWindow_overlay, "objectName": "networkTagRectangle_Optimism", "type": "Rectangle", "visible": True} -mainWallet_Saved_Addresses_Popup_Network_Selector_Arbitrum_network_tag = {"container": statusDesktop_mainWindow_overlay, "objectName": "networkTagRectangle_Arbitrum", "type": "Rectangle", "visible": True} +mainWallet_Saved_Addresses_Popup_Network_Selector_Mainnet_network_tag = {"container": statusDesktop_mainWindow_overlay, "objectName": "networkTagRectangle_eth", "type": "Rectangle", "visible": True} +mainWallet_Saved_Addresses_Popup_Network_Selector_Optimism_network_tag = {"container": statusDesktop_mainWindow_overlay, "objectName": "networkTagRectangle_opt", "type": "Rectangle", "visible": True} +mainWallet_Saved_Addresses_Popup_Network_Selector_Arbitrum_network_tag = {"container": statusDesktop_mainWindow_overlay, "objectName": "networkTagRectangle_arb", "type": "Rectangle", "visible": True} # Context Menu contextMenu_PopupItem = {"container": statusDesktop_mainWindow_overlay, "type": "PopupItem", "unnamed": 1, "visible": True} @@ -181,9 +181,14 @@ contextMenuItem_AddWatchOnly = {"container": statusDesktop_mainWindow_overlay, " contextMenuItem_Delete = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": RegularExpression("AccountMenu-DeleteAction*"), "type": "StatusMenuItem"} contextMenuItem_Edit = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": RegularExpression("AccountMenu-EditAction*"), "type": "StatusMenuItem"} contextMenuItem_HideInclude = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": RegularExpression("AccountMenu-HideFromTotalBalance*"), "type": "StatusMenuItem"} +contextSavedAddressEdit = {"container": statusDesktop_mainWindow, "objectName": "editSavedAddress", "type": "StatusMenuItem"} +contextSavedAddressDelete = {"container": statusDesktop_mainWindow, "objectName": "deleteSavedAddress", "type": "StatusMenuItem"} # Confirmation Popup confirmButton = {"container": statusDesktop_mainWindow_overlay, "objectName": RegularExpression("confirm*"), "type": "StatusButton"} +mainWallet_Saved_Addresses_More_Confirm_Delete = {"container": statusDesktop_mainWindow, "objectName": "RemoveSavedAddressPopup-ConfirmButton", "type": "StatusButton"} +mainWallet_Saved_Addresses_More_Confirm_Cancel = {"container": statusDesktop_mainWindow, "objectName": "RemoveSavedAddressPopup-CancelButton", "type": "StatusFlatButton"} +mainWallet_Saved_Addresses_More_Confirm_Notification = {"container": statusDesktop_mainWindow, "objectName": "RemoveSavedAddressPopup-Notification", "type": "StatusBaseText"} # Picture Edit Popup o_StatusSlider = {"container": statusDesktop_mainWindow_overlay, "type": "StatusSlider", "unnamed": 1, "visible": True} diff --git a/test/e2e/gui/objects_map/wallet_names.py b/test/e2e/gui/objects_map/wallet_names.py index d4840286fb..005a64c240 100644 --- a/test/e2e/gui/objects_map/wallet_names.py +++ b/test/e2e/gui/objects_map/wallet_names.py @@ -14,7 +14,7 @@ mainWallet_All_Accounts_Balance = {"container": mainWallet_All_Accounts_Button, # Saved Address View mainWindow_SavedAddressesView = {"container": mainWindow_WalletLayout, "type": "SavedAddressesView", "unnamed": 1, "visible": True} -mainWallet_Saved_Addreses_Add_Buttton = {"container": mainWindow_SavedAddressesView, "objectName": "addNewAddressBtn", "type": "StatusButton"} +mainWallet_Saved_Addreses_Add_Buttton = {"container": mainWindow_SavedAddressesView, "objectName": "walletHeaderButton", "type": "StatusButton"} mainWallet_Saved_Addreses_List = {"container": mainWindow_SavedAddressesView, "objectName": "SavedAddressesView_savedAddresses", "type": "StatusListView"} savedAddressView_Delegate = {"container": mainWallet_Saved_Addreses_List, "objectName": RegularExpression("savedAddressView_Delegate*"), "type": "SavedAddressesDelegate", "visible": True} send_StatusRoundButton = {"container": "", "type": "StatusRoundButton", "unnamed": 1, "visible": True} diff --git a/test/e2e/gui/screens/wallet.py b/test/e2e/gui/screens/wallet.py index 11e59e1e7a..20124b180c 100644 --- a/test/e2e/gui/screens/wallet.py +++ b/test/e2e/gui/screens/wallet.py @@ -163,13 +163,14 @@ class SavedAddressesView(QObject): @allure.step('Open edit address popup for saved address') def open_edit_address_popup(self, name: str) -> 'EditSavedAddressPopup': - self.open_context_menu(name).select('Edit') - return EditSavedAddressPopup().wait_until_appears() + self.open_context_menu(name).select_edit_saved_address() + return EditSavedAddressPopup() @allure.step('Delete saved address from the list') def delete_saved_address(self, address_name): - self.open_context_menu(address_name).select('Delete') - ConfirmationPopup().wait_until_appears().confirm() + self.open_context_menu(address_name).select_delete_saved_address() + assert ConfirmationPopup().get_confirmation_text().startswith('Are you sure you want to remove') + ConfirmationPopup().confirm() @allure.step('Open context menu in saved address') def open_context_menu(self, name) -> ContextMenu: diff --git a/test/e2e/tests/wallet_main_screen/test_saved_addresses.py b/test/e2e/tests/wallet_main_screen/test_saved_addresses.py index a9653ae9de..e8b021ecec 100644 --- a/test/e2e/tests/wallet_main_screen/test_saved_addresses.py +++ b/test/e2e/tests/wallet_main_screen/test_saved_addresses.py @@ -1,3 +1,6 @@ +import random +import string + import allure import pytest from allure import step @@ -11,17 +14,25 @@ from gui.components.signing_phrase_popup import SigningPhrasePopup from gui.main_window import MainWindow pytestmark = marks + + @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703021', 'Manage a saved address') @pytest.mark.case(703021) -@pytest.mark.parametrize('name, address, new_name', [ - pytest.param('Saved address name before', '0x8397bc3c5a60a1883174f722403d63a8833312b7', 'Saved address name after'), - pytest.param('Ens name before', 'nastya.stateofus.eth', 'Ens name after') -]) -@pytest.mark.xfail(reason="https://github.com/status-im/status-desktop/issues/12914") +@pytest.mark.parametrize('name, address, new_name', + [ + pytest.param( + ''.join(random.choices(string.ascii_letters, k=24)), + '0x8397bc3c5a60a1883174f722403d63a8833312b7', + ''.join(random.choices(string.ascii_letters, k=24))), + pytest.param( + ''.join(random.choices(string.ascii_letters, k=24)), + 'nastya.stateofus.eth', + ''.join(random.choices(string.ascii_letters, k=24))) + ]) def test_manage_saved_address(main_screen: MainWindow, name: str, address: str, new_name: str): with step('Add new address'): wallet = main_screen.left_panel.open_wallet() - SigningPhrasePopup().wait_until_appears().confirm_phrase() + SigningPhrasePopup().confirm_phrase() wallet.left_panel.open_saved_addresses().open_add_address_popup().add_saved_address(name, address) with step('Verify toast message when adding saved address'):