chore: fix saved addresses test according to new designs

This commit is contained in:
Anastasiya Semenkevich 2024-01-09 17:43:56 +03:00 committed by Anastasiya
parent 234974ac44
commit 4db703f2b3
6 changed files with 51 additions and 16 deletions

View File

@ -12,12 +12,22 @@ class ContextMenu(QObject):
self._context_delete_account_option = QObject('contextMenuItem_Delete') self._context_delete_account_option = QObject('contextMenuItem_Delete')
self._context_edit_account_option = QObject('contextMenuItem_Edit') self._context_edit_account_option = QObject('contextMenuItem_Edit')
self._context_hide_include_in_total_balance = QObject('contextMenuItem_HideInclude') 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') @allure.step('Select in context menu')
def select(self, value: str): def select(self, value: str):
self._menu_item.real_name['text'] = value self._menu_item.real_name['text'] = value
self._menu_item.click() 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') @allure.step('Select add watched address option from context menu')
def select_add_watched_address_from_context_menu(self): def select_add_watched_address_from_context_menu(self):
self._context_add_watched_address_option.click() self._context_add_watched_address_option.click()

View File

@ -2,15 +2,23 @@ import allure
from gui.elements.button import Button from gui.elements.button import Button
from gui.elements.object import QObject from gui.elements.object import QObject
from gui.elements.text_label import TextLabel
class ConfirmationPopup(QObject): class ConfirmationPopup(QObject):
def __init__(self): def __init__(self):
super(ConfirmationPopup, self).__init__('contextMenu_PopupItem') 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): def confirm(self):
self._confirm_button.click() self._confirm_button.click()
self.wait_until_hidden() self.wait_until_hidden()
@allure.step('Get confirmation text')
def get_confirmation_text(self):
return self._confirmation_notification.text

View File

@ -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_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_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_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_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_Optimism", "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_Arbitrum", "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 # 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}
@ -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_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_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"} 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 # Confirmation Popup
confirmButton = {"container": statusDesktop_mainWindow_overlay, "objectName": RegularExpression("confirm*"), "type": "StatusButton"} 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 # Picture Edit Popup
o_StatusSlider = {"container": statusDesktop_mainWindow_overlay, "type": "StatusSlider", "unnamed": 1, "visible": True} o_StatusSlider = {"container": statusDesktop_mainWindow_overlay, "type": "StatusSlider", "unnamed": 1, "visible": True}

View File

@ -14,7 +14,7 @@ mainWallet_All_Accounts_Balance = {"container": mainWallet_All_Accounts_Button,
# Saved Address View # Saved Address View
mainWindow_SavedAddressesView = {"container": mainWindow_WalletLayout, "type": "SavedAddressesView", "unnamed": 1, "visible": True} 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"} 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} savedAddressView_Delegate = {"container": mainWallet_Saved_Addreses_List, "objectName": RegularExpression("savedAddressView_Delegate*"), "type": "SavedAddressesDelegate", "visible": True}
send_StatusRoundButton = {"container": "", "type": "StatusRoundButton", "unnamed": 1, "visible": True} send_StatusRoundButton = {"container": "", "type": "StatusRoundButton", "unnamed": 1, "visible": True}

View File

@ -163,13 +163,14 @@ class SavedAddressesView(QObject):
@allure.step('Open edit address popup for saved address') @allure.step('Open edit address popup for saved address')
def open_edit_address_popup(self, name: str) -> 'EditSavedAddressPopup': def open_edit_address_popup(self, name: str) -> 'EditSavedAddressPopup':
self.open_context_menu(name).select('Edit') self.open_context_menu(name).select_edit_saved_address()
return EditSavedAddressPopup().wait_until_appears() return EditSavedAddressPopup()
@allure.step('Delete saved address from the list') @allure.step('Delete saved address from the list')
def delete_saved_address(self, address_name): def delete_saved_address(self, address_name):
self.open_context_menu(address_name).select('Delete') self.open_context_menu(address_name).select_delete_saved_address()
ConfirmationPopup().wait_until_appears().confirm() assert ConfirmationPopup().get_confirmation_text().startswith('Are you sure you want to remove')
ConfirmationPopup().confirm()
@allure.step('Open context menu in saved address') @allure.step('Open context menu in saved address')
def open_context_menu(self, name) -> ContextMenu: def open_context_menu(self, name) -> ContextMenu:

View File

@ -1,3 +1,6 @@
import random
import string
import allure import allure
import pytest import pytest
from allure import step from allure import step
@ -11,17 +14,25 @@ from gui.components.signing_phrase_popup import SigningPhrasePopup
from gui.main_window import MainWindow from gui.main_window import MainWindow
pytestmark = marks pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703021', 'Manage a saved address') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703021', 'Manage a saved address')
@pytest.mark.case(703021) @pytest.mark.case(703021)
@pytest.mark.parametrize('name, address, new_name', [ @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.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)))
]) ])
@pytest.mark.xfail(reason="https://github.com/status-im/status-desktop/issues/12914")
def test_manage_saved_address(main_screen: MainWindow, name: str, address: str, new_name: str): def test_manage_saved_address(main_screen: MainWindow, name: str, address: str, new_name: str):
with step('Add new address'): with step('Add new address'):
wallet = main_screen.left_panel.open_wallet() 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) wallet.left_panel.open_saved_addresses().open_add_address_popup().add_saved_address(name, address)
with step('Verify toast message when adding saved address'): with step('Verify toast message when adding saved address'):