From 1405119f964da265b4f232a38d8753673e4990c6 Mon Sep 17 00:00:00 2001 From: Stefan Date: Wed, 24 Aug 2022 19:20:39 +0200 Subject: [PATCH] chore(SquishTests): improve StatusMainScreen.wait_for_banner_to_disappear Required for #6898 --- test/ui-test/src/screens/StatusMainScreen.py | 22 +++++++++++-------- .../global_shared/scripts/global_names.py | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/test/ui-test/src/screens/StatusMainScreen.py b/test/ui-test/src/screens/StatusMainScreen.py index 14db2c2e5b..5d120e4b52 100644 --- a/test/ui-test/src/screens/StatusMainScreen.py +++ b/test/ui-test/src/screens/StatusMainScreen.py @@ -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) diff --git a/test/ui-test/testSuites/global_shared/scripts/global_names.py b/test/ui-test/testSuites/global_shared/scripts/global_names.py index 64d37b5b89..ed81c7a92a 100644 --- a/test/ui-test/testSuites/global_shared/scripts/global_names.py +++ b/test/ui-test/testSuites/global_shared/scripts/global_names.py @@ -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}