diff --git a/tests/system/shared/debugger.py b/tests/system/shared/debugger.py index db78d54db7b..8737cfd479c 100644 --- a/tests/system/shared/debugger.py +++ b/tests/system/shared/debugger.py @@ -30,8 +30,7 @@ def takeDebuggerLog(): debuggerLogWindow = waitForObject("{container=':DebugModeWidget.Debugger Log_QDockWidget' type='Debugger::Internal::CombinedPane' unnamed='1' visible='1'}") debuggerLog = str(debuggerLogWindow.plainText) mouseClick(debuggerLogWindow, 5, 5, 0, Qt.LeftButton) - activateItem(waitForObjectItem(openContextMenuOnTextCursorPosition(debuggerLogWindow), - "Clear Contents")) + invokeContextMenuItem(debuggerLogWindow, "Clear Contents") waitFor("str(debuggerLogWindow.plainText)==''", 5000) invokeMenuItem("Window", "Views", "Debugger Log") return debuggerLog diff --git a/tests/system/shared/editor_utils.py b/tests/system/shared/editor_utils.py index 0e7afe73611..431c6087aed 100644 --- a/tests/system/shared/editor_utils.py +++ b/tests/system/shared/editor_utils.py @@ -274,7 +274,8 @@ def invokeContextMenuItem(editorArea, command1, command2 = None): ctxtMenu = openContextMenuOnTextCursorPosition(editorArea) activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), command1, 2000)) if command2: - activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), command2, 2000)) + activateItem(waitForObjectItem("{type='QMenu' visible='1' window=%s}" + % objectMap.realName(ctxtMenu), command2, 2000)) # this function invokes the "Find Usages" item from context menu # param editor an editor object diff --git a/tests/system/suite_QMLS/tst_QMLS03/test.py b/tests/system/suite_QMLS/tst_QMLS03/test.py index abb3ab3a5a8..992736eef57 100644 --- a/tests/system/suite_QMLS/tst_QMLS03/test.py +++ b/tests/system/suite_QMLS/tst_QMLS03/test.py @@ -60,8 +60,7 @@ def main(): return for i in range(5): type(editorArea, "") - ctxtMenu = openContextMenuOnTextCursorPosition(editorArea) - activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Find Usages")) + invokeContextMenuItem(editorArea, "Find Usages") # check if usage was properly found expectedResults = [ExpectedResult("color-animation.qml", 49, "Rectangle {"), ExpectedResult("color-animation.qml", 96, "Rectangle {"), diff --git a/tests/system/suite_QMLS/tst_QMLS04/test.py b/tests/system/suite_QMLS/tst_QMLS04/test.py index 8b88e610fbc..e807c7f88ba 100644 --- a/tests/system/suite_QMLS/tst_QMLS04/test.py +++ b/tests/system/suite_QMLS/tst_QMLS04/test.py @@ -8,9 +8,7 @@ def main(): for i in range(5): type(editorArea, "") # invoke Refactoring - Move Component into separate file - ctxtMenu = openContextMenuOnTextCursorPosition(editorArea) - activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Refactoring")) - activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Move Component into Separate File")) + invokeContextMenuItem(editorArea, "Refactoring", "Move Component into Separate File") # give component name and proceed replaceEditorContent(waitForObject(":Dialog.componentNameEdit_QLineEdit"), "MyComponent") clickButton(waitForObject(":Dialog.OK_QPushButton")) diff --git a/tests/system/suite_QMLS/tst_QMLS05/test.py b/tests/system/suite_QMLS/tst_QMLS05/test.py index c036438299c..76f93bcb324 100644 --- a/tests/system/suite_QMLS/tst_QMLS05/test.py +++ b/tests/system/suite_QMLS/tst_QMLS05/test.py @@ -18,9 +18,7 @@ def main(): invokeMenuItem("File", "Save All") # activate menu and apply 'Refactoring - Split initializer' numLinesExpected = len(str(editorArea.plainText).splitlines()) + 4 - ctxtMenu = openContextMenuOnTextCursorPosition(editorArea) - activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Refactoring")) - activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Split Initializer")) + invokeContextMenuItem(editorArea, "Refactoring", "Split Initializer") # wait until refactoring ended waitFor("len(str(editorArea.plainText).splitlines()) == numLinesExpected", 5000) # verify if refactoring was properly applied - each part on separate line diff --git a/tests/system/suite_QMLS/tst_QMLS06/test.py b/tests/system/suite_QMLS/tst_QMLS06/test.py index 61cc9165191..7c15748cd07 100644 --- a/tests/system/suite_QMLS/tst_QMLS06/test.py +++ b/tests/system/suite_QMLS/tst_QMLS06/test.py @@ -12,9 +12,7 @@ def main(): invokeMenuItem("File", "Save All") # invoke Refactoring - Wrap Component in Loader numLinesExpected = len(str(editorArea.plainText).splitlines()) + 10 - ctxtMenu = openContextMenuOnTextCursorPosition(editorArea) - activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Refactoring")) - activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Wrap Component in Loader")) + invokeContextMenuItem(editorArea, "Refactoring", "Wrap Component in Loader") # wait until refactoring ended waitFor("len(str(editorArea.plainText).splitlines()) >= numLinesExpected", 5000) # verify if refactoring was properly applied diff --git a/tests/system/suite_QMLS/tst_QMLS07/test.py b/tests/system/suite_QMLS/tst_QMLS07/test.py index f8502c7af45..dc6678314c1 100644 --- a/tests/system/suite_QMLS/tst_QMLS07/test.py +++ b/tests/system/suite_QMLS/tst_QMLS07/test.py @@ -11,9 +11,7 @@ def main(): invokeMenuItem("File", "Save All") # invoke Refactoring - Add a message suppression comment. numLinesExpected = len(str(editorArea.plainText).splitlines()) + 1 - ctxtMenu = openContextMenuOnTextCursorPosition(editorArea) - activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Refactoring")) - activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Add a Comment to Suppress This Message")) + invokeContextMenuItem(editorArea, "Refactoring", "Add a Comment to Suppress This Message") # wait until refactoring ended waitFor("len(str(editorArea.plainText).splitlines()) >= numLinesExpected", 5000) # verify if refactoring was properly applied diff --git a/tests/system/suite_editors/tst_qml_editor/test.py b/tests/system/suite_editors/tst_qml_editor/test.py index 975d673ad89..57080c3ac15 100644 --- a/tests/system/suite_editors/tst_qml_editor/test.py +++ b/tests/system/suite_editors/tst_qml_editor/test.py @@ -52,8 +52,7 @@ def testRenameId(): return False type(editor, "") searchFinished = False - ctxtMenu = openContextMenuOnTextCursorPosition(editor) - activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Rename Symbol Under Cursor")) + invokeContextMenuItem(editor, "Rename Symbol Under Cursor") waitFor("searchFinished") type(waitForObject("{leftWidget={text='Replace with:' type='QLabel' unnamed='1' visible='1'} " "type='Find::Internal::WideEnoughLineEdit' unnamed='1' visible='1' "