From a86356ce8a38d24e1fee73225cbaf36c2ef83b39 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 18 Jul 2023 15:14:40 +0200 Subject: [PATCH] Squish: Fix menu handling on macOS Some menus inside QC have special numbering - but this only applies to Linux and Windows. On macOS we do not add this special numbering. Additionally this patch stabilizes the triggering of submenus. When they get triggered it takes a split of a second until the items inside the menu are usable. Let squish wait until the sub menu is fully present before trying to activate some of its items. Change-Id: I32c688a937ada1da07506d4ebd22730e4f2bcaef Reviewed-by: Marcus Tillmanns --- tests/system/shared/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index 6b99c8959da..2a17e0333c2 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -171,6 +171,10 @@ def invokeMenuItem(menu, item, *subItems): numberedPrefix = "%d | " for subItem in subItems: # we might have numbered sub items (e.g. "Recent Files") - these have this special prefix + # but on macOS we don't add these prefixes + if platform.system() == 'Darwin' and subItem.startswith(numberedPrefix): + subItem = subItem[5:] + if subItem.startswith(numberedPrefix): triggered = False for i in range(1, 10): @@ -186,7 +190,10 @@ def invokeMenuItem(menu, item, *subItems): "Function arguments: '%s', '%s', %s" % (menu, item, str(subItems))) break # we failed to trigger - no need to process subItems further else: + noAmpersandItem = item.replace('&', '') + waitForObject("{type='QMenu' title='%s'}" % noAmpersandItem, 2000) itemObject = waitForObjectItem(itemObject, subItem) + waitFor("itemObject.enabled", 2000) activateItem(itemObject)