chore(SquishTests): improve StatusMainScreen.wait_for_banner_to_disappear

Required for #6898
This commit is contained in:
Stefan 2022-08-24 19:20:39 +02:00 committed by Stefan Dunca
parent 6e78281d99
commit 1405119f96
2 changed files with 14 additions and 10 deletions

View File

@ -52,16 +52,20 @@ class StatusMainScreen:
def __init__(self):
verify_screen(MainScreenComponents.PUBLIC_CHAT_ICON.value)
# Wait for the banner to disappear otherwise the click might land badly
# Close banner and wait to disappear otherwise the click might land badly
@staticmethod
def wait_for_banner_to_disappear(retry = 0):
if (retry > 5):
verify_failure("Banner did not disappear")
[bannerLoaded, _] = is_loaded_visible_and_enabled(MainScreenComponents.MODULE_WARNING_BANNER.value, 500)
time.sleep(1)
if (not bannerLoaded):
return
StatusMainScreen.wait_for_banner_to_disappear(retry + 1)
def wait_for_banner_to_disappear(timeoutMSec: int = 3000):
start = time.time()
while(start + timeoutMSec / 1000 > time.time()):
try:
obj = wait_and_get_obj(MainScreenComponents.MODULE_WARNING_BANNER.value, 100)
if not obj.visible:
return
obj.close()
except:
return
sleep_test(0.1)
verify_failure(f"Banner is still visible after {timeoutMSec}ms")
def join_chat_room(self, room: str):
click_obj_by_name(MainScreenComponents.PUBLIC_CHAT_ICON.value)

View File

@ -4,7 +4,7 @@ statusDesktop_mainWindow_overlay = {"container": statusDesktop_mainWindow, "type
mainWindow_navBarListView_ListView = {"container": statusDesktop_mainWindow, "objectName": "statusMainNavBarListView", "type": "ListView", "visible": True}
chatView_log = {"container": statusDesktop_mainWindow, "objectName": "chatLogView", "type": "StatusListView", "visible": True}
chatMessageListView_msgDelegate_MessageView = {"container": chatView_log, "objectName": "chatMessageViewDelegate", "index": 1, "type": "MessageView", "visible": True}
moduleWarning_Banner = {"container": statusDesktop_mainWindow, "objectName": "moduleWarningBanner", "type": "Rectangle", "visible": True}
moduleWarning_Banner = {"container": statusDesktop_mainWindow, "objectName": "moduleWarningBanner", "type": "ModuleWarning", "visible": True}
statusDesktop_mainWindow_AppMain_EmojiPopup_SearchTextInput = {"container": statusDesktop_mainWindow_overlay, "objectName": "StatusEmojiPopup_searchBox", "type": "TextEdit", "visible": True}
mainWindow_ScrollView = {"container": statusDesktop_mainWindow, "type": "StatusScrollView", "unnamed": 1, "visible": True}
mainWindow_ScrollView_2 = {"container": statusDesktop_mainWindow, "occurrence": 2, "type": "StatusScrollView", "unnamed": 1, "visible": True}