diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-03-17 18:58:44 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-03-21 11:31:04 +0100 |
commit | 53c4a93e32a5bcdc06a580e9652cde535134b3f6 (patch) | |
tree | 2905b3cd35f37e8b7395c5c66b626940b1e0355f /sw/qa/uitest | |
parent | 31d4f6c35a10a4bee4f4aebb86f05f8a9fd872bb (diff) |
select_by_text helper method for uitests
reduce the boilerplate associated with selecting an item
in a combobox
Change-Id: I035967d7b45c84788d67b9ab5bebf2dbfc13fdf9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112817
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/qa/uitest')
-rw-r--r-- | sw/qa/uitest/chapterNumbering/chapterNumbering.py | 21 | ||||
-rw-r--r-- | sw/qa/uitest/classification/classification.py | 17 | ||||
-rw-r--r-- | sw/qa/uitest/findReplace/tdf106099.py | 5 | ||||
-rw-r--r-- | sw/qa/uitest/navigator/tdf140257.py | 5 | ||||
-rw-r--r-- | sw/qa/uitest/sidebar/stylesSidebar.py | 3 | ||||
-rw-r--r-- | sw/qa/uitest/sidebar/tdf135590.py | 3 | ||||
-rw-r--r-- | sw/qa/uitest/table/tableProperties.py | 13 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests2/asianPhoneticGuide.py | 13 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests2/formatBulletsNumbering.py | 17 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests2/formatCharacter.py | 9 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests2/formatParagraph.py | 41 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests3/lineNumbering.py | 17 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests3/sort.py | 7 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests4/tdf134439.py | 3 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf124586.py | 5 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf125104.py | 5 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/forms.py | 3 |
17 files changed, 62 insertions, 125 deletions
diff --git a/sw/qa/uitest/chapterNumbering/chapterNumbering.py b/sw/qa/uitest/chapterNumbering/chapterNumbering.py index 67e82a40014f..9d3f0b5b4129 100644 --- a/sw/qa/uitest/chapterNumbering/chapterNumbering.py +++ b/sw/qa/uitest/chapterNumbering/chapterNumbering.py @@ -10,6 +10,7 @@ from uitest.debug import sleep from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.uihelper.common import get_state_as_dict, type_text from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text from uitest.uihelper.common import change_measurement_unit #Outline Numbering is now Chapter Numbering @@ -38,27 +39,17 @@ class WriterChapterNumbering(UITestCase): xatmf = xDialog.getChild("atmf") xindentatmf = xDialog.getChild("indentatmf") select_pos(xtab, "0") #first tab - props = {"TEXT": "Heading"} - actionProps = mkPropertyValues(props) - xstyle.executeAction("SELECT", actionProps) - props2 = {"TEXT": "1, 2, 3, ..."} - actionProps2 = mkPropertyValues(props2) - xnumbering.executeAction("SELECT", actionProps2) - props3 = {"TEXT": "Bullets"} - actionProps3 = mkPropertyValues(props3) - xcharstyle.executeAction("SELECT", actionProps3) + select_by_text(xstyle, "Heading") + select_by_text(xnumbering, "1, 2, 3, ...") + select_by_text(xcharstyle, "Bullets") xprefix.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) xsuffix.executeAction("TYPE", mkPropertyValues({"TEXT":"B"})) xstartat.executeAction("UP", tuple()) select_pos(xtab, "1") #second tab Position xalignedatmf.executeAction("UP", tuple()) - props4 = {"TEXT": "Centered"} - actionProps4 = mkPropertyValues(props4) - xnum2alignlb.executeAction("SELECT", actionProps4) - props5 = {"TEXT": "Tab stop"} - actionProps5 = mkPropertyValues(props5) - xnumfollowedbylb.executeAction("SELECT", actionProps5) + select_by_text(xnum2alignlb, "Centered") + select_by_text(xnumfollowedbylb, "Tab stop") xatmf.executeAction("UP", tuple()) xindentatmf.executeAction("UP", tuple()) diff --git a/sw/qa/uitest/classification/classification.py b/sw/qa/uitest/classification/classification.py index 181c00417397..61ed02cbc52a 100644 --- a/sw/qa/uitest/classification/classification.py +++ b/sw/qa/uitest/classification/classification.py @@ -7,6 +7,7 @@ from uitest.framework import UITestCase from uitest.uihelper.common import get_state_as_dict from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text from uitest.uihelper.calc import enter_text_to_cell from libreoffice.calc.document import get_cell_by_position from libreoffice.uno.propertyvalue import mkPropertyValues @@ -52,9 +53,7 @@ class classification(UITestCase): intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") - props = {"TEXT": "Confidential"} - actionProps = mkPropertyValues(props) - classificationCB.executeAction("SELECT", actionProps) + select_by_text(classificationCB, "Confidential") #verify International is set too self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential") #verify textBox Content @@ -96,9 +95,7 @@ class classification(UITestCase): intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") - props = {"TEXT": "Confidential"} - actionProps = mkPropertyValues(props) - classificationCB.executeAction("SELECT", actionProps) + select_by_text(classificationCB, "Confidential") #verify International is set too self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential") #verify textBox Content TODO textbox not supported @@ -128,9 +125,7 @@ class classification(UITestCase): intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") - props = {"TEXT": "Confidential"} - actionProps = mkPropertyValues(props) - classificationCB.executeAction("SELECT", actionProps) + select_by_text(classificationCB, "Confidential") #verify International is set too self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential") #verify textBox Content TODO - texbox not supported yet @@ -163,9 +158,7 @@ class classification(UITestCase): #type text AA intellectualPropertyPartEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"AA"})) intellectualPropertyPartAddButton.executeAction("CLICK", tuple()) - props = {"TEXT": "Internal Only"} - actionProps = mkPropertyValues(props) - classificationCB.executeAction("SELECT", actionProps) + select_by_text(classificationCB, "Internal Only") #verify International is set too self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Internal Only") #verify textBox Content TODO - texbox not supported yet diff --git a/sw/qa/uitest/findReplace/tdf106099.py b/sw/qa/uitest/findReplace/tdf106099.py index 085bba6e694a..8fb8592d6db2 100644 --- a/sw/qa/uitest/findReplace/tdf106099.py +++ b/sw/qa/uitest/findReplace/tdf106099.py @@ -7,6 +7,7 @@ from uitest.framework import UITestCase from uitest.uihelper.common import get_state_as_dict from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text from uitest.uihelper.calc import enter_text_to_cell from libreoffice.calc.document import get_cell_by_position from libreoffice.uno.propertyvalue import mkPropertyValues @@ -30,9 +31,7 @@ class tdf106099(UITestCase): xTabs = dialog.getChild("tabcontrol") select_pos(xTabs, "1") #tab font effects underlinelb = dialog.getChild("underlinelb") - props = {"TEXT": "Single"} - actionProps = mkPropertyValues(props) - underlinelb.executeAction("SELECT", actionProps) + select_by_text(underlinelb, "Single") xOkBtn = dialog.getChild("ok") self.ui_test.close_dialog_through_button(xOkBtn) diff --git a/sw/qa/uitest/navigator/tdf140257.py b/sw/qa/uitest/navigator/tdf140257.py index 78b6082cea8e..9c923bedee4d 100644 --- a/sw/qa/uitest/navigator/tdf140257.py +++ b/sw/qa/uitest/navigator/tdf140257.py @@ -8,6 +8,7 @@ from uitest.framework import UITestCase from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.uihelper.common import get_state_as_dict, type_text from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text class Tdf140257(UITestCase): @@ -20,9 +21,7 @@ class Tdf140257(UITestCase): xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL") - props = {"TEXT": sText} - actionProps = mkPropertyValues(props) - xOutline.executeAction("SELECT", actionProps) + select_by_text(xOutline, sText) xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) diff --git a/sw/qa/uitest/sidebar/stylesSidebar.py b/sw/qa/uitest/sidebar/stylesSidebar.py index 8096a06c0d20..8364334ad77e 100644 --- a/sw/qa/uitest/sidebar/stylesSidebar.py +++ b/sw/qa/uitest/sidebar/stylesSidebar.py @@ -6,6 +6,7 @@ from uitest.framework import UITestCase from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_by_text from libreoffice.uno.propertyvalue import mkPropertyValues class StylesSidebar(UITestCase): @@ -53,7 +54,7 @@ class StylesSidebar(UITestCase): xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "StyleListPanel"})) xFilter = xWriterEdit.getChild('filter') - xFilter.executeAction("SELECT", mkPropertyValues({"TEXT": "Custom Styles"})) + select_by_text(xFilter, "Custom Styles") expectedResults = ["customParagraphStyle", "customCharacterStyle", "customFrameStyle", "customPageStyle", "customNumberingStyle"] diff --git a/sw/qa/uitest/sidebar/tdf135590.py b/sw/qa/uitest/sidebar/tdf135590.py index 99d52d8c95e3..6a061b7a1f96 100644 --- a/sw/qa/uitest/sidebar/tdf135590.py +++ b/sw/qa/uitest/sidebar/tdf135590.py @@ -7,6 +7,7 @@ from uitest.framework import UITestCase from uitest.uihelper.common import get_state_as_dict, select_pos from uitest.uihelper.common import change_measurement_unit +from uitest.uihelper.common import select_by_text from libreoffice.uno.propertyvalue import mkPropertyValues class tdf135590(UITestCase): @@ -27,7 +28,7 @@ class tdf135590(UITestCase): xHeight = xDialog.getChild('height') xFormat = xDialog.getChild("format") - xFormat.executeAction("SELECT", mkPropertyValues({"TEXT": "C6 Envelope"})) + select_by_text(xFormat, "C6 Envelope") self.assertEqual("16.2", get_state_as_dict(xWidth)['Value']) self.assertEqual("11.4", get_state_as_dict(xHeight)['Value']) diff --git a/sw/qa/uitest/table/tableProperties.py b/sw/qa/uitest/table/tableProperties.py index d74260892f01..59778405bb3d 100644 --- a/sw/qa/uitest/table/tableProperties.py +++ b/sw/qa/uitest/table/tableProperties.py @@ -6,6 +6,7 @@ # from uitest.framework import UITestCase from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text from uitest.uihelper.calc import enter_text_to_cell from libreoffice.calc.document import get_cell_by_position from libreoffice.uno.propertyvalue import mkPropertyValues @@ -56,9 +57,7 @@ class tableProperties(UITestCase): belowmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) belowmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) belowmf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) - props = {"TEXT": "Left-to-right (LTR)"} - actionProps = mkPropertyValues(props) - textdirection.executeAction("SELECT", actionProps) + select_by_text(textdirection, "Left-to-right (LTR)") xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) #verify @@ -103,13 +102,9 @@ class tableProperties(UITestCase): headline = xDialog.getChild("headline") headline.executeAction("CLICK", tuple()) textdirection = xDialog.getChild("textorientation") - props = {"TEXT": "Vertical (bottom to top)"} - actionProps = mkPropertyValues(props) - textdirection.executeAction("SELECT", actionProps) + select_by_text(textdirection, "Vertical (bottom to top)") vertorient = xDialog.getChild("vertorient") - props2 = {"TEXT": "Bottom"} - actionProps2 = mkPropertyValues(props2) - vertorient.executeAction("SELECT", actionProps2) + select_by_text(vertorient, "Bottom") xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) #verify diff --git a/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py b/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py index 1af2bfe94933..137444857258 100644 --- a/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py +++ b/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py @@ -7,6 +7,7 @@ from uitest.framework import UITestCase from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_by_text import time from uitest.debug import sleep from uitest.uihelper.common import select_pos @@ -29,15 +30,9 @@ class asianPhoneticGuide(UITestCase): xLeft1ED.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) xRight1ED.executeAction("TYPE", mkPropertyValues({"TEXT":"w"})) - props = {"TEXT": "Right"} - actionProps = mkPropertyValues(props) - xadjustlb.executeAction("SELECT", actionProps) - props2 = {"TEXT": "Right"} - actionProps2 = mkPropertyValues(props2) - xpositionlb.executeAction("SELECT", actionProps2) - props3 = {"TEXT": "Quotation"} - actionProps3 = mkPropertyValues(props3) - xstylelb.executeAction("SELECT", actionProps3) + select_by_text(xadjustlb, "Right") + select_by_text(xpositionlb, "Right") + select_by_text(xstylelb, "Quotation") xApplyBtn = xDialog.getChild("ok") xApplyBtn.executeAction("CLICK", tuple()) diff --git a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py index 9373101a3fd8..ab053a115b4e 100644 --- a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py +++ b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py @@ -12,6 +12,7 @@ import time from uitest.debug import sleep from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text from uitest.uihelper.common import change_measurement_unit class formatBulletsNumbering(UITestCase): @@ -34,9 +35,7 @@ class formatBulletsNumbering(UITestCase): xokbtn = xDialog.getChild("ok") xalignedatmf.executeAction("UP", tuple()) - props = {"TEXT": "Centered"} - actionProps = mkPropertyValues(props) - xnum2alignlb.executeAction("SELECT", actionProps) + select_by_text(xnum2alignlb, "Centered") xatmf.executeAction("UP", tuple()) xindentatmf.executeAction("UP", tuple()) @@ -71,9 +70,7 @@ class formatBulletsNumbering(UITestCase): xTabs = xDialog.getChild("tabcontrol") select_pos(xTabs, "4") xnumfollowedbylb = xDialog.getChild("numfollowedbylb") - props = {"TEXT": "Space"} - actionProps = mkPropertyValues(props) - xnumfollowedbylb.executeAction("SELECT", actionProps) + select_by_text(xnumfollowedbylb, "Space") xokbtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xokbtn) @@ -106,13 +103,9 @@ class formatBulletsNumbering(UITestCase): xsuffix = xDialog.getChild("suffix") xallsame = xDialog.getChild("allsame") - props = {"TEXT": "A, B, C, ..."} - actionProps = mkPropertyValues(props) - xnumfmtlb.executeAction("SELECT", actionProps) + select_by_text(xnumfmtlb, "A, B, C, ...") xstartat.executeAction("UP", tuple()) - props2 = {"TEXT": "Bullets"} - actionProps2 = mkPropertyValues(props2) - xcharstyle.executeAction("SELECT", actionProps2) + select_by_text(xcharstyle, "Bullets") xprefix.executeAction("TYPE", mkPropertyValues({"TEXT":"o"})) xsuffix.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) xsuffix.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) diff --git a/sw/qa/uitest/writer_tests2/formatCharacter.py b/sw/qa/uitest/writer_tests2/formatCharacter.py index e1da1d2cb73b..afb7b555ba54 100644 --- a/sw/qa/uitest/writer_tests2/formatCharacter.py +++ b/sw/qa/uitest/writer_tests2/formatCharacter.py @@ -12,6 +12,7 @@ import time from uitest.debug import sleep from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text class formatCharacter(UITestCase): @@ -142,13 +143,9 @@ class formatCharacter(UITestCase): xName.executeAction("TYPE", mkPropertyValues({"TEXT":"hyperlink"})) xVisited = xDialog.getChild("visitedlb") - props = {"TEXT": "Bullets"} - actionProps = mkPropertyValues(props) - xVisited.executeAction("SELECT", actionProps) + select_by_text(xVisited, "Bullets") xUnVisited = xDialog.getChild("unvisitedlb") - props = {"TEXT": "Bullets"} - actionProps = mkPropertyValues(props) - xUnVisited.executeAction("SELECT", actionProps) + select_by_text(xUnVisited, "Bullets") xOK = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOK) diff --git a/sw/qa/uitest/writer_tests2/formatParagraph.py b/sw/qa/uitest/writer_tests2/formatParagraph.py index b5f8df306226..edd37982d2bf 100644 --- a/sw/qa/uitest/writer_tests2/formatParagraph.py +++ b/sw/qa/uitest/writer_tests2/formatParagraph.py @@ -12,6 +12,7 @@ import time from uitest.debug import sleep from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text from uitest.uihelper.common import change_measurement_unit class formatParagraph(UITestCase): @@ -43,9 +44,7 @@ class formatParagraph(UITestCase): xAbovePar.executeAction("UP", tuple()) xBelowPar.executeAction("UP", tuple()) xChkspace.executeAction("CLICK", tuple()) - props = {"TEXT": "Double"} - actionProps = mkPropertyValues(props) - xLineSpacing.executeAction("SELECT", actionProps) + select_by_text(xLineSpacing, "Double") xActivate.executeAction("CLICK", tuple()) xOK = xDialog.getChild("ok") @@ -97,17 +96,11 @@ class formatParagraph(UITestCase): xLastLine = xDialog.getChild("comboLB_LASTLINE") xExpandChk = xDialog.getChild("checkCB_EXPAND") - props = {"TEXT": "Left-to-right (LTR)"} - actionProps = mkPropertyValues(props) - xTextDirection.executeAction("SELECT", actionProps) - props2 = {"TEXT": "Top"} - actionProps2 = mkPropertyValues(props2) - xAlignment.executeAction("SELECT", actionProps2) + select_by_text(xTextDirection, "Left-to-right (LTR)") + select_by_text(xAlignment, "Top") xSnapToText.executeAction("CLICK", tuple()) xJustified.executeAction("CLICK", tuple()) - props3 = {"TEXT": "Justified"} - actionProps3 = mkPropertyValues(props3) - xLastLine.executeAction("SELECT", actionProps3) + select_by_text(xLastLine, "Justified") xExpandChk.executeAction("CLICK", tuple()) xOK = xDialog.getChild("ok") @@ -166,12 +159,8 @@ class formatParagraph(UITestCase): xBegin.executeAction("UP", tuple()) xMax.executeAction("UP", tuple()) xIns.executeAction("CLICK", tuple()) - props = {"TEXT": "Column"} - actionProps = mkPropertyValues(props) - xType.executeAction("SELECT", actionProps) - props2 = {"TEXT": "After"} - actionProps2 = mkPropertyValues(props2) - xPosition.executeAction("SELECT", actionProps2) + select_by_text(xType, "Column") + select_by_text(xPosition, "After") xspinOrphan.executeAction("UP", tuple()) xspinWidow.executeAction("UP", tuple()) xcheckWidow.executeAction("CLICK", tuple()) @@ -274,12 +263,8 @@ class formatParagraph(UITestCase): xPara = xDialog.getChild("checkCB_RESTART_PARACOUNT") xParaSpin = xDialog.getChild("spinNF_RESTART_PARA") - props = {"TEXT": "Level 1"} - actionProps = mkPropertyValues(props) - xOutline.executeAction("SELECT", actionProps) - props2 = {"TEXT": "Bullet •"} - actionProps2 = mkPropertyValues(props2) - xNumbering.executeAction("SELECT", actionProps2) + select_by_text(xOutline, "Level 1") + select_by_text(xNumbering, "Bullet •") xPara.executeAction("CLICK", tuple()) xParaSpin.executeAction("UP", tuple()) @@ -467,9 +452,7 @@ class formatParagraph(UITestCase): xLines.executeAction("UP", tuple()) xSpaceToText.executeAction("UP", tuple()) xText.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) - props = {"TEXT": "Definition"} - actionProps = mkPropertyValues(props) - xCharStyle.executeAction("SELECT", actionProps) + select_by_text(xCharStyle, "Definition") xOK = xDialog.getChild("ok") xOK.executeAction("CLICK", tuple()) @@ -624,9 +607,7 @@ class formatParagraph(UITestCase): xEnd = xDialog.getChild("MTR_TRGR_END_VALUE") xGradient.executeAction("CLICK", tuple()) - props = {"TEXT": "Axial"} - actionProps = mkPropertyValues(props) - xType.executeAction("SELECT", actionProps) + select_by_text(xType, "Axial") xAngle.executeAction("UP", tuple()) xBorder.executeAction("UP", tuple()) xStart.executeAction("UP", tuple()) diff --git a/sw/qa/uitest/writer_tests3/lineNumbering.py b/sw/qa/uitest/writer_tests3/lineNumbering.py index ad1db1ce0921..ce2292cde29b 100644 --- a/sw/qa/uitest/writer_tests3/lineNumbering.py +++ b/sw/qa/uitest/writer_tests3/lineNumbering.py @@ -9,6 +9,7 @@ from uitest.framework import UITestCase from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.uihelper.common import get_state_as_dict, type_text from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text from uitest.uihelper.common import change_measurement_unit class WriterLineNumbering(UITestCase): @@ -35,15 +36,9 @@ class WriterLineNumbering(UITestCase): xrestarteverynewpage = xDialog.getChild("restarteverynewpage") xshownumbering.executeAction("CLICK", tuple()) - props = {"TEXT": "Bullets"} - actionProps = mkPropertyValues(props) - xstyledropdown.executeAction("SELECT", actionProps) - props2 = {"TEXT": "A, B, C, ..."} - actionProps2 = mkPropertyValues(props2) - xformatdropdown.executeAction("SELECT", actionProps2) - props3 = {"TEXT": "Right"} - actionProps3 = mkPropertyValues(props3) - xpositiondropdown.executeAction("SELECT", actionProps3) + select_by_text(xstyledropdown, "Bullets") + select_by_text(xformatdropdown, "A, B, C, ...") + select_by_text(xpositiondropdown, "Right") xspacingspin.executeAction("UP", tuple()) xintervalspin.executeAction("UP", tuple()) xtextentry.executeAction("TYPE", mkPropertyValues({"TEXT":";"})) @@ -98,9 +93,7 @@ class WriterLineNumbering(UITestCase): xshownumbering.executeAction("CLICK", tuple()) itemFormat = ["1, 2, 3, ...", "A, B, C, ...", "a, b, c, ...", "I, II, III, ...", "i, ii, iii, ...", "A, .., AA, .., AAA, ..."] for i in range(6): - props2 = {"TEXT": itemFormat[i]} - actionProps2 = mkPropertyValues(props2) - xformatdropdown.executeAction("SELECT", actionProps2) + select_by_text(xformatdropdown, itemFormat[i]) self.assertEqual(get_state_as_dict(xformatdropdown)["SelectEntryText"], itemFormat[i]) xCancelBtn = xDialog.getChild("cancel") self.ui_test.close_dialog_through_button(xCancelBtn) diff --git a/sw/qa/uitest/writer_tests3/sort.py b/sw/qa/uitest/writer_tests3/sort.py index 6ae06c5ecef2..26c988dd68ff 100644 --- a/sw/qa/uitest/writer_tests3/sort.py +++ b/sw/qa/uitest/writer_tests3/sort.py @@ -7,6 +7,7 @@ from uitest.framework import UITestCase from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.uihelper.common import select_by_text import time from uitest.debug import sleep #Tools -Sort dialog + tdf81292 @@ -58,9 +59,7 @@ class WriterSort(UITestCase): xcharacter = xDialog.getChild("character") xseparator = xDialog.getChild("separator") xDown.executeAction("CLICK", tuple()) - props = {"TEXT": "Numerical"} - actionProps = mkPropertyValues(props) - xtypelb1.executeAction("SELECT", actionProps) + select_by_text(xtypelb1, "Numerical") xcharacter.executeAction("CLICK", tuple()) xseparator.executeAction("TYPE", mkPropertyValues({"TEXT":";"})) xOK = xDialog.getChild("ok") @@ -69,4 +68,4 @@ class WriterSort(UITestCase): self.assertEqual(document.Text.String[0:5], "2;8;3") self.ui_test.close_doc() -# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf134439.py b/sw/qa/uitest/writer_tests4/tdf134439.py index c10b28b448b7..07f4db79c934 100644 --- a/sw/qa/uitest/writer_tests4/tdf134439.py +++ b/sw/qa/uitest/writer_tests4/tdf134439.py @@ -6,6 +6,7 @@ # from uitest.framework import UITestCase from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_by_text from libreoffice.uno.propertyvalue import mkPropertyValues class tdf134439(UITestCase): @@ -32,7 +33,7 @@ class tdf134439(UITestCase): xPageStyle = xDialog.getChild("comboPageStyle") self.assertEqual("Chap 2", get_state_as_dict(xPageStyle)["SelectEntryText"]) - xPageStyle.executeAction("SELECT", mkPropertyValues({"TEXT": "Chap 3"})) + select_by_text(xPageStyle, "Chap 3") self.assertEqual("Chap 3", get_state_as_dict(xPageStyle)["SelectEntryText"]) diff --git a/sw/qa/uitest/writer_tests6/tdf124586.py b/sw/qa/uitest/writer_tests6/tdf124586.py index 8bb4f67e8888..04ac04956dfb 100644 --- a/sw/qa/uitest/writer_tests6/tdf124586.py +++ b/sw/qa/uitest/writer_tests6/tdf124586.py @@ -6,6 +6,7 @@ # from uitest.framework import UITestCase from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text from uitest.uihelper.calc import enter_text_to_cell from libreoffice.calc.document import get_cell_by_position from libreoffice.uno.propertyvalue import mkPropertyValues @@ -23,9 +24,7 @@ class tdf124586(UITestCase): self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") xDialog = self.xUITest.getTopFocusWindow() xstyle = xDialog.getChild("style") - props = {"TEXT": "MyHeading"} - actionProps = mkPropertyValues(props) - xstyle.executeAction("SELECT", actionProps) + select_by_text(xstyle, "MyHeading") xOK = xDialog.getChild("ok") xOK.executeAction("CLICK", tuple()) diff --git a/sw/qa/uitest/writer_tests6/tdf125104.py b/sw/qa/uitest/writer_tests6/tdf125104.py index b711b01caefe..0fa36587b20e 100644 --- a/sw/qa/uitest/writer_tests6/tdf125104.py +++ b/sw/qa/uitest/writer_tests6/tdf125104.py @@ -6,6 +6,7 @@ from uitest.framework import UITestCase from uitest.uihelper.common import select_pos, get_state_as_dict +from uitest.uihelper.common import select_by_text from libreoffice.uno.propertyvalue import mkPropertyValues class tdf125104(UITestCase): @@ -19,9 +20,7 @@ class tdf125104(UITestCase): def set_combo_layout_format(self, dialog, format): comboLayoutFormat = dialog.getChild("comboLayoutFormat") - props = {"TEXT": format} - actionProps = mkPropertyValues(props) - comboLayoutFormat.executeAction("SELECT", actionProps) + select_by_text(comboLayoutFormat, format) okBtn = dialog.getChild("ok") self.ui_test.close_dialog_through_button(okBtn) diff --git a/sw/qa/uitest/writer_tests7/forms.py b/sw/qa/uitest/writer_tests7/forms.py index d241fc38a876..179e8288cc2d 100644 --- a/sw/qa/uitest/writer_tests7/forms.py +++ b/sw/qa/uitest/writer_tests7/forms.py @@ -7,6 +7,7 @@ from uitest.framework import UITestCase from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file from uitest.uihelper.common import change_measurement_unit +from uitest.uihelper.common import select_by_text from libreoffice.uno.propertyvalue import mkPropertyValues class Forms(UITestCase): @@ -55,7 +56,7 @@ class Forms(UITestCase): self.assertEqual("None", get_state_as_dict(xAction)['SelectEntryText']) self.assertEqual("false", get_state_as_dict(xURL)['Enabled']) - xAction.executeAction("SELECT", mkPropertyValues({"TEXT": "Open document/web page"})) + select_by_text(xAction, "Open document/web page") self.assertEqual("Open document/web page", get_state_as_dict(xAction)['SelectEntryText']) self.assertEqual("true", get_state_as_dict(xURL)['Enabled']) |