tests: add better condition when waiting for status change

This commit is contained in:
Anastasiya Semenkevich 2024-10-03 16:13:35 +03:00 committed by Anastasiya
parent 3a511c04d5
commit ffc5da3805
6 changed files with 17 additions and 41 deletions

View File

@ -274,7 +274,7 @@ class AddNewAccountPopup(BasePopup):
@allure.step('Click continue')
def click_continue(self):
self._continue_button.click()
self._continue_button.click(timeout=10)
return self
@allure.step('Import new seed phrase and continue')
@ -287,7 +287,7 @@ class AddNewAccountPopup(BasePopup):
@allure.step('Enter new seed phrase')
def enter_new_seed_phrase(self, seed_phrase_words: list):
self._import_seed_phrase_button.click()
self._import_seed_phrase_button.click(timeout=10)
if len(seed_phrase_words) == 12:
self._seed_phrase_12_words_button.click()
elif len(seed_phrase_words) == 18:

View File

@ -154,7 +154,7 @@ class LeftPanel(QObject):
@allure.step('Open Wallet section')
def open_wallet(self, attempts: int = 3) -> WalletScreen:
self._wallet_button.click(timeout=10)
self._wallet_button.click(timeout=15)
try:
return WalletScreen()
except Exception as ex:

View File

@ -141,8 +141,7 @@ editOwnerTokenView_Fees_FeesBox = {"container": mainWindow_editOwnerTokenView_Ed
mainWindow_MintedTokensView = {"container": mainWindow_StatusWindow, "type": "MintedTokensView", "unnamed": 1, "visible": True}
specialCollectible_PrivilegedTokenArtworkPanel = {"container": mainWindow_MintedTokensView, "id": "specialCollectible", "type": "PrivilegedTokenArtworkPanel", "unnamed": 1, "visible": True}
specialCollectible_PrivilegedTokenArtworkPanel_2 = {"container": mainWindow_MintedTokensView, "id": "specialCollectible", "occurrence": 2, "type": "PrivilegedTokenArtworkPanel", "unnamed": 1, "visible": True}
o_CollectibleView_2 = {"container": mainWindow_MintedTokensView, "index": 1, "type": "CollectibleView", "unnamed": 1, "visible": True}
o_CollectibleView = {"container": mainWindow_MintedTokensView, "index": 0, "type": "CollectibleView", "unnamed": 1, "visible": True}
collectibleView_control = {"container": mainWindow_MintedTokensView, "objectName": "collectibleViewControl", "type": "CollectibleView", "visible": True}
token_sale_icon_StatusIcon = {"container": mainWindow_MintedTokensView, "objectName": "token-sale-icon", "type": "StatusIcon", "visible": True}
crown_icon_StatusIcon = {"container": mainWindow_MintedTokensView, "objectName": "crown-icon", "type": "StatusIcon", "visible": True}

View File

@ -1,3 +1,4 @@
import time
import typing
import allure
@ -280,38 +281,15 @@ class EditOwnerTokenView(QObject):
class MintedTokensView(QObject):
def __init__(self):
super(MintedTokensView, self).__init__(communities_names.mainWindow_MintedTokensView)
super().__init__(communities_names.mainWindow_MintedTokensView)
self.minted_tokens_view = QObject(communities_names.mainWindow_MintedTokensView)
self._coin_symbol = QObject(communities_names.token_sale_icon_StatusIcon)
self._crown_symbol = QObject(communities_names.crown_icon_StatusIcon)
self._master_token = QObject(communities_names.o_CollectibleView)
self._owner_token = QObject(communities_names.o_CollectibleView_2)
self.collectible = QObject(communities_names.collectibleView_control)
@property
@allure.step('Check crown symbol is visible on owner token')
def does_crown_exist(self) -> bool:
return self._crown_symbol.exists
@property
@allure.step('Check coin symbol is visible on master token')
def does_coin_exist(self) -> bool:
return self._coin_symbol.exists
@property
@allure.step('Get title of owner token')
def get_owner_token_title(self) -> str:
return str(self._owner_token.object.title)
@property
@allure.step('Get title of master token')
def get_master_token_title(self) -> str:
return str(self._master_token.object.title)
@property
@allure.step('Get status of owner token')
def get_owner_token_status(self) -> str:
return str(self._owner_token.object.subTitle)
@property
@allure.step('Get status of master token')
def get_master_token_status(self) -> str:
return str(self._master_token.object.subTitle)
def check_community_collectibles_statuses(self):
assert len(driver.findAllObjects(self.collectible.real_name)) == 2
assert self.wait_for(({'', '1 of 1 (you hodl)'} == set(
[str(getattr(collectible, 'subTitle', '')) for collectible in
driver.findAllObjects(self.collectible.wait_until_appears().real_name)]), 180000)), \
f"Token statuses were not changed within 3 minutes: {*[str(getattr(collectible, 'subTitle', '')) for collectible in driver.findAllObjects(self.collectible.real_name)],}"

View File

@ -88,7 +88,4 @@ def test_mint_owner_and_tokenmaster_tokens(main_window, user_account):
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
with step('Verify that status of both tokens'):
assert driver.waitFor(lambda: (minted_tokens_view.get_owner_token_status == '1 of 1 (you hodl)'), 60000), \
f'Owner token status was not updated and is {minted_tokens_view.get_owner_token_status}'
assert driver.waitFor(lambda: (minted_tokens_view.get_master_token_status == ''), 60000), \
f'Token master token status was not updated and is {minted_tokens_view.get_master_token_status}'
minted_tokens_view.check_community_collectibles_statuses()

View File

@ -15,6 +15,8 @@ import utils 1.0
Control {
id: root
objectName: "collectibleViewControl"
property string title: ""
property string unknownTitle: "..."
property string subTitle: ""