chore: fix saved addresses on main wallet screen

This commit is contained in:
Anastasiya Semenkevich 2024-01-17 11:43:34 +03:00 committed by Anastasiya
parent 2a5684a2f7
commit 16cd947b1a
3 changed files with 16 additions and 7 deletions

View File

@ -13,13 +13,15 @@ walletAccount_StatusListItem = {"container": walletAccounts_StatusListView, "obj
mainWallet_All_Accounts_Balance = {"container": mainWallet_All_Accounts_Button, "objectName": "walletLeftListAmountValue", "type": "StatusTextWithLoadingState", "visible": True} mainWallet_All_Accounts_Balance = {"container": mainWallet_All_Accounts_Button, "objectName": "walletLeftListAmountValue", "type": "StatusTextWithLoadingState", "visible": True}
# Saved Address View # Saved Address View
mainWindow_SavedAddressesView = {"container": mainWindow_WalletLayout, "type": "SavedAddressesView", "unnamed": 1, "visible": True} mainWindow_SavedAddressesView = {"container": statusDesktop_mainWindow, "type": "SavedAddressesView", "unnamed": 1, "visible": True}
mainWallet_Saved_Addreses_Add_Buttton = {"container": mainWindow_SavedAddressesView, "objectName": "walletHeaderButton", "type": "StatusButton"} mainWindow_SavedAddressesView_2 = {"container": mainWindow_WalletLayout, "type": "SavedAddressesView", "unnamed": 1, "visible": True}
mainWallet_Saved_Addreses_List = {"container": mainWindow_SavedAddressesView, "objectName": "SavedAddressesView_savedAddresses", "type": "StatusListView"} mainWallet_Saved_Addresses_Add_Buttton = {"container": mainWindow_SavedAddressesView, "objectName": "walletHeaderButton", "type": "StatusButton"}
savedAddressView_Delegate = {"container": mainWallet_Saved_Addreses_List, "objectName": RegularExpression("savedAddressView_Delegate*"), "type": "SavedAddressesDelegate", "visible": True} mainWallet_Saved_Addresses_List = {"container": mainWindow_SavedAddressesView, "objectName": "SavedAddressesView_savedAddresses", "type": "StatusListView"}
savedAddressView_Delegate = {"container": mainWallet_Saved_Addresses_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}
savedAddressView_Delegate_menuButton = {"container": mainWindow_SavedAddressesView, "objectName": RegularExpression("savedAddressView_Delegate_menuButton*"), "type": "StatusRoundButton", "visible": True} savedAddressView_Delegate_menuButton = {"container": mainWindow_SavedAddressesView, "objectName": RegularExpression("savedAddressView_Delegate_menuButton*"), "type": "StatusRoundButton", "visible": True}
savedAddressesArea_SavedAddresses = {"container": mainWindow_SavedAddressesView, "objectName": "savedAddressesArea", "type": "SavedAddresses", "visible": True} savedAddressesArea_SavedAddresses = {"container": mainWindow_SavedAddressesView, "objectName": "savedAddressesArea", "type": "SavedAddresses", "visible": True}
savedAddresses_area = {"container": mainWindow_SavedAddressesView_2, "objectName": "savedAddressesArea", "type": "SavedAddresses", "visible": True}
# Wallet Account View # Wallet Account View
mainWindow_StatusSectionLayout_ContentItem = {"container": statusDesktop_mainWindow, "objectName": "StatusSectionLayout", "type": "ContentItem", "visible": True} mainWindow_StatusSectionLayout_ContentItem = {"container": statusDesktop_mainWindow, "objectName": "StatusSectionLayout", "type": "ContentItem", "visible": True}

View File

@ -139,21 +139,28 @@ class SavedAddressesView(QObject):
def __init__(self): def __init__(self):
super(SavedAddressesView, self).__init__('mainWindow_SavedAddressesView') super(SavedAddressesView, self).__init__('mainWindow_SavedAddressesView')
self._add_new_address_button = Button('mainWallet_Saved_Addreses_Add_Buttton') self._add_new_address_button = Button('mainWallet_Saved_Addresses_Add_Buttton')
self._address_list_item = QObject('savedAddressView_Delegate') self._address_list_item = QObject('savedAddressView_Delegate')
self._addresses_area = QObject('savedAddresses_area') self._addresses_area = QObject('savedAddresses_area')
self._addresses_list_view = QObject('mainWallet_Saved_Addresses_List')
self._send_button = Button('send_StatusRoundButton') self._send_button = Button('send_StatusRoundButton')
self._open_menu_button = Button('savedAddressView_Delegate_menuButton') self._open_menu_button = Button('savedAddressView_Delegate_menuButton')
self._saved_address_item = QObject('savedAddressView_Delegate')
@property @property
@allure.step('Get saved addresses names') @allure.step('Get saved addresses names')
def address_names(self): def address_names(self):
address_names = [] address_names = []
for child in walk_children(self._addresses_area.object): for child in walk_children(self._addresses_list_view.object):
if getattr(child, 'id', '') == 'savedAddressDelegate': if getattr(child, 'id', '') == 'savedAddressDelegate':
address_names.append(str(child.name)) address_names.append(str(child.name))
return address_names return address_names
@allure.step('Get saved addresses list')
def get_saved_addresses_list(self):
addresses = [str(address.name) for address in driver.findAllObjects(self._saved_address_item.real_name)]
return addresses
@allure.step('Open add new address popup') @allure.step('Open add new address popup')
def open_add_saved_address_popup(self, attempt=2) -> 'AddressPopup': def open_add_saved_address_popup(self, attempt=2) -> 'AddressPopup':
self._add_new_address_button.click() self._add_new_address_button.click()

View File

@ -69,5 +69,5 @@ def test_manage_saved_address(main_screen: MainWindow, name: str, address: str,
with step('Verify that saved address with new name is not in the list of saved addresses'): with step('Verify that saved address with new name is not in the list of saved addresses'):
assert not driver.waitFor( assert not driver.waitFor(
lambda: new_name in wallet.left_panel.open_saved_addresses().address_names, lambda: new_name in wallet.left_panel.open_saved_addresses().get_saved_addresses_list(),
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), f'Address: {new_name} is still present' configs.timeouts.UI_LOAD_TIMEOUT_MSEC), f'Address: {new_name} is still present'