From bebeaf2de353984b331c0c1151feb05d490d69b8 Mon Sep 17 00:00:00 2001 From: Anastasiya Semenkevich Date: Fri, 11 Oct 2024 16:35:19 +0300 Subject: [PATCH] chore: change tests for adding saved address according to new flows --- .../wallet/add_saved_address_popup.py | 77 +------------------ test/e2e/gui/elements/scroll.py | 4 +- test/e2e/gui/objects_map/names.py | 11 --- .../test_saved_addresses.py | 2 +- 4 files changed, 5 insertions(+), 89 deletions(-) diff --git a/test/e2e/gui/components/wallet/add_saved_address_popup.py b/test/e2e/gui/components/wallet/add_saved_address_popup.py index 0a4cabb3a1..6012b210fa 100644 --- a/test/e2e/gui/components/wallet/add_saved_address_popup.py +++ b/test/e2e/gui/components/wallet/add_saved_address_popup.py @@ -1,13 +1,7 @@ -import time - import allure -import configs -import driver from gui.components.base_popup import BasePopup from gui.elements.button import Button -from gui.elements.check_box import CheckBox -from gui.elements.object import QObject from gui.elements.text_edit import TextEdit from gui.elements.text_label import TextLabel from gui.objects_map import names @@ -18,59 +12,11 @@ class AddSavedAddressPopup(BasePopup): super().__init__() self._name_text_edit = TextEdit(names.mainWallet_Saved_Addreses_Popup_Name_Input) self._save_add_address_button = Button(names.mainWallet_Saved_Addreses_Popup_Address_Add_Button) - self._add_networks_selector = QObject(names.mainWallet_Saved_Addreses_Popup_Add_Network_Selector_Tag) - self._add_networks_button = Button(names.mainWallet_Saved_Addreses_Popup_Add_Network_Button) - self._ethereum_mainnet_checkbox = CheckBox( - names.networkSelectionCheckbox_Ethereum_Mainnet_StatusCheckBox) - self._optimism_mainnet_checkbox = CheckBox( - names.networkSelectionCheckbox_Optimism_StatusCheckBox) - self._arbitrum_mainnet_checkbox = CheckBox( - names.networkSelectionCheckbox_Arbitrum_StatusCheckBox) - self._ethereum_mainnet_network_tag = QObject( - names.mainWallet_Saved_Addresses_Popup_Network_Selector_Mainnet_network_tag) - self._optimism_mainnet_network_tag = QObject( - names.mainWallet_Saved_Addresses_Popup_Network_Selector_Optimism_network_tag) - self._arbitrum_mainnet_network_tag = QObject( - names.mainWallet_Saved_Addresses_Popup_Network_Selector_Arbitrum_network_tag) - - @allure.step('Set ethereum mainnet network checkbox') - def set_ethereum_mainnet_network(self, value: bool): - assert driver.waitFor(lambda: self._ethereum_mainnet_checkbox.exists, configs.timeouts.UI_LOAD_TIMEOUT_MSEC) - self._ethereum_mainnet_checkbox.set(value) - return self - - @allure.step('Set optimism mainnet network checkbox') - def set_optimism_mainnet_network(self, value: bool): - assert self._optimism_mainnet_checkbox.exists - self._optimism_mainnet_checkbox.set(value) - return self - - @allure.step('Set arbitrum mainnet network checkbox') - def set_arbitrum_mainnet_network(self, value: bool): - assert self._arbitrum_mainnet_checkbox.exists - self._arbitrum_mainnet_checkbox.set(value) - return self - - @allure.step('Verify that network selector enabled') - def verify_network_selector_enabled(self): - assert self._add_networks_selector.is_visible, f'Network selector is not enabled' - - @allure.step('Verify that etherium mainnet network present') - def verify_ethereum_mainnet_network_tag_present(self): - assert self._ethereum_mainnet_network_tag.is_visible, f'Ethereum Mainnet network tag is not present' - - @allure.step('Verify that etherium mainnet network present') - def verify_otimism_mainnet_network_tag_present(self): - assert self._optimism_mainnet_network_tag.is_visible, f'Optimism Mainnet network tag is not present' - - @allure.step('Verify that arbitrum mainnet network present') - def verify_arbitrum_mainnet_network_tag_present(self): - assert self._arbitrum_mainnet_network_tag.is_visible, f'Arbitrum Mainnet network tag is not present' class AddressPopup(AddSavedAddressPopup): def __init__(self): - super(AddressPopup, self).__init__() + super().__init__() self._address_text_edit = TextEdit(names.mainWallet_Saved_Addreses_Popup_Address_Input_Edit) @allure.step('Add saved address') @@ -78,17 +24,6 @@ class AddressPopup(AddSavedAddressPopup): self._name_text_edit.text = name self._address_text_edit.clear(verify=False) self._address_text_edit.type_text(address) - if address.startswith("0x"): - self.verify_network_selector_enabled() - self._add_networks_selector.click() - time.sleep(0.1) - self.set_ethereum_mainnet_network(True) - self.set_optimism_mainnet_network(True) - self.set_arbitrum_mainnet_network(True) - self._name_text_edit.click() # click the text field to close the network selector pop up - self.verify_ethereum_mainnet_network_tag_present() - self.verify_otimism_mainnet_network_tag_present() - self.verify_arbitrum_mainnet_network_tag_present(), self._save_add_address_button.click() self.wait_until_hidden() @@ -96,17 +31,11 @@ class AddressPopup(AddSavedAddressPopup): class EditSavedAddressPopup(AddSavedAddressPopup): def __init__(self): - super(EditSavedAddressPopup, self).__init__() + super().__init__() self._address_text_label = TextLabel(names.mainWallet_Saved_Addreses_Popup_Address_Input_Edit) @allure.step('Edit saved address') - def edit_saved_address(self, new_name: str, address: str): + def edit_saved_address(self, new_name: str): self._name_text_edit.text = new_name - if address.startswith("0x"): - self._add_networks_button.click() - self.set_ethereum_mainnet_network(False) - self.set_optimism_mainnet_network(False) - self.set_arbitrum_mainnet_network(False) - self._save_add_address_button.click() self._save_add_address_button.click() self.wait_until_hidden() diff --git a/test/e2e/gui/elements/scroll.py b/test/e2e/gui/elements/scroll.py index e585e7d605..eea50c1a64 100644 --- a/test/e2e/gui/elements/scroll.py +++ b/test/e2e/gui/elements/scroll.py @@ -9,8 +9,6 @@ from .object import QObject LOG = logging.getLogger(__name__) -# TODO: fix scroll https://github.com/status-im/status-desktop/issues/16325 - class Scroll(QObject): @allure.step('Scroll vertical down to object {1}') @@ -27,4 +25,4 @@ class Scroll(QObject): while not element.is_visible: driver.mouse.scroll(self.object, self.object.width / 2, self.object.height / 2, 0, 30, 1, 0.1) if time.monotonic() - started_at > timeout_sec: - raise LookupError(f'Object not found: {element}') \ No newline at end of file + raise LookupError(f'Object not found: {element}') diff --git a/test/e2e/gui/objects_map/names.py b/test/e2e/gui/objects_map/names.py index ac5e0598f7..097f1d1a78 100644 --- a/test/e2e/gui/objects_map/names.py +++ b/test/e2e/gui/objects_map/names.py @@ -278,17 +278,6 @@ mainWallet_Saved_Addreses_Popup_Name_Input = {"container": statusDesktop_mainWin mainWallet_Saved_Addreses_Popup_Address_Input = {"container": statusDesktop_mainWindow, "objectName": "savedAddressAddressInput", "type": "StatusInput"} mainWallet_Saved_Addreses_Popup_Address_Input_Edit = {"container": statusDesktop_mainWindow, "objectName": "savedAddressAddressInputEdit", "type": "TextEdit"} mainWallet_Saved_Addreses_Popup_Address_Add_Button = {"container": statusDesktop_mainWindow, "objectName": "addSavedAddress", "type": "StatusButton"} -mainWallet_Saved_Addreses_Popup_Add_Network_Selector = {"container": statusDesktop_mainWindow, "objectName": "addSavedAddressNetworkSelector", "type": "StatusNetworkSelector", "visible": True} -mainWallet_Saved_Addreses_Popup_Add_Network_Button = {"container": statusDesktop_mainWindow_overlay, "objectName": "addNetworkTagItemButton", "type": "StatusRoundButton", "visible": True} -addNetworkTagItemButton_StatusRoundButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "addNetworkTagItemButton", "type": "StatusRoundButton", "visible": True} -networkTagRectangle_Add_networks_Rectangle = {"container": statusDesktop_mainWindow_overlay, "objectName": "networkTagRectangle_Add networks", "type": "Rectangle", "visible": True} -mainWallet_Saved_Addreses_Popup_Add_Network_Selector_Tag = {"container": statusDesktop_mainWindow_overlay, "objectName": "networkSelectorTag", "type": "StatusNetworkListItemTag"} -networkSelectionCheckbox_Ethereum_Mainnet_StatusCheckBox = {"checkable": True, "container": statusDesktop_mainWindow_overlay, "objectName": "networkSelectionCheckbox_Mainnet", "type": "StatusCheckBox", "visible": True} -networkSelectionCheckbox_Optimism_StatusCheckBox = {"checkable": True, "container": statusDesktop_mainWindow_overlay, "objectName": "networkSelectionCheckbox_Optimism", "type": "StatusCheckBox", "visible": True} -networkSelectionCheckbox_Arbitrum_StatusCheckBox = {"checkable": True, "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_eth", "type": "Rectangle", "visible": True} -mainWallet_Saved_Addresses_Popup_Network_Selector_Optimism_network_tag = {"container": statusDesktop_mainWindow_overlay, "objectName": "networkTagRectangle_oeth", "type": "Rectangle", "visible": True} -mainWallet_Saved_Addresses_Popup_Network_Selector_Arbitrum_network_tag = {"container": statusDesktop_mainWindow_overlay, "objectName": "networkTagRectangle_arb1", "type": "Rectangle", "visible": True} # Context Menu contextMenu_PopupItem = {"container": statusDesktop_mainWindow_overlay, "type": "PopupItem", "unnamed": 1, "visible": True} diff --git a/test/e2e/tests/wallet_main_screen/wallet - saved addresses/test_saved_addresses.py b/test/e2e/tests/wallet_main_screen/wallet - saved addresses/test_saved_addresses.py index a5e92671da..7ebc009a18 100644 --- a/test/e2e/tests/wallet_main_screen/wallet - saved addresses/test_saved_addresses.py +++ b/test/e2e/tests/wallet_main_screen/wallet - saved addresses/test_saved_addresses.py @@ -43,7 +43,7 @@ def test_manage_saved_address(main_screen: MainWindow, name: str, address: str, f"Toast message about adding saved address is not correct or not present. Current list of messages: {messages}" with step('Edit saved address to new name'): - SavedAddressesView().open_edit_address_popup(name).edit_saved_address(new_name, address) + SavedAddressesView().open_edit_address_popup(name).edit_saved_address(new_name) with step('Verify that saved address with new name is in the list of saved addresses'): assert driver.waitFor(