sw/qa/uitest/writer_tests7/tdf141158.py |   22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

New commits:
commit 192a16d6b0bad2d312b244a5576dfce3f4b05c36
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Nov 17 13:42:15 2021 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Nov 17 15:30:35 2021 +0100

    uitest: sw: Use execute_dialog_through_command and remove sleeps
    
    Change-Id: I5b14248bedc595092729c2c36cefb936ca9d33f7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125397
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/uitest/writer_tests7/tdf141158.py 
b/sw/qa/uitest/writer_tests7/tdf141158.py
index 6624530ee3cd..cefb8ed2da7b 100644
--- a/sw/qa/uitest/writer_tests7/tdf141158.py
+++ b/sw/qa/uitest/writer_tests7/tdf141158.py
@@ -5,26 +5,21 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
 from uitest.uihelper.common import get_state_as_dict
 from uitest.uihelper.common import select_pos
 from uitest.uihelper.common import get_url_for_data_file
-import time
 
 class TestTdf141158(UITestCase):
     def test_tdf141158(self):
         # load the desired bugdoc
-        with 
self.ui_test.load_file(get_url_for_data_file("TestHiddenHeadersFooters.docx")):
+        with 
self.ui_test.load_file(get_url_for_data_file("TestHiddenHeadersFooters.docx")) 
as document:
             xWriterDoc = self.xUITest.getTopFocusWindow()
             xWriterEdit = xWriterDoc.getChild("writer_edit")
-            document = self.ui_test.get_component()
             # open the page styles dialog and select the headers tab
-            self.xUITest.executeCommand(".uno:PageStyleName")
-            TemplateDialog8 = self.xUITest.getTopFocusWindow()
-            xTabs = TemplateDialog8.getChild("tabcontrol")
-            select_pos(xTabs, "4")
-            # make the same left right page header state to off  and apply the 
setting
-            checkSameLR = TemplateDialog8.getChild("checkSameLR")
-            checkSameLR.executeAction("CLICK",tuple())
-            ok = TemplateDialog8.getChild("ok")
-            self.ui_test.close_dialog_through_button(ok)
-            time.sleep(1)
+            with 
self.ui_test.execute_dialog_through_command(".uno:PageStyleName") as xDialog:
+                xTabs = xDialog.getChild("tabcontrol")
+                select_pos(xTabs, "4")
+                # make the same left right page header state to off  and apply 
the setting
+                checkSameLR = xDialog.getChild("checkSameLR")
+                checkSameLR.executeAction("CLICK",tuple())
+
             # go to the left header
             xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"}))
             self.xUITest.executeCommand(".uno:JumpToHeader")
@@ -35,6 +30,5 @@ class TestTdf141158(UITestCase):
             # without the fix in place it was "Right Header" (lost hidden left 
header),
             # with the fix it should pass...
             self.assertEqual("Left Header", xHeaderLeftText)
-            time.sleep(1)
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:

Reply via email to