sw/qa/uitest/findReplace/findReplace.py | 8 ++++++-- sw/qa/uitest/findReplace/findSimilarity.py | 5 ----- sw/qa/uitest/findReplace/tdf137737.py | 8 ++++++-- sw/qa/uitest/findReplace/tdf144089.py | 8 ++++++-- sw/qa/uitest/macro_tests/tdf64690.py | 7 +++++-- 5 files changed, 23 insertions(+), 13 deletions(-)
New commits: commit 8ed2457a089ae78b54f82c1fae07d54777dda3ca Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Fri Apr 1 16:15:56 2022 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Apr 1 20:34:14 2022 +0200 uitest: sw: Deselect regexp checkbox after using it Otherwise, this is saved and it might affects other tests Change-Id: I326fd16ee87f49154acf952fe4d36616581a1cee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132432 Tested-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/uitest/findReplace/findReplace.py b/sw/qa/uitest/findReplace/findReplace.py index 1f6f607ec5b4..3321ebd108c8 100644 --- a/sw/qa/uitest/findReplace/findReplace.py +++ b/sw/qa/uitest/findReplace/findReplace.py @@ -107,13 +107,17 @@ class findReplace(UITestCase): xSimilarity.executeAction("CLICK", tuple()) regexp = xDialog.getChild("regexp") - if get_state_as_dict(regexp)['Selected'] == 'false': - regexp.executeAction("CLICK", tuple()) #regular expressions + regexp.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(regexp)['Selected']) replaceall = xDialog.getChild("replaceall") replaceall.executeAction("CLICK", tuple()) #verify self.assertEqual(document.Text.String[0:27], "replacedest number1 testnot") + # Deselect regex button, otherwise it might affect other tests + regexp.executeAction("CLICK", tuple()) + self.assertEqual("false", get_state_as_dict(regexp)['Selected']) + #tdf116242 ţ ț def test_tdf116242_replace_t_with_cedilla(self): with self.ui_test.load_file(get_url_for_data_file("tdf116242.odt")) as writer_doc: diff --git a/sw/qa/uitest/findReplace/findSimilarity.py b/sw/qa/uitest/findReplace/findSimilarity.py index 741feb8b50b8..7c532cc20c16 100644 --- a/sw/qa/uitest/findReplace/findSimilarity.py +++ b/sw/qa/uitest/findReplace/findSimilarity.py @@ -26,11 +26,6 @@ class findSimilarities(UITestCase): searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"seco"})) #seco # check similarities, button similarities, set values = 1; close dialog with OK - # Deselect regex before selecting similarity - xRegexp = xDialog.getChild("regexp") - if get_state_as_dict(xRegexp)['Selected'] == 'true': - xRegexp.executeAction("CLICK", tuple()) - similarity = xDialog.getChild("similarity") if get_state_as_dict(similarity)['Selected'] == 'false': similarity.executeAction("CLICK", tuple()) diff --git a/sw/qa/uitest/findReplace/tdf137737.py b/sw/qa/uitest/findReplace/tdf137737.py index 64a155834c85..b2abf3f95acb 100644 --- a/sw/qa/uitest/findReplace/tdf137737.py +++ b/sw/qa/uitest/findReplace/tdf137737.py @@ -35,12 +35,16 @@ class tdf137737(UITestCase): xSimilarity.executeAction("CLICK", tuple()) xRegexp = xDialog.getChild("regexp") - if get_state_as_dict(xRegexp)['Selected'] == 'false': - xRegexp.executeAction("CLICK", tuple()) + xRegexp.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(xRegexp)['Selected']) replaceall = xDialog.getChild("replaceall") replaceall.executeAction("CLICK", tuple()) + # Deselect regex button, otherwise it might affect other tests + xRegexp.executeAction("CLICK", tuple()) + self.assertEqual("false", get_state_as_dict(xRegexp)['Selected']) + # Without the fix in place, this test would have failed with # AssertionError: 0 != 1 self.assertEqual(0, writer_doc.Endnotes.Count) diff --git a/sw/qa/uitest/findReplace/tdf144089.py b/sw/qa/uitest/findReplace/tdf144089.py index bd2c89403a96..ae26ffd24a34 100644 --- a/sw/qa/uitest/findReplace/tdf144089.py +++ b/sw/qa/uitest/findReplace/tdf144089.py @@ -41,12 +41,16 @@ class tdf144089(UITestCase): xSimilarity.executeAction("CLICK", tuple()) xRegexp = xDialog.getChild("regexp") - if get_state_as_dict(xRegexp)['Selected'] == 'false': - xRegexp.executeAction("CLICK", tuple()) + xRegexp.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(xRegexp)['Selected']) replaceall = xDialog.getChild("replaceall") replaceall.executeAction("CLICK", tuple()) + # Deselect regex button, otherwise it might affect other tests + xRegexp.executeAction("CLICK", tuple()) + self.assertEqual("false", get_state_as_dict(xRegexp)['Selected']) + # Without the fix in place, this test would have failed with # AssertionError: 'This is a test' != 'This is a AAAA' self.assertEqual("This is a test", document.Text.String) diff --git a/sw/qa/uitest/macro_tests/tdf64690.py b/sw/qa/uitest/macro_tests/tdf64690.py index 27ca45767c1f..5e691117bb3d 100644 --- a/sw/qa/uitest/macro_tests/tdf64690.py +++ b/sw/qa/uitest/macro_tests/tdf64690.py @@ -47,8 +47,7 @@ class tdf64690(UITestCase): replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"ABC"})) regexp = xDialog.getChild("regexp") - if get_state_as_dict(regexp)['Selected'] == 'false': - regexp.executeAction("CLICK", tuple()) + regexp.executeAction("CLICK", tuple()) self.assertEqual("true", get_state_as_dict(regexp)['Selected']) selection = xDialog.getChild("selection") @@ -62,6 +61,10 @@ class tdf64690(UITestCase): with self.ui_test.execute_blocking_action(replaceall.executeAction, args=('CLICK', ())): pass + # Deselect regex button, otherwise it might affect other tests + regexp.executeAction("CLICK", tuple()) + self.assertEqual("false", get_state_as_dict(regexp)['Selected']) + self.assertEqual("ABCABCABCABC\nABCABCABCABC\n", get_state_as_dict(xEditWin)['Text'])