Squish: Stabilize tests that rely on a parsed project

As more and more progress bars might be present for different
purposes and we are not able to easily distinguish them
we need to use a more reliable way to wait for the end of
parsing a project.
Add a respective function and use the new approach where
this appears to be appropriate or necessary.

Change-Id: I20e2b9b0efd4785f8f0b1ddbc8496be111628669
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
This commit is contained in:
Christian Stenger
2019-08-16 08:36:52 +02:00
parent 9c8400d961
commit 17f5e19399
10 changed files with 19 additions and 10 deletions

View File

@@ -662,3 +662,12 @@ def addCPlusPlusFile(name, template, projectName, forceOverwrite=False, addToVCS
buttonToClick = 'Cancel' buttonToClick = 'Cancel'
clickButton("{text='%s' type='QPushButton' unnamed='1' visible='1' window=%s}" clickButton("{text='%s' type='QPushButton' unnamed='1' visible='1' window=%s}"
% (buttonToClick, overwriteDialog)) % (buttonToClick, overwriteDialog))
# if one of the parameters is set to 0 or below the respective parsing won't be waited for
def waitForProjectParsing(projectParsingTimeout=10000, codemodelParsingTimeout=10000):
if projectParsingTimeout > 0:
runButton = findObject(':*Qt Creator.Run_Core::Internal::FancyToolButton')
# Wait for parsing to complete
waitFor("runButton.enabled", projectParsingTimeout)
if codemodelParsingTimeout > 0:
progressBarWait(codemodelParsingTimeout)

View File

@@ -44,7 +44,7 @@ def main():
# open example project # open example project
openQmakeProject(examplePath) openQmakeProject(examplePath)
# wait for parsing to complete # wait for parsing to complete
progressBarWait(30000) waitForProjectParsing()
checkCodeModelSettings(useClang) checkCodeModelSettings(useClang)
# open .cpp file in editor # open .cpp file in editor
if not openDocument("openglwindow.Sources.main\\.cpp"): if not openDocument("openglwindow.Sources.main\\.cpp"):

View File

@@ -43,7 +43,7 @@ def main():
# open example project # open example project
openQmakeProject(examplePath) openQmakeProject(examplePath)
# wait for parsing to complete # wait for parsing to complete
progressBarWait(30000) waitForProjectParsing()
checkCodeModelSettings(useClang) checkCodeModelSettings(useClang)
# open .cpp file in editor # open .cpp file in editor
if not openDocument("openglwindow.Sources.main\\.cpp"): if not openDocument("openglwindow.Sources.main\\.cpp"):

View File

@@ -99,7 +99,7 @@ def main():
# select "Open project" and select a project # select "Open project" and select a project
examplePath = os.path.join(prepareTemplate(sourceExample), "animation.pro") examplePath = os.path.join(prepareTemplate(sourceExample), "animation.pro")
openQmakeProject(examplePath, fromWelcome = True) openQmakeProject(examplePath, fromWelcome = True)
progressBarWait(30000) waitForProjectParsing()
test.verify(checkIfObjectExists("{column='0' container=':Qt Creator_Utils::NavigationTreeView'" test.verify(checkIfObjectExists("{column='0' container=':Qt Creator_Utils::NavigationTreeView'"
" text~='animation( \(.*\))?' type='QModelIndex'}"), " text~='animation( \(.*\))?' type='QModelIndex'}"),
"Verifying: The project is opened in 'Edit' mode after configuring.") "Verifying: The project is opened in 'Edit' mode after configuring.")

View File

@@ -42,7 +42,7 @@ def main():
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
openQmakeProject(proFile) openQmakeProject(proFile)
progressBarWait(20000) waitForProjectParsing()
selectFromLocator("dummy.cpp") selectFromLocator("dummy.cpp")
## Waiting for a solution from Froglogic to make the below work. ## Waiting for a solution from Froglogic to make the below work.

View File

@@ -42,7 +42,7 @@ def main():
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
openQmakeProject(SpeedCrunchPath, [Targets.DESKTOP_4_8_7_DEFAULT]) openQmakeProject(SpeedCrunchPath, [Targets.DESKTOP_4_8_7_DEFAULT])
progressBarWait(30000) waitForProjectParsing()
fancyToolButton = waitForObject(":*Qt Creator_Core::Internal::FancyToolButton") fancyToolButton = waitForObject(":*Qt Creator_Core::Internal::FancyToolButton")

View File

@@ -60,7 +60,7 @@ def main():
test.fatal("Could not open/create cmake project - leaving test") test.fatal("Could not open/create cmake project - leaving test")
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
return return
progressBarWait(30000) waitForProjectParsing()
naviTreeView = "{column='0' container=':Qt Creator_Utils::NavigationTreeView' text~='%s' type='QModelIndex'}" naviTreeView = "{column='0' container=':Qt Creator_Utils::NavigationTreeView' text~='%s' type='QModelIndex'}"
if cmakeSupportsServerMode(): if cmakeSupportsServerMode():
treeFile = "projecttree_speedcrunch_server.tsv" treeFile = "projecttree_speedcrunch_server.tsv"

View File

@@ -46,7 +46,7 @@ def main():
"OTHER_FILES += example.qml") "OTHER_FILES += example.qml")
invokeMenuItem("File", "Save All") invokeMenuItem("File", "Save All")
invokeMenuItem("File", "Close All") invokeMenuItem("File", "Close All")
progressBarWait() waitForProjectParsing()
for filetype, filename in [["Headers", "person.h"], for filetype, filename in [["Headers", "person.h"],
["Sources", "main.cpp"], ["Sources", "main.cpp"],
["Sources", "person.cpp"], ["Sources", "person.cpp"],
@@ -66,7 +66,7 @@ def main():
renameFile(templateDir, usedProFile, projectName + "." + tempFiletype, renameFile(templateDir, usedProFile, projectName + "." + tempFiletype,
previous, filename) previous, filename)
# QTCREATORBUG-13176 does update the navigator async # QTCREATORBUG-13176 does update the navigator async
progressBarWait() waitForProjectParsing()
if filetype == "Headers": if filetype == "Headers":
verifyRenamedIncludes(templateDir, "main.cpp", previous, filename) verifyRenamedIncludes(templateDir, "main.cpp", previous, filename)
verifyRenamedIncludes(templateDir, "person.cpp", previous, filename) verifyRenamedIncludes(templateDir, "person.cpp", previous, filename)

View File

@@ -40,7 +40,7 @@ def main():
checkWelcomePage(sessionName, True) checkWelcomePage(sessionName, True)
for project in projects: for project in projects:
openQmakeProject(project, [Targets.DESKTOP_5_6_1_DEFAULT]) openQmakeProject(project, [Targets.DESKTOP_5_6_1_DEFAULT])
progressBarWait(20000) waitForProjectParsing()
checkNavigator(52, "Verifying whether all projects have been opened.") checkNavigator(52, "Verifying whether all projects have been opened.")
openDocument("animation.Resources.animation\\.qrc./animation.basics.animators\\.qml") openDocument("animation.Resources.animation\\.qrc./animation.basics.animators\\.qml")
openDocument("keyinteraction.Sources.main\\.cpp") openDocument("keyinteraction.Sources.main\\.cpp")

View File

@@ -33,7 +33,7 @@ def main():
# using a temporary directory won't mess up a potentially existing # using a temporary directory won't mess up a potentially existing
createNewQmlExtension(tempDir(), [target]) createNewQmlExtension(tempDir(), [target])
# wait for parsing to complete # wait for parsing to complete
progressBarWait(30000) waitForProjectParsing()
test.log("Building project Qt Quick 2 Extension Plugin (%s)" test.log("Building project Qt Quick 2 Extension Plugin (%s)"
% Targets.getStringForTarget(target)) % Targets.getStringForTarget(target))
invokeMenuItem("Build","Build All") invokeMenuItem("Build","Build All")