From 54326a127eece7cb5c5387b0a0ac73cb734e808b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Mon, 30 Jan 2023 14:58:05 +0100 Subject: [PATCH] SquishTests: Use openDocument()'s return for verifying project tree It's used anyway, relies on the expected project tree and works around a problem on some machines. Change-Id: Ic1e3e7a3f492f37d70c4409699ca78ad548d7445 Reviewed-by: Reviewed-by: Christian Stenger --- tests/system/suite_QMLS/tst_QMLS04/test.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/system/suite_QMLS/tst_QMLS04/test.py b/tests/system/suite_QMLS/tst_QMLS04/test.py index 2c42c178cc0..f3758ca8b02 100644 --- a/tests/system/suite_QMLS/tst_QMLS04/test.py +++ b/tests/system/suite_QMLS/tst_QMLS04/test.py @@ -40,17 +40,16 @@ def main(): myCompTE = "SampleApp.SampleApp.qml\\.qrc./.MyComponent\\.qml" # there should be new QML file generated with name "MyComponent.qml" try: - waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", myCompTE, 5000) + # openDocument() doesn't wait for expected elements, so it might be faster than the updates + # to the tree. Explicitly wait here to avoid timing issues. Using wFOI() instead of + # snooze() allows to proceed earlier, just in case it can find the item. + waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", + addBranchWildcardToRoot(myCompTE), 2000) except: - try: - waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", addBranchWildcardToRoot(myCompTE), 1000) - except: - test.fail("Refactoring failed - file MyComponent.qml was not generated properly in project explorer") - saveAndExit() - return - test.passes("Refactoring - file MyComponent.qml was generated properly in project explorer") + pass # open MyComponent.qml file for verification - if not openDocument(myCompTE): + if not test.verify(openDocument(myCompTE), + "Was MyComponent.qml properly generated in project explorer?"): test.fatal("Could not open MyComponent.qml.") saveAndExit() return