chore: change tests for adding saved address according to new flows

This commit is contained in:
Anastasiya Semenkevich 2024-10-11 16:35:19 +03:00 committed by Khushboo-dev-cpp
parent 3f55e6c9c5
commit bebeaf2de3
4 changed files with 5 additions and 89 deletions

View File

@ -1,13 +1,7 @@
import time
import allure import allure
import configs
import driver
from gui.components.base_popup import BasePopup from gui.components.base_popup import BasePopup
from gui.elements.button import Button 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_edit import TextEdit
from gui.elements.text_label import TextLabel from gui.elements.text_label import TextLabel
from gui.objects_map import names from gui.objects_map import names
@ -18,59 +12,11 @@ class AddSavedAddressPopup(BasePopup):
super().__init__() super().__init__()
self._name_text_edit = TextEdit(names.mainWallet_Saved_Addreses_Popup_Name_Input) 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._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): class AddressPopup(AddSavedAddressPopup):
def __init__(self): def __init__(self):
super(AddressPopup, self).__init__() super().__init__()
self._address_text_edit = TextEdit(names.mainWallet_Saved_Addreses_Popup_Address_Input_Edit) self._address_text_edit = TextEdit(names.mainWallet_Saved_Addreses_Popup_Address_Input_Edit)
@allure.step('Add saved address') @allure.step('Add saved address')
@ -78,17 +24,6 @@ class AddressPopup(AddSavedAddressPopup):
self._name_text_edit.text = name self._name_text_edit.text = name
self._address_text_edit.clear(verify=False) self._address_text_edit.clear(verify=False)
self._address_text_edit.type_text(address) 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._save_add_address_button.click()
self.wait_until_hidden() self.wait_until_hidden()
@ -96,17 +31,11 @@ class AddressPopup(AddSavedAddressPopup):
class EditSavedAddressPopup(AddSavedAddressPopup): class EditSavedAddressPopup(AddSavedAddressPopup):
def __init__(self): def __init__(self):
super(EditSavedAddressPopup, self).__init__() super().__init__()
self._address_text_label = TextLabel(names.mainWallet_Saved_Addreses_Popup_Address_Input_Edit) self._address_text_label = TextLabel(names.mainWallet_Saved_Addreses_Popup_Address_Input_Edit)
@allure.step('Edit saved address') @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 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._save_add_address_button.click()
self.wait_until_hidden() self.wait_until_hidden()

View File

@ -9,8 +9,6 @@ from .object import QObject
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
# TODO: fix scroll https://github.com/status-im/status-desktop/issues/16325
class Scroll(QObject): class Scroll(QObject):
@allure.step('Scroll vertical down to object {1}') @allure.step('Scroll vertical down to object {1}')

View File

@ -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 = {"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_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_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 # Context Menu
contextMenu_PopupItem = {"container": statusDesktop_mainWindow_overlay, "type": "PopupItem", "unnamed": 1, "visible": True} contextMenu_PopupItem = {"container": statusDesktop_mainWindow_overlay, "type": "PopupItem", "unnamed": 1, "visible": True}

View File

@ -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}" 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'): 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'): with step('Verify that saved address with new name is in the list of saved addresses'):
assert driver.waitFor( assert driver.waitFor(