chore: reworked a bit test of sending nft

This commit is contained in:
Valentina Novgorodtceva 2024-05-03 16:36:52 +02:00 committed by Anastasiya
parent 56f8359296
commit 2625535597
3 changed files with 31 additions and 18 deletions

View File

@ -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')

View File

@ -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()

View File

@ -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