summaryrefslogtreecommitdiff
path: root/sw/qa/uitest
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2023-01-19 15:57:27 +0100
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2023-01-19 22:57:59 +0000
commita29ec09f7c2a01f131095fd9b2ecafa0812e8325 (patch)
tree0b20ba3f3a13c0ac37ee724cddf19cdc604d0719 /sw/qa/uitest
parent9753aa4a776af24c1bfb9cd41867ee2078438934 (diff)
tdf#135938 - Search for "insert reference" tree entry
Instead of assuming that the "insert reference" entry is always the second item of the menu tree, search for the correct child in the tree list. This commit addresses the failing build from https://gerrit.libreoffice.org/c/core/+/140985. Change-Id: I6f0d7021ab6f632784cab85656823c69f90baf60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145816 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'sw/qa/uitest')
-rwxr-xr-xsw/qa/uitest/writer_tests7/tdf135938.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/sw/qa/uitest/writer_tests7/tdf135938.py b/sw/qa/uitest/writer_tests7/tdf135938.py
index 013da93624da..00a72bec26ff 100755
--- a/sw/qa/uitest/writer_tests7/tdf135938.py
+++ b/sw/qa/uitest/writer_tests7/tdf135938.py
@@ -31,16 +31,21 @@ class tdf135938(UITestCase):
xName.executeAction("TYPE", mkPropertyValues({"TEXT": "DEF"}))
xInsert.executeAction("CLICK", tuple())
- # Select insert reference type
- xTreeEntry = xTreelistType.getChild('1')
- self.assertEqual(get_state_as_dict(xTreeEntry)["Text"], "Insert Reference")
- xTreeEntry.executeAction("SELECT", tuple())
+ # Search for insert reference type
+ xFilter = None
+ for childIx in range(len(xTreelistType.getChildren())):
+ xTreeEntry = xTreelistType.getChild(childIx)
+ if get_state_as_dict(xTreeEntry)["Text"] == "Insert Reference":
+ xTreeEntry.executeAction("SELECT", tuple())
+ # Filter the cross references
+ xFilter = xDialog.getChild("filter")
+ xFilter.executeAction("TYPE", mkPropertyValues({"TEXT": "A"}))
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'ABC' != 'DEF', i.e., the text of the name field did not change
+ self.assertEqual(get_state_as_dict(xName)["Text"], "ABC")
+ break
- # Filter the cross references
- xFilter = xDialog.getChild("filter")
- xFilter.executeAction("TYPE", mkPropertyValues({"TEXT": "A"}))
- # Without the fix in place, this test would have failed with
- # AssertionError: 'ABC' != 'DEF', i.e., the text of the name field did not change
- self.assertEqual(get_state_as_dict(xName)["Text"], "ABC")
+ # Check if insert reference entry was found
+ self.assertFalse(xFilter is None)
# vim: set shiftwidth=4 softtabstop=4 expandtab: