From cbc9f4c4e1f4a64b33d8f516f25cf2ba21d2716e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Tue, 13 Jul 2021 00:31:49 +0200 Subject: [PATCH] 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 --- .../suite_general/tst_rename_file/test.py | 19 ++++++++++++++----- 1 file 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 413e0385b43..7d846d3013d 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 == "":