cui/qa/uitest/dialogs/macroselectordlg.py |   29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

New commits:
commit 9ba251fb3e7d3b76c8ce730e4b3a3a7859bc119b
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Feb 20 16:00:03 2023 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Feb 20 16:16:13 2023 +0000

    cui: rework uitest to work with --without-java
    
    Change-Id: I6ed187f515b47b7e54ed85c08ee9523f1b777575
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147335
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/cui/qa/uitest/dialogs/macroselectordlg.py 
b/cui/qa/uitest/dialogs/macroselectordlg.py
index cb0d1928ba46..96ba11a2d888 100644
--- a/cui/qa/uitest/dialogs/macroselectordlg.py
+++ b/cui/qa/uitest/dialogs/macroselectordlg.py
@@ -9,29 +9,36 @@ from uitest.uihelper.common import get_state_as_dict
 
 class tdf145978(UITestCase):
     def test_tdf145978(self):
-        with self.ui_test.execute_dialog_through_command(".uno:RunMacro", 
close_button="") as xDialog:
+        with self.ui_test.execute_dialog_through_command(".uno:RunMacro") as 
xDialog:
             xCategoriesTree = xDialog.getChild("categories")
             xCategoriesTreeEntry = xCategoriesTree.getChild('1') #Application 
Macros
             xCategoriesTreeEntry.executeAction("EXPAND", tuple())
-            xCategoriesTreeEntry = xCategoriesTreeEntry.getChild('8') 
#HelloWorld
-            xCategoriesTreeEntry.executeAction("SELECT", tuple())
 
-            aCategoriesTreeEntryText = 
get_state_as_dict(xCategoriesTreeEntry)["Text"]
+            xSubCategoriesTreeEntry = None
+            for i in xCategoriesTreeEntry.getChildren():
+                xChild = xCategoriesTreeEntry.getChild(i)
+                if get_state_as_dict(xChild)["Text"] == "HelloWorld":
+                    xSubCategoriesTreeEntry = xChild
+                    break
+
+            xSubCategoriesTreeEntry.executeAction("SELECT", tuple())
 
             xCommandsTree = xDialog.getChild("commands")
-            xCommandsTreeEntry = xCommandsTree.getChild('2') #HelloWorld Python
-            xCommandsTreeEntry.executeAction("SELECT", tuple())
 
-            aCommandsTreeEntryText = 
get_state_as_dict(xCommandsTreeEntry)["Text"]
+            xCommandsTreeEntry = None
+            for i in xCommandsTree.getChildren():
+                xChild = xCommandsTree.getChild(i)
+                if get_state_as_dict(xChild)["Text"] == "HelloWorldPython":
+                    xCommandsTreeEntry = xChild
+                    break
 
-            xOKBtn = xDialog.getChild("ok")
-            self.ui_test.close_dialog_through_button(xOKBtn)
+            xCommandsTreeEntry.executeAction("SELECT", tuple())
 
         #Verify the dialog reloads with previous run macro selected
         with self.ui_test.execute_dialog_through_command(".uno:RunMacro") as 
xDialog:
             xTree = xDialog.getChild("categories")
-            self.assertEqual(get_state_as_dict(xTree)["SelectEntryText"], 
aCategoriesTreeEntryText)
+            self.assertEqual("HelloWorld", 
get_state_as_dict(xTree)["SelectEntryText"])
             xTree = xDialog.getChild("commands")
-            self.assertEqual(get_state_as_dict(xTree)["SelectEntryText"], 
aCommandsTreeEntryText)
+            self.assertEqual("HelloWorldPython", 
get_state_as_dict(xTree)["SelectEntryText"])
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:

Reply via email to