aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2022-12-15 08:25:56 +0100
committerChristian Stenger <christian.stenger@qt.io>2022-12-15 09:11:01 +0000
commit75c43f926b95cb7ac546ec8929e6e759320e7d89 (patch)
tree2920b3baa17c46e68b9033d5599d7e6ff4795636
parent3874ac236d1bd14f6904c03e63e88f065c6fe62e (diff)
Squish: Stabilize invoking context menu
Try a second time if the wanted menu item is not active when triggering the context menu the first time. Change-Id: I742db645542e6775baaa77fbdb1fd5a8e9a120f2 Reviewed-by: Robert Löhning <robert.loehning@qt.io>
-rw-r--r--tests/system/shared/editor_utils.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/system/shared/editor_utils.py b/tests/system/shared/editor_utils.py
index 4aa008515e..60ed802745 100644
--- a/tests/system/shared/editor_utils.py
+++ b/tests/system/shared/editor_utils.py
@@ -336,9 +336,16 @@ def validateSearchResult(expectedCount):
# this function invokes context menu and command from it
def invokeContextMenuItem(editorArea, command1, command2 = None):
- ctxtMenu = openContextMenuOnTextCursorPosition(editorArea)
- snooze(1)
- item1 = waitForObjectItem(objectMap.realName(ctxtMenu), command1, 2000)
+ for _ in range(2):
+ ctxtMenu = openContextMenuOnTextCursorPosition(editorArea)
+ snooze(1)
+ try:
+ item1 = waitForObjectItem(objectMap.realName(ctxtMenu), command1, 2000)
+ break
+ except:
+ test.warning("Context menu item not ready (%s) - trying once more." % command1)
+ type(editorArea, "<Escape>")
+
if command2 and platform.system() == 'Darwin':
mouseMove(item1)
activateItem(item1)