diff --git a/tests/system/shared/editor_utils.py b/tests/system/shared/editor_utils.py index c438804429c9dcf043ba7854a61cffabd7510c05..558eef273d5f88a3ece92043f1f9c68d634de172 100644 --- a/tests/system/shared/editor_utils.py +++ b/tests/system/shared/editor_utils.py @@ -287,14 +287,22 @@ def invokeFindUsage(editor, line, typeOperation, n=1): invokeContextMenuItem(editor, "Find Usages") return True +def addBranchWildcardToRoot(rootNode): + pos = rootNode.find(".") + return rootNode[:pos] + " (*)" + rootNode[pos:] + def openDocument(treeElement): try: selectFromCombo(":Qt Creator_Core::Internal::NavComboBox", "Open Documents") navigator = waitForObject(":Qt Creator_Utils::NavigationTreeView") - fileName = waitForObjectItem(navigator, treeElement).text + try: + item = waitForObjectItem(navigator, treeElement, 3000) + except: + treeElement = addBranchWildcardToRoot(treeElement) + item = waitForObjectItem(navigator, treeElement) doubleClickItem(navigator, treeElement, 5, 5, 0, Qt.LeftButton) mainWindow = waitForObject(":Qt Creator_Core::Internal::MainWindow") - waitFor("fileName in str(mainWindow.windowTitle)") + waitFor("item.text in str(mainWindow.windowTitle)") return True except: return False diff --git a/tests/system/suite_CCOM/tst_CCOM02/test.py b/tests/system/suite_CCOM/tst_CCOM02/test.py index a687649f8cc9e2c2ce49a4d9805b63527010cc1f..02b3e93df3cc921c7321e66af7735fbd55ce995e 100755 --- a/tests/system/suite_CCOM/tst_CCOM02/test.py +++ b/tests/system/suite_CCOM/tst_CCOM02/test.py @@ -15,7 +15,7 @@ def main(): # open example project openQmakeProject(examplePath) # create syntax error - doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation.QML.qml.property-animation\\.qml", 5, 5, 0, Qt.LeftButton) + openDocument("propertyanimation.QML.qml.property-animation\\.qml") if not appendToLine(waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget"), "Image {", "SyntaxError"): invokeMenuItem("File", "Exit") return diff --git a/tests/system/suite_CSUP/tst_CSUP01/test.py b/tests/system/suite_CSUP/tst_CSUP01/test.py index 10b4f3ffa6be79d1ca0b0c08d65a7c62520f7b7e..78962ce23a9eed72d38faf05c3d4669e6d54bf2b 100644 --- a/tests/system/suite_CSUP/tst_CSUP01/test.py +++ b/tests/system/suite_CSUP/tst_CSUP01/test.py @@ -11,7 +11,7 @@ def main(): test.verify(waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp"), "Step 1: Verifying if: Project is opened.") # Step 2: Open .cpp file in Edit mode. - doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp.Sources.main\\.cpp", 5, 5, 0, Qt.LeftButton) + openDocument("SampleApp.Sources.main\\.cpp") test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"), "Step 2: Verifying if: .cpp file is opened in Edit mode.") # Step 3: Insert text "re" to new line in Editor mode and press Ctrl+Space. diff --git a/tests/system/suite_CSUP/tst_CSUP02/test.py b/tests/system/suite_CSUP/tst_CSUP02/test.py index ec8313a9fe92d3af355b13ca1d78680a126c83ce..804ea8caeaa072dcc0ed91a5f52b87e0915352eb 100644 --- a/tests/system/suite_CSUP/tst_CSUP02/test.py +++ b/tests/system/suite_CSUP/tst_CSUP02/test.py @@ -11,7 +11,7 @@ def main(): test.verify(waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp"), "Step 1: Verifying if: Project is opened.") # Step 2: Open .cpp file in Edit mode. - doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp.Sources.main\\.cpp", 5, 5, 0, Qt.LeftButton) + openDocument("SampleApp.Sources.main\\.cpp") test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"), "Step 2: Verifying if: .cpp file is opened in Edit mode.") # Steps 3&4: Insert text "class" to new line in Editor mode and press Ctrl+Space. diff --git a/tests/system/suite_CSUP/tst_CSUP04/test.py b/tests/system/suite_CSUP/tst_CSUP04/test.py index 28d4ac145b87ac6dcf4fc98712b1f9bc319a0783..c591a3425b2a26534b28224436c989430881fbf4 100644 --- a/tests/system/suite_CSUP/tst_CSUP04/test.py +++ b/tests/system/suite_CSUP/tst_CSUP04/test.py @@ -22,7 +22,7 @@ def main(): test.verify(waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation"), "Verifying if: Project is opened.") # open .cpp file in editor - doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation.Sources.main\\.cpp", 5, 5, 0, Qt.LeftButton) + openDocument("propertyanimation.Sources.main\\.cpp") test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"), "Verifying if: .cpp file is opened in Edit mode.") # place cursor on line "QmlApplicationViewer viewer;" @@ -39,7 +39,7 @@ def main(): test.verify(result, "Verifying if: The list of all usages of the selected text is displayed in Search Results. " "File with used text is opened.") # move cursor to the other word and test Find Usages function by pressing Ctrl+Shift+U. - doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation.Sources.main\\.cpp", 5, 5, 0, Qt.LeftButton) + openDocument("propertyanimation.Sources.main\\.cpp") if not placeCursorToLine(editorWidget, "viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);"): return for i in range(4): diff --git a/tests/system/suite_CSUP/tst_CSUP05/test.py b/tests/system/suite_CSUP/tst_CSUP05/test.py index f3d065ed0ef9af8d6c65662399e01b047f517a01..4a947079d472530adc7a2c8953709954f749d629 100644 --- a/tests/system/suite_CSUP/tst_CSUP05/test.py +++ b/tests/system/suite_CSUP/tst_CSUP05/test.py @@ -19,7 +19,7 @@ def main(): test.verify(waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation"), "Verifying if: Project is opened.") # open .cpp file in editor - doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation.Sources.main\\.cpp", 5, 5, 0, Qt.LeftButton) + openDocument("propertyanimation.Sources.main\\.cpp") test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"), "Verifying if: .cpp file is opened in Edit mode.") # select some word for example "viewer" and press Ctrl+F. diff --git a/tests/system/suite_QMLS/shared/qmls.py b/tests/system/suite_QMLS/shared/qmls.py index 37bcdcb622244cfa46c64aed5fcdb0ab59b4b255..1792c98ff44877d7b45fd4179ba7805490e7b920 100644 --- a/tests/system/suite_QMLS/shared/qmls.py +++ b/tests/system/suite_QMLS/shared/qmls.py @@ -6,8 +6,11 @@ def startQtCreatorWithNewAppAtQMLEditor(projectDir, projectName, line = None): # create qt quick application createNewQtQuickApplication(projectDir, projectName) # open qml file - doubleClickItem(":Qt Creator_Utils::NavigationTreeView", projectName + ".QML.qml/" + - projectName + ".main\\.qml", 5, 5, 0, Qt.LeftButton) + qmlFile = projectName + ".QML.qml/" + projectName + ".main\\.qml" + if not openDocument(qmlFile): + test.fatal("Could not open %s" % qmlFile) + invokeMenuItem("File", "Exit") + return None # get editor editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") # place to line if needed diff --git a/tests/system/suite_QMLS/tst_QMLS03/test.py b/tests/system/suite_QMLS/tst_QMLS03/test.py index 4340260f656d0af06d3860a335d88fdc4d5387dd..abb3ab3a5a8f9c556c119e77c41ccaf5ed4248e5 100644 --- a/tests/system/suite_QMLS/tst_QMLS03/test.py +++ b/tests/system/suite_QMLS/tst_QMLS03/test.py @@ -50,7 +50,7 @@ def main(): # open example project openQmakeProject(examplePath) # open qml file - doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation.QML.qml.color-animation\\.qml", 5, 5, 0, Qt.LeftButton) + openDocument("propertyanimation.QML.qml.color-animation\\.qml") # get editor editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") # 1. check usages using context menu diff --git a/tests/system/suite_SCOM/tst_SCOM02/test.py b/tests/system/suite_SCOM/tst_SCOM02/test.py index 67e8fca6ab2cb2bc7e40023b4a086d0e4e658b47..517217dabdd5d70becb040bd70512eb531fb0796 100644 --- a/tests/system/suite_SCOM/tst_SCOM02/test.py +++ b/tests/system/suite_SCOM/tst_SCOM02/test.py @@ -7,7 +7,7 @@ def main(): # create qt quick application createNewQtQuickApplication(tempDir(), "SampleApp") # create syntax error in qml file - doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp.QML.qml/SampleApp.main\\.qml", 5, 5, 0, Qt.LeftButton) + openDocument("SampleApp.QML.qml/SampleApp.main\\.qml") if not appendToLine(waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget"), "Text {", "SyntaxError"): invokeMenuItem("File", "Exit") return diff --git a/tests/system/suite_SCOM/tst_SCOM04/test.py b/tests/system/suite_SCOM/tst_SCOM04/test.py index 254fea1060ebe56d40dd9f4a7a46b5fb0abf046c..be20b1fd368609eb614b1cf011c0c9f7a277f5e9 100644 --- a/tests/system/suite_SCOM/tst_SCOM04/test.py +++ b/tests/system/suite_SCOM/tst_SCOM04/test.py @@ -10,7 +10,7 @@ def main(): # create qt quick application checkedTargets, projectName = createNewQtQuickApplication(tempDir(), "SampleApp") # create syntax error in cpp file - doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp.Sources.main\\.cpp", 5, 5, 0, Qt.LeftButton) + openDocument("SampleApp.Sources.main\\.cpp") if not appendToLine(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget"), "viewer.showExpanded();", "SyntaxError"): invokeMenuItem("File", "Exit") return