diff options
author | Robert Löhning <robert.loehning@qt.io> | 2021-07-13 00:31:49 +0200 |
---|---|---|
committer | Robert Löhning <robert.loehning@qt.io> | 2021-10-07 08:56:06 +0000 |
commit | cbc9f4c4e1f4a64b33d8f516f25cf2ba21d2716e (patch) | |
tree | 6b7b33851258852006eaabb00fd3f8ab324c6878 | |
parent | 47cb2e9d245db1cff18bea42512a1c1a717a43e8 (diff) |
Squish: Stabilize tst_rename_file
It takes a moment until the changed file appears in the project tree. A
context menu opened in that time may be in an unexpected state, so wait
until the renaming finished properly.
Change-Id: I6e1941083737b2df5855b9b0e61a973c99831304
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r-- | tests/system/suite_general/tst_rename_file/test.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/system/suite_general/tst_rename_file/test.py b/tests/system/suite_general/tst_rename_file/test.py index 413e0385b4..7d846d3013 100644 --- a/tests/system/suite_general/tst_rename_file/test.py +++ b/tests/system/suite_general/tst_rename_file/test.py @@ -87,14 +87,16 @@ def renameFile(projectDir, proFile, branch, oldname, newname): oldFilePath = os.path.join(projectDir, oldname) newFilePath = os.path.join(projectDir, newname) oldFileText = readFile(oldFilePath) - itemText = branch + "." + oldname.replace(".", "\\.") + oldItemText = branch + "." + oldname.replace(".", "\\.") + newItemText = branch + "." + newname.replace(".", "\\.") treeview = waitForObject(":Qt Creator_Utils::NavigationTreeView") try: - openItemContextMenu(treeview, itemText, 5, 5, 0) + openItemContextMenu(treeview, oldItemText, 5, 5, 0) except: - itemWithWildcard = addBranchWildcardToRoot(itemText) - waitForObjectItem(treeview, itemWithWildcard, 10000) - openItemContextMenu(treeview, itemWithWildcard, 5, 5, 0) + oldItemText = addBranchWildcardToRoot(oldItemText) + newItemText = addBranchWildcardToRoot(newItemText) + waitForObjectItem(treeview, oldItemText, 10000) + openItemContextMenu(treeview, oldItemText, 5, 5, 0) if oldname.lower().endswith(".qrc"): menu = ":Qt Creator.Project.Menu.Folder_QMenu" else: @@ -130,6 +132,13 @@ def renameFile(projectDir, proFile, branch, oldname, newname): test.verify(oldname not in os.listdir(projectDir), "Verify that file with old name does not exist: %s" % oldFilePath) + if newItemText.endswith("\\.qml"): + newItemText = newItemText.replace(".Other files.", ".QML.") + else: + newItemText = newItemText.replace(".QML.", ".Other files.") + waitForObjectItem(treeview, newItemText) + + def safeReadFile(filename): text = "" while text == "": |