From c8b176c9a70a6d4b8cc2231f9812965198f5989c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Fri, 25 Jun 2021 16:21:41 +0200 Subject: [PATCH] Squish: Stabilize tst_HELP02 On Windows, the shortcut gets lost when clicking "Stop Recording" too quickly. Change-Id: Ieb89b7f59ded0792bf09fbad0b4b44a78d369c0f Reviewed-by: Christian Stenger --- tests/system/suite_HELP/tst_HELP02/test.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/system/suite_HELP/tst_HELP02/test.py b/tests/system/suite_HELP/tst_HELP02/test.py index 1d776689be7..2492be950fa 100755 --- a/tests/system/suite_HELP/tst_HELP02/test.py +++ b/tests/system/suite_HELP/tst_HELP02/test.py @@ -66,6 +66,11 @@ def checkQtCreatorHelpVersion(expectedVersion): test.log("Exception caught", "%s(%s)" % (str(t), str(v))) test.fail("Missing Qt Creator Manual.") + +def _shortcutMatches_(shortcutEdit, expectedText): + return str(findObject(shortcutEdit).text) == expectedText + + def setKeyboardShortcutForAboutQtC(): invokeMenuItem("Tools", "Options...") mouseClick(waitForObjectItem(":Options_QListView", "Environment")) @@ -85,20 +90,19 @@ def setKeyboardShortcutForAboutQtC(): "visible='1' text~='(Stop Recording|Record)'}" % shortcutGB) shortcut = ("{container=%s type='Utils::FancyLineEdit' unnamed='1' visible='1' " "placeholderText='Enter key sequence as text'}" % shortcutGB) + expected = 'Ctrl+Opt+A' if platform.system() == 'Darwin' else 'Ctrl+Alt+A' clickButton(record) nativeType("") + waitFor("_shortcutMatches_(shortcut, expected)", 5000) clickButton(record) - expected = 'Ctrl+Alt+A' - if platform.system() == 'Darwin': - expected = 'Ctrl+Opt+A' - shortcutMatches = waitFor("str(findObject(shortcut).text) == expected", 5000) - if not shortcutMatches and platform.system() == 'Darwin': + gotExpectedShortcut = _shortcutMatches_(shortcut, expected) + if not gotExpectedShortcut and platform.system() == 'Darwin': test.warning("Squish Issue: shortcut was set to %s - entering it manually now" % waitForObject(shortcut).text) replaceEditorContent(shortcut, expected) else: - test.verify(shortcutMatches, "Expected key sequence is displayed.") + test.verify(gotExpectedShortcut, "Expected key sequence is displayed.") clickButton(waitForObject(":Options.OK_QPushButton")) def main():