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