[Libreoffice-commits] core.git: sd/qa

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Sat Aug 29 13:09:02 UTC 2020


 sd/qa/uitest/findReplace/findReplace.py |   47 ++++++++++++++++++++++++--------
 1 file changed, 36 insertions(+), 11 deletions(-)

New commits:
commit fee0404b00e1e97f429ae1eaa38458873385355f
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat Aug 29 11:27:00 2020 +0200
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sat Aug 29 15:08:11 2020 +0200

    sd: add some comments for findReplace.py UI Test
    
    Change-Id: I0c424cd254592bd04125ce8ec58ea38ddfc7659f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101636
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/sd/qa/uitest/findReplace/findReplace.py b/sd/qa/uitest/findReplace/findReplace.py
index 8e5cde3446ed..e298565fe5ef 100644
--- a/sd/qa/uitest/findReplace/findReplace.py
+++ b/sd/qa/uitest/findReplace/findReplace.py
@@ -27,59 +27,84 @@ class findReplace(UITestCase):
         # print(dir(document))
         # xPages= document.CurrentController.getCurrentPage().Number
         # print(xPages)
+
+        # check current slide is 1
         self.assertEqual(document.CurrentController.getCurrentPage().Number, 1)
+
+        # search for string "second"
         self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
         xDialog = self.xUITest.getTopFocusWindow()
         searchterm = xDialog.getChild("searchterm")
         searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"second"}))  #2nd slide
         xsearch = xDialog.getChild("search")
         xsearch.executeAction("CLICK", tuple())
-        #verify
+
+        # verify we moved to slide 2
         self.assertEqual(document.CurrentController.getCurrentPage().Number, 2)
 
+        # search for string "third"
         searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
         searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
         searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"third"}))
         xsearch.executeAction("CLICK", tuple())
-        #verify
+
+        #verify we moved to slide 3
         self.assertEqual(document.CurrentController.getCurrentPage().Number, 3)  #3rd slide
 
+        # close the dialog
         xcloseBtn = xDialog.getChild("close")
         self.ui_test.close_dialog_through_button(xcloseBtn)
 
-        #now open dialog and verify find="third" (remember last value); replace value with "First" ( click match case) with word "Replace" - click twice Replace button, check "Replace first first"
+        # now open dialog and verify find="third" (remember last value);
+        # replace value with "First" (click match case) with word "Replace"
+        # click twice the Replace button, check "Replace first first"
+
+        # open the dialog again
         self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
         xDialog = self.xUITest.getTopFocusWindow()
+
+        # verify search string is still "third" from previous search
         searchterm = xDialog.getChild("searchterm")
         self.assertEqual(get_state_as_dict(searchterm)["Text"], "third")
+
+        # replace it with "First"
         searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
         searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
         searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"First"}))
+
+        # click "match case"
         matchcase = xDialog.getChild("matchcase")
         matchcase.executeAction("CLICK", tuple())  #click match case
+
+        # set the replace string to "Replace"
         replaceterm = xDialog.getChild("replaceterm")
         replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Replace"})) #replace textbox
+
+        # hit replace button 2 times
         replace = xDialog.getChild("replace")
         replace.executeAction("CLICK", tuple())
-        replace.executeAction("CLICK", tuple())   #click twice Replace button
-        #close and reopen the dialog, because of bug  122788
+        replace.executeAction("CLICK", tuple())   #click twice Replace button (one selects, second replaces)
+
+        # close and reopen the dialog, because of bug 122788
         xcloseBtn = xDialog.getChild("close")
         self.ui_test.close_dialog_through_button(xcloseBtn)
         self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
         xDialog = self.xUITest.getTopFocusWindow()
-        replaceterm = xDialog.getChild("replaceterm")
+
+        # now replace first (uncheck match case) with word "aaa" - click once Replace All button, check "Replace aaa aaa"
         matchcase = xDialog.getChild("matchcase")
-        #now replace first (uncheck match case) with word "aaa" - click once Replace All button, check "Replace aaa aaa"
+        matchcase.executeAction("CLICK", tuple())  # uncheck match case
+
+        replaceterm = xDialog.getChild("replaceterm")
         replaceterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
         replaceterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
         replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"aaa"}))
-        matchcase.executeAction("CLICK", tuple())  #uncheck match case
         replaceall = xDialog.getChild("replaceall")
-        replaceall.executeAction("CLICK", tuple())
+        replaceall.executeAction("CLICK", tuple()) # click on replace all button
         xcloseBtn = xDialog.getChild("close")
-        self.ui_test.close_dialog_through_button(xcloseBtn)
+        self.ui_test.close_dialog_through_button(xcloseBtn) #close the dialog
 
-        #go to second page
+        # go to second page
         self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
         xDialog = self.xUITest.getTopFocusWindow()
         searchterm = xDialog.getChild("searchterm")


More information about the Libreoffice-commits mailing list