summaryrefslogtreecommitdiff
path: root/sd/qa/uitest/findReplace/findReplace.py
diff options
context:
space:
mode:
Diffstat (limited to 'sd/qa/uitest/findReplace/findReplace.py')
-rw-r--r--sd/qa/uitest/findReplace/findReplace.py214
1 files changed, 106 insertions, 108 deletions
diff --git a/sd/qa/uitest/findReplace/findReplace.py b/sd/qa/uitest/findReplace/findReplace.py
index 2d300e249517..b0f26723b1dc 100644
--- a/sd/qa/uitest/findReplace/findReplace.py
+++ b/sd/qa/uitest/findReplace/findReplace.py
@@ -13,113 +13,111 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, typ
class findReplace(UITestCase):
def test_find_impress(self):
- impress_doc = self.ui_test.load_file(get_url_for_data_file("findReplace.odp"))
- document = self.ui_test.get_component()
- # 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 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 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 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 (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()
-
- # now replace first (uncheck match case) with word "aaa" - click once Replace All button, check "Replace aaa aaa"
- matchcase = xDialog.getChild("matchcase")
- 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"}))
- replaceall = xDialog.getChild("replaceall")
- replaceall.executeAction("CLICK", tuple()) # click on replace all button
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn) #close the dialog
-
- # go to second page
- 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())
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
- self.assertEqual(document.CurrentController.getCurrentPage().Number, 2)
- #now check if text "Replace aaa aaa" is on first slide
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- searchterm = xDialog.getChild("searchterm")
- backsearch = xDialog.getChild("backsearch")
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Replace aaa aaa"}))
- backsearch.executeAction("CLICK", tuple())
- #verify
- self.assertEqual(document.CurrentController.getCurrentPage().Number, 1) #1st slide
-
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("findReplace.odp")) as impress_doc:
+ document = self.ui_test.get_component()
+ # 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 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 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 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 (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()
+
+ # now replace first (uncheck match case) with word "aaa" - click once Replace All button, check "Replace aaa aaa"
+ matchcase = xDialog.getChild("matchcase")
+ 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"}))
+ replaceall = xDialog.getChild("replaceall")
+ replaceall.executeAction("CLICK", tuple()) # click on replace all button
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn) #close the dialog
+
+ # go to second page
+ 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())
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
+ self.assertEqual(document.CurrentController.getCurrentPage().Number, 2)
+ #now check if text "Replace aaa aaa" is on first slide
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ searchterm = xDialog.getChild("searchterm")
+ backsearch = xDialog.getChild("backsearch")
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Replace aaa aaa"}))
+ backsearch.executeAction("CLICK", tuple())
+ #verify
+ self.assertEqual(document.CurrentController.getCurrentPage().Number, 1) #1st slide
+
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab: