sw/qa/uitest/writer_tests7/tdf135938.py |   25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

New commits:
commit 313b04a8ab3cf67223c18f70b348017173a95f6b
Author:     Andreas Heinisch <andreas.heini...@yahoo.de>
AuthorDate: Thu Jan 19 15:57:27 2023 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Jan 26 16:16:36 2023 +0000

    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.heini...@yahoo.de>
    (cherry picked from commit a29ec09f7c2a01f131095fd9b2ecafa0812e8325)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146195
    Tested-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

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:

Reply via email to