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 /sc | |
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 'sc')
34 files changed, 139 insertions, 283 deletions
diff --git a/sc/qa/uitest/calc_tests/cellBackgroundColorSelector.py b/sc/qa/uitest/calc_tests/cellBackgroundColorSelector.py index ec78a7530f5c..0e26d3a41a51 100644 --- a/sc/qa/uitest/calc_tests/cellBackgroundColorSelector.py +++ b/sc/qa/uitest/calc_tests/cellBackgroundColorSelector.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 libreoffice.calc.document import get_cell_by_position from libreoffice.uno.propertyvalue import mkPropertyValues @@ -36,7 +37,7 @@ class CalcCellBackgroundColorSelector(UITestCase): color_selector = xColorpage.getChild("colorset") # For chart-palettes colors - xpaletteselector.executeAction("SELECT", mkPropertyValues({"TEXT": "chart-palettes"})) + select_by_text(xpaletteselector, "chart-palettes") # Select Color with id 2 color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "2"})) self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "2") @@ -54,7 +55,7 @@ class CalcCellBackgroundColorSelector(UITestCase): self.assertEqual(get_state_as_dict(color_selector)["RGB"], "(126,0,33)") # For libreoffice colors - xpaletteselector.executeAction("SELECT", mkPropertyValues({"TEXT": "libreoffice"})) + select_by_text(xpaletteselector, "libreoffice") # Select Color with id 6 color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "6"})) self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "6") @@ -72,7 +73,7 @@ class CalcCellBackgroundColorSelector(UITestCase): self.assertEqual(get_state_as_dict(color_selector)["RGB"], "(255,215,76)") # For html colors - xpaletteselector.executeAction("SELECT", mkPropertyValues({"TEXT": "html"})) + select_by_text(xpaletteselector, "html") # Select Color with id 1 color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "1"})) self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "1") @@ -87,7 +88,7 @@ class CalcCellBackgroundColorSelector(UITestCase): self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Navy") # For freecolour-hlc colors - xpaletteselector.executeAction("SELECT", mkPropertyValues({"TEXT": "freecolour-hlc"})) + select_by_text(xpaletteselector, "freecolour-hlc") # Select Color with id 988 color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "988"})) self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "988") @@ -102,7 +103,7 @@ class CalcCellBackgroundColorSelector(UITestCase): self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "HLC 190 50 20") # For tonal colors - xpaletteselector.executeAction("SELECT", mkPropertyValues({"TEXT": "tonal"})) + select_by_text(xpaletteselector, "tonal") # Select Color with id 17 color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "17"})) self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "17") @@ -117,7 +118,7 @@ class CalcCellBackgroundColorSelector(UITestCase): self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Magenta 82%") # For material colors - xpaletteselector.executeAction("SELECT", mkPropertyValues({"TEXT": "material"})) + select_by_text(xpaletteselector, "material") # Select Color with id 9 color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "9"})) self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "9") @@ -127,7 +128,7 @@ class CalcCellBackgroundColorSelector(UITestCase): self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Gray 800") # For standard colors - xpaletteselector.executeAction("SELECT", mkPropertyValues({"TEXT": "standard"})) + select_by_text(xpaletteselector, "standard") # Select Color with id 3 color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "3"})) self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "3") @@ -166,7 +167,7 @@ class CalcCellBackgroundColorSelector(UITestCase): color_selector = xColorpage.getChild("colorset") # For chart-palettes colors - xpaletteselector.executeAction("SELECT", mkPropertyValues({"TEXT": "chart-palettes"})) + select_by_text(xpaletteselector, "chart-palettes") # Select Color with id 2 color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "2"})) self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "2") diff --git a/sc/qa/uitest/calc_tests/fillRandomNumber.py b/sc/qa/uitest/calc_tests/fillRandomNumber.py index 2f9635184e97..ee97c487a1fe 100644 --- a/sc/qa/uitest/calc_tests/fillRandomNumber.py +++ b/sc/qa/uitest/calc_tests/fillRandomNumber.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_sheet_from_doc from libreoffice.calc.conditional_format import get_conditional_format_from_sheet @@ -34,9 +35,7 @@ class fillRandomNumber(UITestCase): xdecimalplacesspin = xDialog.getChild("decimal-places-spin") xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) - props = {"TEXT": "Uniform Integer"} - actionProps = mkPropertyValues(props) - xdistributioncombo.executeAction("SELECT", actionProps) + select_by_text(xdistributioncombo, "Uniform Integer") xparameter1spin.executeAction("UP", tuple()) xparameter2spin.executeAction("UP", tuple()) diff --git a/sc/qa/uitest/calc_tests/formatCells.py b/sc/qa/uitest/calc_tests/formatCells.py index 62c1e55c7e9c..2daf171e440e 100644 --- a/sc/qa/uitest/calc_tests/formatCells.py +++ b/sc/qa/uitest/calc_tests/formatCells.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.common import change_measurement_unit from uitest.uihelper.calc import enter_text_to_cell from libreoffice.calc.document import get_sheet_from_doc @@ -38,9 +39,7 @@ class formatCell(UITestCase): xlanguagelb = xDialog.getChild("languagelb") xformatted = xDialog.getChild("formatted") #language - props3 = {"TEXT": "English (USA)"} - actionProps3 = mkPropertyValues(props3) - xlanguagelb.executeAction("SELECT", actionProps3) + select_by_text(xlanguagelb, "English (USA)") #other properties xdecimalsed.executeAction("UP", tuple()) xleadzerosed.executeAction("UP", tuple()) @@ -213,20 +212,14 @@ class formatCell(UITestCase): xcheckHyphActive = xDialog.getChild("checkHyphActive") xcomboTextDirBox = xDialog.getChild("comboTextDirBox") - props = {"TEXT": "Left"} - actionProps = mkPropertyValues(props) - comboboxHorzAlign.executeAction("SELECT", actionProps) + select_by_text(comboboxHorzAlign, "Left") xspinIndentFrom.executeAction("UP", tuple()) indentVal = get_state_as_dict(xspinIndentFrom)["Text"] - props2 = {"TEXT": "Top"} - actionProps2 = mkPropertyValues(props2) - xcomboboxVertAlign.executeAction("SELECT", actionProps2) + select_by_text(xcomboboxVertAlign, "Top") xcheckVertStack.executeAction("CLICK", tuple()) xcheckWrapTextAuto.executeAction("CLICK", tuple()) xcheckHyphActive.executeAction("CLICK", tuple()) - props3 = {"TEXT": "Left-to-right (LTR)"} - actionProps3 = mkPropertyValues(props3) - xcomboTextDirBox.executeAction("SELECT", actionProps3) + select_by_text(xcomboTextDirBox, "Left-to-right (LTR)") xOK = xDialog.getChild("ok") xOK.executeAction("CLICK", tuple()) #Verify- select cell A1 diff --git a/sc/qa/uitest/calc_tests2/consolidate.py b/sc/qa/uitest/calc_tests2/consolidate.py index 4798372ab059..1a854b0cd975 100644 --- a/sc/qa/uitest/calc_tests2/consolidate.py +++ b/sc/qa/uitest/calc_tests2/consolidate.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 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 @@ -27,17 +28,11 @@ class consolidate(UITestCase): xbycol = xDialog.getChild("bycol") xeddestarea = xDialog.getChild("eddestarea") - props = {"TEXT": "Sum"} - actionProps = mkPropertyValues(props) - xfunc.executeAction("SELECT", actionProps) + select_by_text(xfunc, "Sum") - propsA = {"TEXT": "range1"} - actionPropsA = mkPropertyValues(propsA) - xlbdataarea.executeAction("SELECT", actionPropsA) + select_by_text(xlbdataarea, "range1") xadd.executeAction("CLICK", tuple()) - propsB = {"TEXT": "range2"} - actionPropsB = mkPropertyValues(propsB) - xlbdataarea.executeAction("SELECT", actionPropsB) + select_by_text(xlbdataarea, "range2") xadd.executeAction("CLICK", tuple()) propsC = {"TEXT": "range3"} actionPropsC = mkPropertyValues(propsC) diff --git a/sc/qa/uitest/calc_tests2/standardFilter.py b/sc/qa/uitest/calc_tests2/standardFilter.py index e5b5d1f6ba8d..a2e10f8de951 100644 --- a/sc/qa/uitest/calc_tests2/standardFilter.py +++ b/sc/qa/uitest/calc_tests2/standardFilter.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 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 @@ -29,16 +30,10 @@ class standardFilter(UITestCase): xfield2 = xDialog.getChild("field2") xval2 = xDialog.getChild("val2") - props = {"TEXT": "a"} - actionProps = mkPropertyValues(props) - xfield1.executeAction("SELECT", actionProps) + select_by_text(xfield1, "a") xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) - propsA = {"TEXT": "OR"} - actionPropsA = mkPropertyValues(propsA) - xconnect2.executeAction("SELECT", actionPropsA) - props2 = {"TEXT": "b"} - actionProps2 = mkPropertyValues(props2) - xfield2.executeAction("SELECT", actionProps2) + select_by_text(xconnect2, "OR") + select_by_text(xfield2, "b") xval2.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) @@ -86,16 +81,10 @@ class standardFilter(UITestCase): xval2 = xDialog.getChild("val2") xcopyresult = xDialog.getChild("copyresult") xedcopyarea = xDialog.getChild("edcopyarea") - props = {"TEXT": "a"} - actionProps = mkPropertyValues(props) - xfield1.executeAction("SELECT", actionProps) + select_by_text(xfield1, "a") xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) - propsA = {"TEXT": "OR"} - actionPropsA = mkPropertyValues(propsA) - xconnect2.executeAction("SELECT", actionPropsA) - props2 = {"TEXT": "b"} - actionProps2 = mkPropertyValues(props2) - xfield2.executeAction("SELECT", actionProps2) + select_by_text(xconnect2, "OR") + select_by_text(xfield2, "b") xval2.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) xcopyresult.executeAction("CLICK", tuple()) xedcopyarea.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) @@ -129,16 +118,10 @@ class standardFilter(UITestCase): xval2 = xDialog.getChild("val2") xcopyresult = xDialog.getChild("copyresult") xedcopyarea = xDialog.getChild("edcopyarea") - props = {"TEXT": "a"} - actionProps = mkPropertyValues(props) - xfield1.executeAction("SELECT", actionProps) + select_by_text(xfield1, "a") xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) - propsA = {"TEXT": "OR"} - actionPropsA = mkPropertyValues(propsA) - xconnect2.executeAction("SELECT", actionPropsA) - props2 = {"TEXT": "b"} - actionProps2 = mkPropertyValues(props2) - xfield2.executeAction("SELECT", actionProps2) + select_by_text(xconnect2, "OR") + select_by_text(xfield2, "b") xval2.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) xcopyresult.executeAction("CLICK", tuple()) xedcopyarea.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet2.$F$1"})) @@ -177,9 +160,7 @@ class standardFilter(UITestCase): xval1 = xDialog.getChild("val1") xcase = xDialog.getChild("case") - props = {"TEXT": "first"} - actionProps = mkPropertyValues(props) - xfield1.executeAction("SELECT", actionProps) + select_by_text(xfield1, "first") xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a1"})) xcase.executeAction("CLICK", tuple()) xOKBtn = xDialog.getChild("ok") @@ -231,9 +212,7 @@ class standardFilter(UITestCase): xval1 = xDialog.getChild("val1") xregexp = xDialog.getChild("regexp") - props = {"TEXT": "first"} - actionProps = mkPropertyValues(props) - xfield1.executeAction("SELECT", actionProps) + select_by_text(xfield1, "first") xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a*"})) xregexp.executeAction("CLICK", tuple()) xOKBtn = xDialog.getChild("ok") @@ -287,9 +266,7 @@ class standardFilter(UITestCase): xval1 = xDialog.getChild("val1") xregexp = xDialog.getChild("regexp") - props = {"TEXT": "first"} - actionProps = mkPropertyValues(props) - xfield1.executeAction("SELECT", actionProps) + select_by_text(xfield1, "first") xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a*"})) xregexp.executeAction("CLICK", tuple()) xOKBtn = xDialog.getChild("ok") @@ -355,12 +332,8 @@ class standardFilter(UITestCase): xval1 = xDialog.getChild("val1") xcond1 = xDialog.getChild("cond1") - props = {"TEXT": "A"} - actionProps = mkPropertyValues(props) - xfield1.executeAction("SELECT", actionProps) - props2 = {"TEXT": "Contains"} - actionProps2 = mkPropertyValues(props2) - xcond1.executeAction("SELECT", actionProps2) + select_by_text(xfield1, "A") + select_by_text(xcond1, "Contains") xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"cio"})) xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) @@ -424,12 +397,8 @@ class standardFilter(UITestCase): xval1 = xDialog.getChild("val1") xcond1 = xDialog.getChild("cond1") - props = {"TEXT": "A"} - actionProps = mkPropertyValues(props) - xfield1.executeAction("SELECT", actionProps) - props2 = {"TEXT": "Does not contain"} - actionProps2 = mkPropertyValues(props2) - xcond1.executeAction("SELECT", actionProps2) + select_by_text(xfield1, "A") + select_by_text(xcond1, "Does not contain") xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"cio"})) xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) @@ -494,12 +463,8 @@ class standardFilter(UITestCase): xval1 = xDialog.getChild("val1") xcond1 = xDialog.getChild("cond1") - props = {"TEXT": "A"} - actionProps = mkPropertyValues(props) - xfield1.executeAction("SELECT", actionProps) - props2 = {"TEXT": "Begins with"} - actionProps2 = mkPropertyValues(props2) - xcond1.executeAction("SELECT", actionProps2) + select_by_text(xfield1, "A") + select_by_text(xcond1, "Begins with") xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"so"})) xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) @@ -564,12 +529,8 @@ class standardFilter(UITestCase): xval1 = xDialog.getChild("val1") xcond1 = xDialog.getChild("cond1") - props = {"TEXT": "A"} - actionProps = mkPropertyValues(props) - xfield1.executeAction("SELECT", actionProps) - props2 = {"TEXT": "Does not begin with"} - actionProps2 = mkPropertyValues(props2) - xcond1.executeAction("SELECT", actionProps2) + select_by_text(xfield1, "A") + select_by_text(xcond1, "Does not begin with") xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"so"})) xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) @@ -634,12 +595,8 @@ class standardFilter(UITestCase): xval1 = xDialog.getChild("val1") xcond1 = xDialog.getChild("cond1") - props = {"TEXT": "A"} - actionProps = mkPropertyValues(props) - xfield1.executeAction("SELECT", actionProps) - props2 = {"TEXT": "Ends with"} - actionProps2 = mkPropertyValues(props2) - xcond1.executeAction("SELECT", actionProps2) + select_by_text(xfield1, "A") + select_by_text(xcond1, "Ends with") xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"s"})) xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) @@ -704,12 +661,8 @@ class standardFilter(UITestCase): xval1 = xDialog.getChild("val1") xcond1 = xDialog.getChild("cond1") - props = {"TEXT": "A"} - actionProps = mkPropertyValues(props) - xfield1.executeAction("SELECT", actionProps) - props2 = {"TEXT": "Does not end with"} - actionProps2 = mkPropertyValues(props2) - xcond1.executeAction("SELECT", actionProps2) + select_by_text(xfield1, "A") + select_by_text(xcond1, "Does not end with") xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"s"})) xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) diff --git a/sc/qa/uitest/calc_tests2/tdf104117.py b/sc/qa/uitest/calc_tests2/tdf104117.py index 84ab28580461..f835d47030bb 100644 --- a/sc/qa/uitest/calc_tests2/tdf104117.py +++ b/sc/qa/uitest/calc_tests2/tdf104117.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_sheet_from_doc from libreoffice.calc.conditional_format import get_conditional_format_from_sheet @@ -34,9 +35,7 @@ class tdf104117(UITestCase): xdecimalplacesspin = xDialog.getChild("decimal-places-spin") xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) - props = {"TEXT": "Uniform Integer"} - actionProps = mkPropertyValues(props) - xdistributioncombo.executeAction("SELECT", actionProps) + select_by_text(xdistributioncombo, "Uniform Integer") xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) xparameter2spin.executeAction("TYPE", mkPropertyValues({"TEXT":"1000000000000000000000000000000000000000000000"})) @@ -51,4 +50,4 @@ class tdf104117(UITestCase): self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False) self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False) 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/sc/qa/uitest/calc_tests3/tdf77509.py b/sc/qa/uitest/calc_tests3/tdf77509.py index 19ae4e31640b..bd9854b866e9 100644 --- a/sc/qa/uitest/calc_tests3/tdf77509.py +++ b/sc/qa/uitest/calc_tests3/tdf77509.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 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 tdf77509(UITestCase): xbycol = xDialog.getChild("bycol") xeddestarea = xDialog.getChild("eddestarea") - props = {"TEXT": "Sum"} - actionProps = mkPropertyValues(props) - xfunc.executeAction("SELECT", actionProps) + select_by_text(xfunc, "Sum") #4. Source data ranges: $Sheet1.$A$1:$B$7 #5. Click 'Add' so that ranges appear in "Consolidation ranges" xeddataarea.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$7"})) @@ -55,4 +54,4 @@ class tdf77509(UITestCase): self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 1) 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/sc/qa/uitest/calc_tests3/tdf80693.py b/sc/qa/uitest/calc_tests3/tdf80693.py index f416fce81514..afd8fea164d0 100644 --- a/sc/qa/uitest/calc_tests3/tdf80693.py +++ b/sc/qa/uitest/calc_tests3/tdf80693.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_sheet_from_doc from libreoffice.calc.conditional_format import get_conditional_format_from_sheet @@ -34,9 +35,7 @@ class tdf80693(UITestCase): xdecimalplacesspin = xDialog.getChild("decimal-places-spin") xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) - props = {"TEXT": "Uniform"} - actionProps = mkPropertyValues(props) - xdistributioncombo.executeAction("SELECT", actionProps) + select_by_text(xdistributioncombo, "Uniform") xparameter1spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) xparameter1spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) @@ -55,4 +54,4 @@ class tdf80693(UITestCase): self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False) self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False) 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/sc/qa/uitest/calc_tests4/tdf89958.py b/sc/qa/uitest/calc_tests4/tdf89958.py index 8dc9ba59c2f2..223b673e8fec 100644 --- a/sc/qa/uitest/calc_tests4/tdf89958.py +++ b/sc/qa/uitest/calc_tests4/tdf89958.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 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 @@ -31,12 +32,8 @@ class tdf89958(UITestCase): xval1 = xDialog.getChild("val1") xcond1 = xDialog.getChild("cond1") - props = {"TEXT": "Column A"} - actionProps = mkPropertyValues(props) - xfield1.executeAction("SELECT", actionProps) - props2 = {"TEXT": "Does not end with"} - actionProps2 = mkPropertyValues(props2) - xcond1.executeAction("SELECT", actionProps2) + select_by_text(xfield1, "Column A") + select_by_text(xcond1, "Does not end with") xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"CTORS"})) xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) @@ -65,4 +62,4 @@ class tdf89958(UITestCase): 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/sc/qa/uitest/calc_tests6/tdf107267.py b/sc/qa/uitest/calc_tests6/tdf107267.py index 70350a15e127..57d15dff17e6 100644 --- a/sc/qa/uitest/calc_tests6/tdf107267.py +++ b/sc/qa/uitest/calc_tests6/tdf107267.py @@ -11,6 +11,7 @@ from libreoffice.calc.document import get_column from uitest.uihelper.calc import enter_text_to_cell from libreoffice.calc.document import get_cell_by_position from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file #Bug 107267 - During a sub-total calculation or sum, the data set is not computed well. @@ -31,9 +32,7 @@ class Subtotals(UITestCase): select_pos(xTabs, "0") # = 1st group = 3. Group by "Person Number", select "shipping time" and use the Max function. xGroupBy = xDialog.getChild("group_by") - props = {"TEXT": "Person Number"} - actionProps = mkPropertyValues(props) - xGroupBy.executeAction("SELECT", actionProps) + select_by_text(xGroupBy, "Person Number") # 4. Tick 'Calculate subtotals for' -> "shipping time" - already selected # xCheckListMenu = xDialog.getChild("grid1") # xTreeList = xCheckListMenu.getChild("columns") @@ -44,9 +43,7 @@ class Subtotals(UITestCase): #= 2nd group =5. Group by "Person Number", select "shipping time" and use the Min function. select_pos(xTabs, "1") xGroupBy = xDialog.getChild("group_by") - props = {"TEXT": "Person Number"} - actionProps = mkPropertyValues(props) - xGroupBy.executeAction("SELECT", actionProps) + select_by_text(xGroupBy, "Person Number") # 4. Tick 'Calculate subtotals for' -> "shipping time" - already selected # xCheckListMenu = xDialog.getChild("grid1") # xTreeList = xCheckListMenu.getChild("columns") @@ -57,9 +54,7 @@ class Subtotals(UITestCase): #= 3rd group = Group by "Person Number", select "shipping time" and use the Average function. select_pos(xTabs, "2") xGroupBy = xDialog.getChild("group_by") - props = {"TEXT": "Person Number"} - actionProps = mkPropertyValues(props) - xGroupBy.executeAction("SELECT", actionProps) + select_by_text(xGroupBy, "Person Number") # 4. Tick 'Calculate subtotals for' -> "shipping time" - already selected # xCheckListMenu = xDialog.getChild("grid1") # xTreeList = xCheckListMenu.getChild("columns") diff --git a/sc/qa/uitest/calc_tests6/tdf118638.py b/sc/qa/uitest/calc_tests6/tdf118638.py index 284c423fe2b2..5bc25663fcbe 100644 --- a/sc/qa/uitest/calc_tests6/tdf118638.py +++ b/sc/qa/uitest/calc_tests6/tdf118638.py @@ -11,6 +11,7 @@ from libreoffice.calc.document import get_column from uitest.uihelper.calc import enter_text_to_cell from libreoffice.calc.document import get_cell_by_position from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file #Bug 118638 - subtotal option loses doesn't contain existing format for column @@ -30,9 +31,7 @@ class Subtotals(UITestCase): xTabs = xDialog.getChild("tabcontrol") select_pos(xTabs, "0") xGroupBy = xDialog.getChild("group_by") - props = {"TEXT": "Store Name"} - actionProps = mkPropertyValues(props) - xGroupBy.executeAction("SELECT", actionProps) + select_by_text(xGroupBy, "Store Name") xCheckListMenu = xDialog.getChild("grid1") xTreeList = xCheckListMenu.getChild("columns") xEntry = xTreeList.getChild("1") diff --git a/sc/qa/uitest/calc_tests8/tdf126248.py b/sc/qa/uitest/calc_tests8/tdf126248.py index f633bf9bcf41..146ee8a75131 100644 --- a/sc/qa/uitest/calc_tests8/tdf126248.py +++ b/sc/qa/uitest/calc_tests8/tdf126248.py @@ -10,6 +10,7 @@ from uitest.uihelper.common import get_state_as_dict from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.uihelper.calc import enter_text_to_cell from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text class tdf126248(UITestCase): @@ -43,7 +44,7 @@ class tdf126248(UITestCase): self.assertEqual("true", get_state_as_dict(asianlanguage)['Selected']) localeSetting = xDialog.getChild("localesetting") - localeSetting.executeAction("SELECT", mkPropertyValues({"TEXT": language})) + select_by_text(localeSetting, language) self.assertEqual(language, get_state_as_dict(localeSetting)['SelectEntryText']) diff --git a/sc/qa/uitest/chart/chartDataLabels.py b/sc/qa/uitest/chart/chartDataLabels.py index d581a98b1982..ebdc700eb402 100644 --- a/sc/qa/uitest/chart/chartDataLabels.py +++ b/sc/qa/uitest/chart/chartDataLabels.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.common import change_measurement_unit from uitest.uihelper.calc import enter_text_to_cell from libreoffice.calc.document import get_cell_by_position @@ -59,17 +60,11 @@ class chartDataLabels(UITestCase): category.executeAction("CLICK", tuple()) legend.executeAction("CLICK", tuple()) wrapText.executeAction("CLICK", tuple()) - props = {"TEXT": "Comma"} - actionProps = mkPropertyValues(props) - separator.executeAction("SELECT", actionProps) + select_by_text(separator, "Comma") - props2 = {"TEXT": "Below"} - actionProps2 = mkPropertyValues(props2) - placement.executeAction("SELECT", actionProps2) + select_by_text(placement, "Below") degrees.executeAction("UP", tuple()) - props3 = {"TEXT": "Right-to-left"} - actionProps3 = mkPropertyValues(props3) - textDirection.executeAction("SELECT", actionProps3) + select_by_text(textDirection, "Right-to-left") xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) diff --git a/sc/qa/uitest/chart/chartXAxis.py b/sc/qa/uitest/chart/chartXAxis.py index d9e9a72053c1..d169fa5d683e 100644 --- a/sc/qa/uitest/chart/chartXAxis.py +++ b/sc/qa/uitest/chart/chartXAxis.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.common import change_measurement_unit from uitest.uihelper.calc import enter_text_to_cell from libreoffice.calc.document import get_cell_by_position @@ -106,19 +107,13 @@ class chartXAxis(UITestCase): outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") placeMarks = xDialog.getChild("LB_PLACE_TICKS") - props = {"TEXT": "Start"} - actionProps = mkPropertyValues(props) - crossAxis.executeAction("SELECT", actionProps) - props2 = {"TEXT": "Outside end"} - actionProps2 = mkPropertyValues(props2) - placeLabels.executeAction("SELECT", actionProps2) + select_by_text(crossAxis, "Start") + select_by_text(placeLabels, "Outside end") innerMajorTick.executeAction("CLICK", tuple()) outerMajorTick.executeAction("CLICK", tuple()) innerMinorTick.executeAction("CLICK", tuple()) outerMinorTick.executeAction("CLICK", tuple()) - props3 = {"TEXT": "At axis"} - actionProps3 = mkPropertyValues(props3) - placeMarks.executeAction("SELECT", actionProps3) + select_by_text(placeMarks, "At axis") xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) @@ -152,9 +147,7 @@ class chartXAxis(UITestCase): self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true") self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis") #change tab "positioning". - props = {"TEXT": "Value"} - actionProps = mkPropertyValues(props) - crossAxis.executeAction("SELECT", actionProps) + select_by_text(crossAxis, "Value") crossAxisValue.executeAction("UP", tuple()) #1 xOKBtn = xDialog.getChild("ok") @@ -233,9 +226,7 @@ class chartXAxis(UITestCase): overlapCB.executeAction("CLICK", tuple()) breakCB.executeAction("CLICK", tuple()) stackedCB.executeAction("CLICK", tuple()) - props = {"TEXT": "Right-to-left"} - actionProps = mkPropertyValues(props) - textdirLB.executeAction("SELECT", actionProps) + select_by_text(textdirLB, "Right-to-left") xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) diff --git a/sc/qa/uitest/chart/chartYAxis.py b/sc/qa/uitest/chart/chartYAxis.py index 4e5412ab3652..22c3b79329d5 100644 --- a/sc/qa/uitest/chart/chartYAxis.py +++ b/sc/qa/uitest/chart/chartYAxis.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.common import change_measurement_unit from uitest.uihelper.calc import enter_text_to_cell from libreoffice.calc.document import get_cell_by_position @@ -107,19 +108,13 @@ class chartYAxis(UITestCase): outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") placeMarks = xDialog.getChild("LB_PLACE_TICKS") - props = {"TEXT": "Start"} - actionProps = mkPropertyValues(props) - crossAxis.executeAction("SELECT", actionProps) - props2 = {"TEXT": "Outside end"} - actionProps2 = mkPropertyValues(props2) - placeLabels.executeAction("SELECT", actionProps2) + select_by_text(crossAxis, "Start") + select_by_text(placeLabels, "Outside end") innerMajorTick.executeAction("CLICK", tuple()) outerMajorTick.executeAction("CLICK", tuple()) innerMinorTick.executeAction("CLICK", tuple()) outerMinorTick.executeAction("CLICK", tuple()) - props3 = {"TEXT": "At axis"} - actionProps3 = mkPropertyValues(props3) - placeMarks.executeAction("SELECT", actionProps3) + select_by_text(placeMarks, "At axis") xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) @@ -153,9 +148,7 @@ class chartYAxis(UITestCase): self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true") self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis") #change tab "positioning". - props = {"TEXT": "Value"} - actionProps = mkPropertyValues(props) - crossAxis.executeAction("SELECT", actionProps) + select_by_text(crossAxis, "Value") crossAxisValue.executeAction("CLEAR", tuple()) crossAxisValue.executeAction("TYPE", mkPropertyValues({"TEXT":"19.01.2018"})) #19.01.2018 @@ -235,9 +228,7 @@ class chartYAxis(UITestCase): overlapCB.executeAction("CLICK", tuple()) breakCB.executeAction("CLICK", tuple()) stackedCB.executeAction("CLICK", tuple()) - props = {"TEXT": "Right-to-left"} - actionProps = mkPropertyValues(props) - textdirLB.executeAction("SELECT", actionProps) + select_by_text(textdirLB, "Right-to-left") xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) diff --git a/sc/qa/uitest/chart/tdf123520.py b/sc/qa/uitest/chart/tdf123520.py index f402f2d4d859..150467bb5990 100644 --- a/sc/qa/uitest/chart/tdf123520.py +++ b/sc/qa/uitest/chart/tdf123520.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 @@ -44,9 +45,7 @@ class tdf123520(UITestCase): #crossAxisValue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"TAB"})) #TAB doesn't works- add "a" at the end of textbox #workaround - edit another ui item, it should trigger leave of textbox - props2 = {"TEXT": "Outside start"} - actionProps2 = mkPropertyValues(props2) - placeLabels.executeAction("SELECT", actionProps2) + select_by_text(placeLabels, "Outside start") xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) diff --git a/sc/qa/uitest/chart/tdf93506_trendline.py b/sc/qa/uitest/chart/tdf93506_trendline.py index 5b80202d2c98..8efd880ccbb5 100644 --- a/sc/qa/uitest/chart/tdf93506_trendline.py +++ b/sc/qa/uitest/chart/tdf93506_trendline.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.common import change_measurement_unit from uitest.uihelper.calc import enter_text_to_cell from libreoffice.calc.document import get_cell_by_position @@ -401,7 +402,7 @@ class tdf93506(UITestCase): yVarName = xDialog.getChild("entry_Yname") movingAverage.executeAction("CLICK", tuple()) #set polynomial - movingAverageType.executeAction("SELECT", mkPropertyValues({"TEXT": "Averaged Abscissa"})) + select_by_text(movingAverageType, "Averaged Abscissa") period.executeAction("UP", tuple()) #Click on tab "Line". diff --git a/sc/qa/uitest/conditional_format/tdf105351.py b/sc/qa/uitest/conditional_format/tdf105351.py index 2f9d55ff5c86..53e68a343a86 100644 --- a/sc/qa/uitest/conditional_format/tdf105351.py +++ b/sc/qa/uitest/conditional_format/tdf105351.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 @@ -31,14 +32,10 @@ class tdf105351(UITestCase): #4. In the conditional formatting window, select the dropdown on the left that says "Automatic" #and change it to "Value". In the text field below it enter 0. #5. Select the dropdown on the right that says "Automatic" and change it to "Value". In the text field below it enter 10 - props = {"TEXT": "Value"} - actionProps = mkPropertyValues(props) - xcolscalemin.executeAction("SELECT", actionProps) + select_by_text(xcolscalemin, "Value") xedcolscalemin.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) - props2 = {"TEXT": "Value"} - actionProps2 = mkPropertyValues(props2) - xcolscalemax.executeAction("SELECT", actionProps2) + select_by_text(xcolscalemax, "Value") xedcolscalemax.executeAction("TYPE", mkPropertyValues({"TEXT":"10"})) xOKBtn = xDialog.getChild("ok") diff --git a/sc/qa/uitest/key_f4/f4.py b/sc/qa/uitest/key_f4/f4.py index dbdbdbd5df95..ede0b2fdef9c 100644 --- a/sc/qa/uitest/key_f4/f4.py +++ b/sc/qa/uitest/key_f4/f4.py @@ -7,6 +7,7 @@ from uitest.framework import UITestCase import os from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_by_text from uitest.debug import sleep from libreoffice.uno.propertyvalue import mkPropertyValues from libreoffice.calc.document import get_cell_by_position @@ -94,9 +95,7 @@ class keyF4(UITestCase): formulasyntax = xDialogOpt.getChild("formulasyntax") #Excel R1C1 - props = {"TEXT": "Excel R1C1"} - actionProps = mkPropertyValues(props) - formulasyntax.executeAction("SELECT", actionProps) + select_by_text(formulasyntax, "Excel R1C1") xOKBtn = xDialogOpt.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) @@ -128,9 +127,7 @@ class keyF4(UITestCase): formulasyntax = xDialogOpt.getChild("formulasyntax") #Excel R1C1 - props = {"TEXT": "Calc A1"} - actionProps = mkPropertyValues(props) - formulasyntax.executeAction("SELECT", actionProps) + select_by_text(formulasyntax, "Calc A1") xOKBtn = xDialogOpt.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) diff --git a/sc/qa/uitest/pageFormat/tdf123508.py b/sc/qa/uitest/pageFormat/tdf123508.py index e3ec5327649a..61d53fd4187b 100644 --- a/sc/qa/uitest/pageFormat/tdf123508.py +++ b/sc/qa/uitest/pageFormat/tdf123508.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 @@ -28,9 +29,7 @@ class tdf123508(UITestCase): spinEDSCALEPAGEWIDTH = xDialog.getChild("spinED_SCALEPAGEWIDTH") spinEDSCALEPAGEHEIGHT = xDialog.getChild("spinED_SCALEPAGEHEIGHT") #select "Fit print range(s) to width/height" from the scale mode drop-down list - props = {"TEXT": "Fit print range(s) to width/height"} - actionProps = mkPropertyValues(props) - scalingMode.executeAction("SELECT", actionProps) + select_by_text(scalingMode, "Fit print range(s) to width/height") #define a value for the page, e.g.: width 2; height 2 spinEDSCALEPAGEWIDTH.executeAction("UP", tuple()) spinEDSCALEPAGEHEIGHT.executeAction("UP", tuple()) diff --git a/sc/qa/uitest/range_name/tdf137617.py b/sc/qa/uitest/range_name/tdf137617.py index f0184e4ad6d9..54c458823fe6 100644 --- a/sc/qa/uitest/range_name/tdf137617.py +++ b/sc/qa/uitest/range_name/tdf137617.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 +from uitest.uihelper.common import select_by_text from uitest.uihelper.calc import enter_text_to_cell class tdf137617(UITestCase): @@ -57,10 +58,7 @@ class tdf137617(UITestCase): xCalcFormulaEntry.executeAction("SELECT", tuple()) xFormulaSyntax = xDialogOpt.getChild('formulasyntax') - - props = {"TEXT": "Excel R1C1"} - actionProps = mkPropertyValues(props) - xFormulaSyntax.executeAction("SELECT", actionProps) + select_by_text(xFormulaSyntax, "Excel R1C1") xOKBtn = xDialogOpt.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) @@ -104,10 +102,7 @@ class tdf137617(UITestCase): xCalcFormulaEntry.executeAction("SELECT", tuple()) xFormulaSyntax = xDialogOpt.getChild('formulasyntax') - - props = {"TEXT": "Calc A1"} - actionProps = mkPropertyValues(props) - xFormulaSyntax.executeAction("SELECT", actionProps) + select_by_text(xFormulaSyntax, "Calc A1") xOKBtn = xDialogOpt.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) diff --git a/sc/qa/uitest/search_replace/tdf35020.py b/sc/qa/uitest/search_replace/tdf35020.py index 910c64deacb7..994bcd21a89d 100644 --- a/sc/qa/uitest/search_replace/tdf35020.py +++ b/sc/qa/uitest/search_replace/tdf35020.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 @@ -31,9 +32,7 @@ class tdf35020(UITestCase): allsheets = xDialog.getChild("allsheets") allsheets.executeAction("CLICK", tuple()) calcsearchin = xDialog.getChild("calcsearchin") - props = {"TEXT": "Formulas"} - actionProps = mkPropertyValues(props) - calcsearchin.executeAction("SELECT", actionProps) + select_by_text(calcsearchin, "Formulas") replaceall = xDialog.getChild("replaceall") replaceall.executeAction("CLICK", tuple()) xcloseBtn = xDialog.getChild("close") diff --git a/sc/qa/uitest/search_replace/tdf39917.py b/sc/qa/uitest/search_replace/tdf39917.py index 1af5b9c39fab..456e4a4acf12 100644 --- a/sc/qa/uitest/search_replace/tdf39917.py +++ b/sc/qa/uitest/search_replace/tdf39917.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 @@ -33,9 +34,7 @@ class tdf39917(UITestCase): formulasyntax = xDialogOpt.getChild("formulasyntax") #Excel R1C1 - props = {"TEXT": "Excel R1C1"} - actionProps = mkPropertyValues(props) - formulasyntax.executeAction("SELECT", actionProps) + select_by_text(formulasyntax, "Excel R1C1") xOKBtn = xDialogOpt.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) @@ -100,9 +99,7 @@ class tdf39917(UITestCase): formulasyntax = xDialogOpt.getChild("formulasyntax") #Excel R1C1 - props = {"TEXT": "Calc A1"} - actionProps = mkPropertyValues(props) - formulasyntax.executeAction("SELECT", actionProps) + select_by_text(formulasyntax, "Calc A1") xOKBtn = xDialogOpt.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) diff --git a/sc/qa/uitest/solver/solver.py b/sc/qa/uitest/solver/solver.py index 80b1f5b3698d..617b2147a7cc 100644 --- a/sc/qa/uitest/solver/solver.py +++ b/sc/qa/uitest/solver/solver.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 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 @@ -36,9 +37,7 @@ class solver(UITestCase): xref1edit.executeAction("TYPE", mkPropertyValues({"TEXT":"C2"})) xval1edit.executeAction("TYPE", mkPropertyValues({"TEXT":"C4"})) xref2edit.executeAction("TYPE", mkPropertyValues({"TEXT":"C4"})) - props = {"TEXT": "=>"} - actionProps = mkPropertyValues(props) - xop2list.executeAction("SELECT", actionProps) + select_by_text(xop2list, "=>") xval2edit.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) xOKBtn = xDialog.getChild("ok") diff --git a/sc/qa/uitest/sort/subtotals.py b/sc/qa/uitest/sort/subtotals.py index 3a48cd21335a..b17dbb73cbf4 100644 --- a/sc/qa/uitest/sort/subtotals.py +++ b/sc/qa/uitest/sort/subtotals.py @@ -11,6 +11,7 @@ from libreoffice.calc.document import get_column from uitest.uihelper.calc import enter_text_to_cell from libreoffice.calc.document import get_cell_by_position from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file class Subtotals(UITestCase): @@ -62,9 +63,7 @@ class Subtotals(UITestCase): xDialog = self.xUITest.getTopFocusWindow() # Select group by: Category xGroupBy = xDialog.getChild("group_by") - props = {"TEXT": "Category"} - actionProps = mkPropertyValues(props) - xGroupBy.executeAction("SELECT", actionProps) + select_by_text(xGroupBy, "Category") # Select calculate subtotals for the months - selected by default # Select tab options xTabs = xDialog.getChild("tabcontrol") @@ -90,9 +89,7 @@ class Subtotals(UITestCase): self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") xDialog = self.xUITest.getTopFocusWindow() xGroupBy = xDialog.getChild("group_by") - props = {"TEXT": "- none -"} - actionProps = mkPropertyValues(props) - xGroupBy.executeAction("SELECT", actionProps) + select_by_text(xGroupBy, "- none -") xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) # 2 invoke sort menu and... crash @@ -116,9 +113,7 @@ class Subtotals(UITestCase): xDialog = self.xUITest.getTopFocusWindow() # 3. Group by->Trans date xGroupBy = xDialog.getChild("group_by") - props = {"TEXT": "Trans Date"} - actionProps = mkPropertyValues(props) - xGroupBy.executeAction("SELECT", actionProps) + select_by_text(xGroupBy, "Trans Date") # 4. Tick 'Calculate subtotals for' -> Amount (grid1) xCheckListMenu = xDialog.getChild("grid1") xTreeList = xCheckListMenu.getChild("columns") @@ -132,9 +127,7 @@ class Subtotals(UITestCase): xDialog = self.xUITest.getTopFocusWindow() # 7. Group by->-none- xGroupBy = xDialog.getChild("group_by") - props = {"TEXT": "- none -"} - actionProps = mkPropertyValues(props) - xGroupBy.executeAction("SELECT", actionProps) + select_by_text(xGroupBy, "- none -") # 8. Untick 'Calculate subtotals for' -> Amount xCheckListMenu = xDialog.getChild("grid1") xTreeList = xCheckListMenu.getChild("columns") @@ -148,14 +141,10 @@ class Subtotals(UITestCase): xDialog = self.xUITest.getTopFocusWindow() # 11. Sort key 1->Post Date. sortkey1 = xDialog.getChild("sortlb") - props = {"TEXT": "Post Date"} - actionProps = mkPropertyValues(props) - sortkey1.executeAction("SELECT", actionProps) + select_by_text(sortkey1, "Post Date") # 12. Sort key 2->-undefined- sortkey2 = xDialog.getChild("sortuserlb") - props = {"TEXT": "- undefined -"} - actionProps = mkPropertyValues(props) - sortkey2.executeAction("SELECT", actionProps) + select_by_text(sortkey2, "- undefined -") # 13. Click OK xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) @@ -175,9 +164,7 @@ class Subtotals(UITestCase): xDialog = self.xUITest.getTopFocusWindow() # 4. Group by: "- none -" xGroupBy = xDialog.getChild("group_by") - props = {"TEXT": "- none -"} - actionProps = mkPropertyValues(props) - xGroupBy.executeAction("SELECT", actionProps) + select_by_text(xGroupBy, "- none -") # 5. Press "OK" and watch LibreOffice crash. xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) diff --git a/sc/qa/uitest/sort/tdf49531.py b/sc/qa/uitest/sort/tdf49531.py index de50d5880592..1d66f6a36c5a 100644 --- a/sc/qa/uitest/sort/tdf49531.py +++ b/sc/qa/uitest/sort/tdf49531.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 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 @@ -40,9 +41,7 @@ class tdf49531(UITestCase): select_pos(xTabs, "0") xSortKey1 = xDialog.getChild("sortlb") xAsc = xDialog.getChild("up") - props = {"TEXT": "Column B"} - actionProps = mkPropertyValues(props) - xSortKey1.executeAction("SELECT", actionProps) + select_by_text(xSortKey1, "Column B") xAsc.executeAction("CLICK", tuple()) xOk = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOk) diff --git a/sc/qa/uitest/sort/tdf53482.py b/sc/qa/uitest/sort/tdf53482.py index 95e2533849f0..1e6fa01b404a 100644 --- a/sc/qa/uitest/sort/tdf53482.py +++ b/sc/qa/uitest/sort/tdf53482.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 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 @@ -37,9 +38,7 @@ class tdf53482(UITestCase): xDown = xDialog.getChild("down") xDown.executeAction("CLICK", tuple()) xSortKey1 = xDialog.getChild("sortlb") - props = {"TEXT": "Occupation"} - actionProps = mkPropertyValues(props) - xSortKey1.executeAction("SELECT", actionProps) + select_by_text(xSortKey1, "Occupation") #5. Click Ok xOK = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOK) @@ -89,4 +88,4 @@ class tdf53482(UITestCase): 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/sc/qa/uitest/sort/tdf54018.py b/sc/qa/uitest/sort/tdf54018.py index ea9fc2994e2e..db5085e9266c 100644 --- a/sc/qa/uitest/sort/tdf54018.py +++ b/sc/qa/uitest/sort/tdf54018.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 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 @@ -29,9 +30,7 @@ class tdf54018(UITestCase): select_pos(xTabs, "0") xSortKey1 = xDialog.getChild("sortlb") xdown = xDialog.getChild("down") - props = {"TEXT": "Column B"} - actionProps = mkPropertyValues(props) - xSortKey1.executeAction("SELECT", actionProps) + select_by_text(xSortKey1, "Column B") xdown.executeAction("CLICK", tuple()) xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) @@ -47,4 +46,4 @@ class tdf54018(UITestCase): 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/sc/qa/uitest/sort/tdf99208.py b/sc/qa/uitest/sort/tdf99208.py index f590b9f2063e..1b9680a19cb7 100644 --- a/sc/qa/uitest/sort/tdf99208.py +++ b/sc/qa/uitest/sort/tdf99208.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 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 @@ -42,9 +43,7 @@ class tdf99208(UITestCase): select_pos(xTabs, "0") xSortKey1 = xDialog.getChild("sortlb") xAsc = xDialog.getChild("up") - props = {"TEXT": "FODMAP"} - actionProps = mkPropertyValues(props) - xSortKey1.executeAction("SELECT", actionProps) + select_by_text(xSortKey1, "FODMAP") xAsc.executeAction("CLICK", tuple()) xOk = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOk) @@ -62,4 +61,4 @@ class tdf99208(UITestCase): 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/sc/qa/uitest/validity/tdf138134.py b/sc/qa/uitest/validity/tdf138134.py index 6d660019d15e..1bbdc443d60e 100644 --- a/sc/qa/uitest/validity/tdf138134.py +++ b/sc/qa/uitest/validity/tdf138134.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 @@ -35,13 +36,9 @@ class DetectiveCircle(UITestCase): xmin = xDialog.getChild("min") xmax = xDialog.getChild("max") - props = {"TEXT": "Whole Numbers"} - actionProps = mkPropertyValues(props) - xallow.executeAction("SELECT", actionProps) + select_by_text(xallow, "Whole Numbers") xallowempty.executeAction("CLICK", tuple()) - propsA = {"TEXT": "equal"} - actionPropsA = mkPropertyValues(propsA) - xdata.executeAction("SELECT", actionPropsA) + select_by_text(xdata, "equal") xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"5"})) xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) diff --git a/sc/qa/uitest/validity/tdf53920.py b/sc/qa/uitest/validity/tdf53920.py index 221922d4b2d7..e1a4fc87efaa 100644 --- a/sc/qa/uitest/validity/tdf53920.py +++ b/sc/qa/uitest/validity/tdf53920.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 @@ -35,9 +36,7 @@ class tdf53920(UITestCase): xallow = xDialog.getChild("allow") xmin = xDialog.getChild("min") - props = {"TEXT": "Cell range"} - actionProps = mkPropertyValues(props) - xallow.executeAction("SELECT", actionProps) + select_by_text(xallow, "Cell range") xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$C$1:$C$3"})) xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) diff --git a/sc/qa/uitest/validity/tdf65686.py b/sc/qa/uitest/validity/tdf65686.py index e2bc037c3837..557701b1dd7f 100644 --- a/sc/qa/uitest/validity/tdf65686.py +++ b/sc/qa/uitest/validity/tdf65686.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 tdf65686(UITestCase): xallowempty = xDialog.getChild("allowempty") minlist = xDialog.getChild("minlist") - props = {"TEXT": "List"} - actionProps = mkPropertyValues(props) - xallow.executeAction("SELECT", actionProps) + select_by_text(xallow, "List") minlist.executeAction("TYPE", mkPropertyValues({"TEXT":"Aap"})) minlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) minlist.executeAction("TYPE", mkPropertyValues({"TEXT":"Noot"})) diff --git a/sc/qa/uitest/validity/tdf96698.py b/sc/qa/uitest/validity/tdf96698.py index c219e044478d..a3bd19c2f3ef 100644 --- a/sc/qa/uitest/validity/tdf96698.py +++ b/sc/qa/uitest/validity/tdf96698.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 @@ -29,9 +30,7 @@ class tdf96698(UITestCase): xallowempty = xDialog.getChild("allowempty") xmin = xDialog.getChild("min") - props = {"TEXT": "Custom"} - actionProps = mkPropertyValues(props) - xallow.executeAction("SELECT", actionProps) + select_by_text(xallow, "Custom") xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"ISERROR(FIND(\",\",B2))"})) xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) @@ -57,9 +56,7 @@ class tdf96698(UITestCase): xallowempty = xDialog.getChild("allowempty") xmin = xDialog.getChild("min") - props = {"TEXT": "Custom"} - actionProps = mkPropertyValues(props) - xallow.executeAction("SELECT", actionProps) + select_by_text(xallow, "Custom") xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"NOT(ISERROR(B3))"})) xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) @@ -85,9 +82,7 @@ class tdf96698(UITestCase): xallowempty = xDialog.getChild("allowempty") xmin = xDialog.getChild("min") - props = {"TEXT": "Custom"} - actionProps = mkPropertyValues(props) - xallow.executeAction("SELECT", actionProps) + select_by_text(xallow, "Custom") xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"ISERROR(FIND(\",\",A7))"})) xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) @@ -113,9 +108,7 @@ class tdf96698(UITestCase): xallowempty = xDialog.getChild("allowempty") xmin = xDialog.getChild("min") - props = {"TEXT": "Custom"} - actionProps = mkPropertyValues(props) - xallow.executeAction("SELECT", actionProps) + select_by_text(xallow, "Custom") xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"NOT(ISERROR(A8))"})) xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) diff --git a/sc/qa/uitest/validity/validity.py b/sc/qa/uitest/validity/validity.py index 93cd2461e7a7..dc36e96f87df 100644 --- a/sc/qa/uitest/validity/validity.py +++ b/sc/qa/uitest/validity/validity.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 @@ -29,13 +30,9 @@ class validity(UITestCase): xmin = xDialog.getChild("min") xmax = xDialog.getChild("max") - props = {"TEXT": "Whole Numbers"} - actionProps = mkPropertyValues(props) - xallow.executeAction("SELECT", actionProps) + select_by_text(xallow, "Whole Numbers") xallowempty.executeAction("CLICK", tuple()) - propsA = {"TEXT": "valid range"} - actionPropsA = mkPropertyValues(propsA) - xdata.executeAction("SELECT", actionPropsA) + select_by_text(xdata, "valid range") xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) xmax.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) xOKBtn = xDialog.getChild("ok") @@ -114,9 +111,7 @@ class validity(UITestCase): xerroralerttitle = xDialog.getChild("erroralert_title") xerrorMsg = xDialog.getChild("errorMsg") - props = {"TEXT": "Warning"} - actionProps = mkPropertyValues(props) - xactionCB.executeAction("SELECT", actionProps) + select_by_text(xactionCB, "Warning") xerroralerttitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Warn"})) xerrorMsg.executeAction("TYPE", mkPropertyValues({"TEXT":"Warn2"})) xOKBtn = xDialog.getChild("ok") |