From 17f5e19399151a090b177681d9cfe606e71010c2 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 16 Aug 2019 08:36:52 +0200 Subject: 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 --- tests/system/shared/project.py | 9 +++++++++ tests/system/suite_CSUP/tst_CSUP04/test.py | 2 +- tests/system/suite_CSUP/tst_CSUP05/test.py | 2 +- tests/system/suite_WELP/tst_WELP02/test.py | 2 +- tests/system/suite_editors/tst_basic_cpp_support/test.py | 2 +- tests/system/suite_general/tst_build_speedcrunch/test.py | 2 +- tests/system/suite_general/tst_cmake_speedcrunch/test.py | 2 +- tests/system/suite_general/tst_rename_file/test.py | 4 ++-- tests/system/suite_general/tst_session_handling/test.py | 2 +- tests/system/suite_qtquick/tst_qtquick_creation4/test.py | 2 +- 10 files changed, 19 insertions(+), 10 deletions(-) diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index 2337f4fc4f..08398f14fa 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -662,3 +662,12 @@ def addCPlusPlusFile(name, template, projectName, forceOverwrite=False, addToVCS buttonToClick = 'Cancel' clickButton("{text='%s' type='QPushButton' unnamed='1' visible='1' window=%s}" % (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) diff --git a/tests/system/suite_CSUP/tst_CSUP04/test.py b/tests/system/suite_CSUP/tst_CSUP04/test.py index 196d25bc1d..143e3fe812 100644 --- a/tests/system/suite_CSUP/tst_CSUP04/test.py +++ b/tests/system/suite_CSUP/tst_CSUP04/test.py @@ -44,7 +44,7 @@ def main(): # open example project openQmakeProject(examplePath) # wait for parsing to complete - progressBarWait(30000) + waitForProjectParsing() checkCodeModelSettings(useClang) # open .cpp file in editor if not openDocument("openglwindow.Sources.main\\.cpp"): diff --git a/tests/system/suite_CSUP/tst_CSUP05/test.py b/tests/system/suite_CSUP/tst_CSUP05/test.py index c9f3cb892d..3e686b0509 100644 --- a/tests/system/suite_CSUP/tst_CSUP05/test.py +++ b/tests/system/suite_CSUP/tst_CSUP05/test.py @@ -43,7 +43,7 @@ def main(): # open example project openQmakeProject(examplePath) # wait for parsing to complete - progressBarWait(30000) + waitForProjectParsing() checkCodeModelSettings(useClang) # open .cpp file in editor if not openDocument("openglwindow.Sources.main\\.cpp"): diff --git a/tests/system/suite_WELP/tst_WELP02/test.py b/tests/system/suite_WELP/tst_WELP02/test.py index 7fe8b3d464..b44f0382dc 100644 --- a/tests/system/suite_WELP/tst_WELP02/test.py +++ b/tests/system/suite_WELP/tst_WELP02/test.py @@ -99,7 +99,7 @@ def main(): # select "Open project" and select a project examplePath = os.path.join(prepareTemplate(sourceExample), "animation.pro") openQmakeProject(examplePath, fromWelcome = True) - progressBarWait(30000) + waitForProjectParsing() test.verify(checkIfObjectExists("{column='0' container=':Qt Creator_Utils::NavigationTreeView'" " text~='animation( \(.*\))?' type='QModelIndex'}"), "Verifying: The project is opened in 'Edit' mode after configuring.") diff --git a/tests/system/suite_editors/tst_basic_cpp_support/test.py b/tests/system/suite_editors/tst_basic_cpp_support/test.py index 69e43adf7f..425512c4c7 100644 --- a/tests/system/suite_editors/tst_basic_cpp_support/test.py +++ b/tests/system/suite_editors/tst_basic_cpp_support/test.py @@ -42,7 +42,7 @@ def main(): if not startedWithoutPluginError(): return openQmakeProject(proFile) - progressBarWait(20000) + waitForProjectParsing() selectFromLocator("dummy.cpp") ## Waiting for a solution from Froglogic to make the below work. diff --git a/tests/system/suite_general/tst_build_speedcrunch/test.py b/tests/system/suite_general/tst_build_speedcrunch/test.py index 32a132ad63..e3543d55fa 100644 --- a/tests/system/suite_general/tst_build_speedcrunch/test.py +++ b/tests/system/suite_general/tst_build_speedcrunch/test.py @@ -42,7 +42,7 @@ def main(): if not startedWithoutPluginError(): return openQmakeProject(SpeedCrunchPath, [Targets.DESKTOP_4_8_7_DEFAULT]) - progressBarWait(30000) + waitForProjectParsing() fancyToolButton = waitForObject(":*Qt Creator_Core::Internal::FancyToolButton") diff --git a/tests/system/suite_general/tst_cmake_speedcrunch/test.py b/tests/system/suite_general/tst_cmake_speedcrunch/test.py index afc196abb8..2d9a3e2def 100644 --- a/tests/system/suite_general/tst_cmake_speedcrunch/test.py +++ b/tests/system/suite_general/tst_cmake_speedcrunch/test.py @@ -60,7 +60,7 @@ def main(): test.fatal("Could not open/create cmake project - leaving test") invokeMenuItem("File", "Exit") return - progressBarWait(30000) + waitForProjectParsing() naviTreeView = "{column='0' container=':Qt Creator_Utils::NavigationTreeView' text~='%s' type='QModelIndex'}" if cmakeSupportsServerMode(): treeFile = "projecttree_speedcrunch_server.tsv" diff --git a/tests/system/suite_general/tst_rename_file/test.py b/tests/system/suite_general/tst_rename_file/test.py index 9d46be1d37..cb5d434fe1 100644 --- a/tests/system/suite_general/tst_rename_file/test.py +++ b/tests/system/suite_general/tst_rename_file/test.py @@ -46,7 +46,7 @@ def main(): "OTHER_FILES += example.qml") invokeMenuItem("File", "Save All") invokeMenuItem("File", "Close All") - progressBarWait() + waitForProjectParsing() for filetype, filename in [["Headers", "person.h"], ["Sources", "main.cpp"], ["Sources", "person.cpp"], @@ -66,7 +66,7 @@ def main(): renameFile(templateDir, usedProFile, projectName + "." + tempFiletype, previous, filename) # QTCREATORBUG-13176 does update the navigator async - progressBarWait() + waitForProjectParsing() if filetype == "Headers": verifyRenamedIncludes(templateDir, "main.cpp", previous, filename) verifyRenamedIncludes(templateDir, "person.cpp", previous, filename) diff --git a/tests/system/suite_general/tst_session_handling/test.py b/tests/system/suite_general/tst_session_handling/test.py index 3a536975f2..702273b265 100644 --- a/tests/system/suite_general/tst_session_handling/test.py +++ b/tests/system/suite_general/tst_session_handling/test.py @@ -40,7 +40,7 @@ def main(): checkWelcomePage(sessionName, True) for project in projects: openQmakeProject(project, [Targets.DESKTOP_5_6_1_DEFAULT]) - progressBarWait(20000) + waitForProjectParsing() checkNavigator(52, "Verifying whether all projects have been opened.") openDocument("animation.Resources.animation\\.qrc./animation.basics.animators\\.qml") openDocument("keyinteraction.Sources.main\\.cpp") diff --git a/tests/system/suite_qtquick/tst_qtquick_creation4/test.py b/tests/system/suite_qtquick/tst_qtquick_creation4/test.py index 58ef85e333..c1e5105ba1 100644 --- a/tests/system/suite_qtquick/tst_qtquick_creation4/test.py +++ b/tests/system/suite_qtquick/tst_qtquick_creation4/test.py @@ -33,7 +33,7 @@ def main(): # using a temporary directory won't mess up a potentially existing createNewQmlExtension(tempDir(), [target]) # wait for parsing to complete - progressBarWait(30000) + waitForProjectParsing() test.log("Building project Qt Quick 2 Extension Plugin (%s)" % Targets.getStringForTarget(target)) invokeMenuItem("Build","Build All") -- cgit v1.2.1