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: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Robert Löhning
2023-01-30 14:58:05 +01:00
parent c22b4b35e1
commit 54326a127e

View File

@@ -40,17 +40,16 @@ def main():
myCompTE = "SampleApp.SampleApp.qml\\.qrc./.MyComponent\\.qml" myCompTE = "SampleApp.SampleApp.qml\\.qrc./.MyComponent\\.qml"
# there should be new QML file generated with name "MyComponent.qml" # there should be new QML file generated with name "MyComponent.qml"
try: 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: except:
try: pass
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")
# open MyComponent.qml file for verification # 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.") test.fatal("Could not open MyComponent.qml.")
saveAndExit() saveAndExit()
return return