From 2625535597a366338ada59e704e05dad87b7db42 Mon Sep 17 00:00:00 2001 From: Valentina Novgorodtceva Date: Fri, 3 May 2024 16:36:52 +0200 Subject: [PATCH] chore: reworked a bit test of sending nft --- test/e2e/gui/components/activity_center.py | 2 +- test/e2e/gui/components/wallet/send_popup.py | 45 +++++++++++++------- test/e2e/gui/objects_map/names.py | 2 +- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/test/e2e/gui/components/activity_center.py b/test/e2e/gui/components/activity_center.py index 0790e27775..a25f39eaad 100644 --- a/test/e2e/gui/components/activity_center.py +++ b/test/e2e/gui/components/activity_center.py @@ -57,7 +57,7 @@ class ActivityCenter(BasePopup): self._activity_center_button = Scroll(names.activityCenterStatusFlatButton) self._notification_contact_request = QObject(names.o_ActivityNotificationContactRequest) self._activity_center_panel = QObject(names.activityCenterTopBar_ActivityCenterPopupTopBarPanel) - self._contact_request_list = List(names.contacts_StatusListView) + self._contact_request_list = List(names.statusListView) @property @allure.step('Get contact items') diff --git a/test/e2e/gui/components/wallet/send_popup.py b/test/e2e/gui/components/wallet/send_popup.py index 61747e0b4c..1420e416ec 100644 --- a/test/e2e/gui/components/wallet/send_popup.py +++ b/test/e2e/gui/components/wallet/send_popup.py @@ -5,7 +5,7 @@ import typing import configs.timeouts import driver -from driver.objects_access import wait_for_template +from driver.objects_access import wait_for_template, walk_children from gui.components.base_popup import BasePopup from gui.elements.button import Button from gui.elements.object import QObject @@ -18,6 +18,7 @@ class SendPopup(BasePopup): def __init__(self): super().__init__() + self._tokens_list = QObject(names.statusListView) self._tab_item_template = QObject(names.tab_Status_template) self._search_field = TextEdit(names.search_TextEdit) self._asset_list_item = QObject(names.o_TokenBalancePerChainDelegate_template) @@ -34,19 +35,31 @@ class SendPopup(BasePopup): @allure.step('Select asset or collectible by name') def _select_asset_or_collectible(self, name: str, tab: str, attempts: int = 2): - time.sleep(3) - assets = self.get_assets_or_collectibles_list(tab) - for index, item in enumerate(assets): - if str(item.title) == name: - QObject(item).click() - break - try: - return self._ens_address_text_edit.wait_until_appears(timeout_msec=configs.timeouts.UI_LOAD_TIMEOUT_MSEC) - except AssertionError as err: - if attempts: - self._select_asset_or_collectible(attempts-1) - else: - raise err + if tab == 'Assets': + self._asset_list_item.wait_until_appears(timeout_msec=10000) + assets = self.get_assets_or_collectibles_list(tab) + for index, item in enumerate(assets): + if getattr(item, 'title', '') == name: + QObject(item).click() + break + assert driver.waitFor(lambda: self._amount_text_edit.is_visible, timeout_msec=6000) + + elif tab == 'Collectibles': + self._collectible_list_item.wait_until_appears(timeout_msec=15000) + self._search_field.type_text(name) + time.sleep(3) + assets = self.get_assets_or_collectibles_list(tab) + for index, item in enumerate(assets): + if getattr(item, 'title', '') == name: + QObject(item).click() + break + try: + return self._ens_address_text_edit.wait_until_appears(timeout_msec=configs.timeouts.UI_LOAD_TIMEOUT_MSEC) + except AssertionError as err: + if attempts: + self._select_asset_or_collectible(attempts-1) + else: + raise err @allure.step('Get assets or collectibles list') def get_assets_or_collectibles_list(self, tab: str) -> typing.List[str]: @@ -55,7 +68,7 @@ class SendPopup(BasePopup): for asset in driver.findAllObjects(self._asset_list_item.real_name): assets_or_collectibles_list.append(asset) elif tab == 'Collectibles': - for asset in driver.findAllObjects(self._collectible_list_item.real_name): + for asset in walk_children(self._tokens_list.object): assets_or_collectibles_list.append(asset) return assets_or_collectibles_list @@ -69,8 +82,8 @@ class SendPopup(BasePopup): self._open_tab(tab) self._select_asset_or_collectible(name, tab) if tab == 'Assets': - assert driver.waitFor(lambda: self._amount_text_edit.is_visible, timeout_msec=6000) self._amount_text_edit.text = str(amount) + self._ens_address_text_edit.wait_until_appears(timeout_msec=configs.timeouts.UI_LOAD_TIMEOUT_MSEC) self._ens_address_text_edit.type_text(address) assert driver.waitFor(lambda: self._send_button.is_visible, timeout_msec=8000) self.click_send() diff --git a/test/e2e/gui/objects_map/names.py b/test/e2e/gui/objects_map/names.py index 5f6bc9304d..083e863b54 100644 --- a/test/e2e/gui/objects_map/names.py +++ b/test/e2e/gui/objects_map/names.py @@ -456,7 +456,7 @@ activityCenterStatusFlatButton = {"checkable": False, "container": statusDesktop checkmark_circle_icon_StatusIcon = {"container": statusDesktop_mainWindow_overlay, "objectName": "checkmark-circle-icon", "type": "StatusIcon", "visible": True} o_ActivityNotificationContactRequest = {"container": statusDesktop_mainWindow_overlay, "type": "ActivityNotificationContactRequest", "unnamed": 1, "visible": True} activityCenterTopBar_ActivityCenterPopupTopBarPanel = {"container": statusDesktop_mainWindow_overlay, "id": "activityCenterTopBar", "type": "ActivityCenterPopupTopBarPanel", "unnamed": 1, "visible": True} -contacts_StatusListView = {"container": statusDesktop_mainWindow_overlay, "type": "StatusListView", "unnamed": 1, "visible": True} +statusListView = {"container": statusDesktop_mainWindow_overlay, "type": "StatusListView", "unnamed": 1, "visible": True} # OS NAMES # Open Files Dialog