diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-02-28 20:36:38 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-02-28 22:28:05 +0100 |
commit | 907a3c0248834f13441ec8c1239b3ca5c016aa5a (patch) | |
tree | c6c6e0fbe1d5dc3585fdc8318a449dd42c1f28d3 | |
parent | 424de44cd0eba254368d3b867bc440c99b548168 (diff) |
uitest: simplify tests even more
- No need to open the dialog to click the cancel button
- Avoid repeated calls to document.DrawPage.getByIndex(0).
Similar to 26298f29e9d36313be527b785a9bb96089582037
this might fix the different failures these tests sometimes
have
Change-Id: I4e175b6c5d48c4651e5877ec2a72c4858b590321
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130727
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | sc/qa/uitest/calc_tests3/insertQrCodeGen.py | 15 | ||||
-rw-r--r-- | sc/qa/uitest/signatureLine/insertSignatureLine.py | 22 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests3/insertQrCodeGen.py | 15 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests3/insertSignatureLine.py | 7 |
4 files changed, 16 insertions, 43 deletions
diff --git a/sc/qa/uitest/calc_tests3/insertQrCodeGen.py b/sc/qa/uitest/calc_tests3/insertQrCodeGen.py index 27fd3e1227f7..2594b66c2dea 100644 --- a/sc/qa/uitest/calc_tests3/insertQrCodeGen.py +++ b/sc/qa/uitest/calc_tests3/insertQrCodeGen.py @@ -9,7 +9,6 @@ from uitest.framework import UITestCase from uitest.uihelper.common import type_text -from com.sun.star.lang import IndexOutOfBoundsException class insertQrCode(UITestCase): @@ -18,13 +17,6 @@ class insertQrCode(UITestCase): xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") - # cancel the dialog without doing anything - with self.ui_test.execute_dialog_through_command(".uno:InsertQrCode", close_button="cancel") as xDialog: - - xURL = xDialog.getChild("edit_text") - type_text(xURL, "www.libreoffice.org") - - # Reopen the dialog box with self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") as xDialog: # Get elements in the Dialog Box @@ -38,8 +30,9 @@ class insertQrCode(UITestCase): xBorder.executeAction("DOWN", tuple()) # check the QR code in the document - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).BarCodeProperties.Payload, "www.libreoffice.org") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).BarCodeProperties.ErrorCorrection, 1) - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).BarCodeProperties.Border, 1) + element = document.Sheets.getByIndex(0).DrawPage.getByIndex(0) + self.assertEqual(element.BarCodeProperties.Payload, "www.libreoffice.org") + self.assertEqual(element.BarCodeProperties.ErrorCorrection, 1) + self.assertEqual(element.BarCodeProperties.Border, 1) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/signatureLine/insertSignatureLine.py b/sc/qa/uitest/signatureLine/insertSignatureLine.py index 804b5e638b68..08323811a364 100644 --- a/sc/qa/uitest/signatureLine/insertSignatureLine.py +++ b/sc/qa/uitest/signatureLine/insertSignatureLine.py @@ -11,7 +11,6 @@ from uitest.framework import UITestCase from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.uihelper.common import get_state_as_dict, type_text from libreoffice.uno.propertyvalue import mkPropertyValues -from com.sun.star.lang import IndexOutOfBoundsException #Bug 117903 - Allow signature lines in Calc @@ -22,12 +21,6 @@ class insertSignatureLineCalc(UITestCase): xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") - # cancel the dialog without doing anything - with self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine", close_button="cancel") as xDialog: - - xName = xDialog.getChild("edit_name") - xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line - # set the signature line with self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") as xDialog: @@ -44,12 +37,13 @@ class insertSignatureLineCalc(UITestCase): xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"})) #check the signature Line in the document - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerName, "Name") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerEmail, "Email") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineCanAddComment, False) - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineShowSignDate, True) - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSigningInstructions, "Instructions") + element = document.Sheets.getByIndex(0).DrawPage.getByIndex(0) + self.assertEqual(element.SignatureLineSuggestedSignerName, "Name") + self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(element.SignatureLineSuggestedSignerEmail, "Email") + self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(element.SignatureLineCanAddComment, False) + self.assertEqual(element.SignatureLineShowSignDate, True) + self.assertEqual(element.SignatureLineSigningInstructions, "Instructions") # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/insertQrCodeGen.py b/sw/qa/uitest/writer_tests3/insertQrCodeGen.py index ec88944af6a7..5895211af123 100644 --- a/sw/qa/uitest/writer_tests3/insertQrCodeGen.py +++ b/sw/qa/uitest/writer_tests3/insertQrCodeGen.py @@ -9,7 +9,6 @@ from uitest.framework import UITestCase from uitest.uihelper.common import type_text -from com.sun.star.lang import IndexOutOfBoundsException class insertQrCode(UITestCase): @@ -17,13 +16,6 @@ class insertQrCode(UITestCase): with self.ui_test.create_doc_in_start_center("writer") as document: xWriterDoc = self.xUITest.getTopFocusWindow() - # cancel the dialog without doing anything - with self.ui_test.execute_dialog_through_command(".uno:InsertQrCode", close_button="cancel") as xDialog: - - xURL = xDialog.getChild("edit_text") - type_text(xURL, "www.libreoffice.org") - - # Reopen the dialog box with self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") as xDialog: # Get elements in the Dialog Box @@ -37,8 +29,9 @@ class insertQrCode(UITestCase): xBorder.executeAction("DOWN", tuple()) # check the QR code in the document - self.assertEqual(document.DrawPage.getByIndex(0).BarCodeProperties.Payload, "www.libreoffice.org") - self.assertEqual(document.DrawPage.getByIndex(0).BarCodeProperties.ErrorCorrection, 1) - self.assertEqual(document.DrawPage.getByIndex(0).BarCodeProperties.Border, 1) + element = document.DrawPage.getByIndex(0) + self.assertEqual(element.BarCodeProperties.Payload, "www.libreoffice.org") + self.assertEqual(element.BarCodeProperties.ErrorCorrection, 1) + self.assertEqual(element.BarCodeProperties.Border, 1) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/insertSignatureLine.py b/sw/qa/uitest/writer_tests3/insertSignatureLine.py index 67987a57e860..0082891dab1a 100644 --- a/sw/qa/uitest/writer_tests3/insertSignatureLine.py +++ b/sw/qa/uitest/writer_tests3/insertSignatureLine.py @@ -9,7 +9,6 @@ from uitest.framework import UITestCase from libreoffice.uno.propertyvalue import mkPropertyValues -from com.sun.star.lang import IndexOutOfBoundsException class insertSignatureLine(UITestCase): @@ -17,12 +16,6 @@ class insertSignatureLine(UITestCase): with self.ui_test.create_doc_in_start_center("writer") as document: xWriterDoc = self.xUITest.getTopFocusWindow() - # cancel the dialog without doing anything - with self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine", close_button="cancel") as xDialog: - - xName = xDialog.getChild("edit_name") - xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line - # set the signature line with self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") as xDialog: |