summaryrefslogtreecommitdiff
path: root/sc/qa/uitest/calc_dialogs/openDialogs.py
diff options
context:
space:
mode:
authorArtur Neumann <artur@jankaritech.com>2019-07-05 15:36:30 +0545
committerZdenek Crhonek <zcrhonek@gmail.com>2019-07-26 08:18:22 +0200
commit271dcc757d536718795f8c24a686a75424e90f23 (patch)
tree49101f22cfecfb90b5a6aec3a435bd9d32a7d1f1 /sc/qa/uitest/calc_dialogs/openDialogs.py
parentaef615ac9c69775bf51d5bf77d62686244f586af (diff)
UI tests opening all dialogs in writer and see if it crashes
Open a dialog, close it by the given button e.g. "cancel" or "close". If the dialog has an enabled "OK" button open the dialog again and try to close it also using the OK button. For every dialog a complete new document is opened to ensure test-separation, otherwise one action could hamper the next action. For dialogs that already have other tests a "cancel/close" test was added to the previous test. As far as possible opening new documents was avoided in those cases. And in some cases a simple check was added to check if the "cancel" button does not change anything. Simmilar tests for calc have been renamed and code dublication has been removed by moving main part of the code to a helper file Change-Id: I01f197cae8bc6fe0345661fe042b655f16229485 Reviewed-on: https://gerrit.libreoffice.org/75124 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
Diffstat (limited to 'sc/qa/uitest/calc_dialogs/openDialogs.py')
-rw-r--r--sc/qa/uitest/calc_dialogs/openDialogs.py180
1 files changed, 180 insertions, 0 deletions
diff --git a/sc/qa/uitest/calc_dialogs/openDialogs.py b/sc/qa/uitest/calc_dialogs/openDialogs.py
new file mode 100644
index 000000000000..94a7ca916c14
--- /dev/null
+++ b/sc/qa/uitest/calc_dialogs/openDialogs.py
@@ -0,0 +1,180 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+from uitest.framework import UITestCase
+import unittest
+from uitest.uihelper.testDialog import testDialog
+
+dialogs = [
+ {"command": ".uno:OpenRemote", "closeButton": "cancel"},
+ {"command": ".uno:SaveAsTemplate", "closeButton": "cancel"},
+ {"command": ".uno:SaveAsRemote", "closeButton": "cancel"},
+ {"command": ".uno:ExportToPDF", "closeButton": "cancel", "skipTestOK": True},
+ # export needs filesystem
+ {"command": ".uno:Print", "closeButton": "cancel", "skipTestOK": True},
+ # no printer in CI
+ {"command": ".uno:PrinterSetup", "closeButton": "cancel"},
+ # {"command": ".uno:SetDocumentProperties", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests/documentProperties.py
+ # {"command": ".uno:PasteSpecial", "closeButton": "cancel"},
+ # would need to copy first something into the clipboard
+ # {"command": ".uno:SearchDialog", "closeButton": "close"},
+ # tested in sc/qa/uitest/search_replace/*
+ # {"command": ".uno:InsertObjectChart", "closeButton": "cancel"},
+ # tested in uitest/calc_tests/create_chart.py
+ {"command": ".uno:DataDataPilotRun", "closeButton": "cancel", "skipTestOK": True},
+ # OK button triggers a new dialog
+ # {"command": ".uno:FunctionDialog", "closeButton": "cancel"},
+ # Cancel button tested in uitest/calc_tests/function_wizard.py
+ # OK button tested in sc/qa/uitest/calc_tests7/tdf123479.py
+ {"command": ".uno:InsertName", "closeButton": "close"},
+ {"command": ".uno:InsertObjectFloatingFrame", "closeButton": "cancel"},
+ {"command": ".uno:FontworkGalleryFloater", "closeButton": "cancel"},
+ # {"command": ".uno:HyperlinkDialog", "closeButton": "ok"},
+ # dialog opens but is not recognised by execute_dialog_through_command
+ {"command": ".uno:InsertSymbol", "closeButton": "cancel"},
+ {"command": ".uno:EditHeaderAndFooter", "closeButton": "cancel"},
+ # {"command": ".uno:InsertSignatureLine", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/signatureLine/insertSignatureLine.py
+ # {"command": ".uno:FormatCellDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests/formatCells.py
+ # {"command": ".uno:RowHeight", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests/rows.py
+ {"command": ".uno:SetOptimalRowHeight", "closeButton": "cancel"},
+ # {"command": ".uno:ColumnWidth", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests/columns.py
+ {"command": ".uno:SetOptimalColumnWidth", "closeButton": "cancel"},
+ # {"command": ".uno:PageFormatDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/pageFormat/tdf123508.py
+ {"command": ".uno:EditPrintArea", "closeButton": "cancel", "skipTestOK": True},
+ # tested in sc/qa/uitest/calc_tests/printRange.py
+ # {"command": ".uno:ConditionalFormatMenu", "closeButton": "cancel"},
+ # dialog does not open
+ # {"command": ".uno:AutoFormat", "closeButton": "cancel"},
+ # dialog does not open
+ # {"command": ".uno:ChooseDesign", "closeButton": "cancel"},
+ # dialog opens but is not recognised by execute_dialog_through_command
+ {"command": ".uno:StyleNewByExample", "closeButton": "cancel"},
+ {"command": ".uno:InsertCell", "closeButton": "cancel"},
+ {"command": ".uno:DeleteCell", "closeButton": "cancel"},
+ {"command": ".uno:Insert", "closeButton": "cancel", "skipTestOK": True},
+ # OK button tested in uitest/calc_tests/gridwin.py
+ {"command": ".uno:Add", "closeButton": "cancel"},
+ # {"command": ".uno:InsertExternalDataSource", "closeButton": "cancel"},
+ # dialog opens and closes, but is not recognized as closed by close_dialog_through_button
+ # {"command": ".uno:Delete", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests3/clearCells.py
+ # {"command": ".uno:RandomNumberGeneratorDialog", "closeButton": "close"},
+ # tested in sc/qa/uitest/calc_tests/fillRandomNumber.py
+ # {"command": ".uno:AddName", "closeButton": "cancel"},
+ # Cancel button tested in uitest/demo_ui/edit.py
+ # "add" button tested in uitest/calc_tests/create_range_name.py
+ {"command": ".uno:DefineName", "closeButton": "cancel"},
+ # {"command": ".uno:SheetInsertName", "closeButton": "close"},
+ # dialog does not open
+ {"command": ".uno:CreateNames", "closeButton": "cancel", "skipTestOK": True},
+ # OK button triggers a new dialog
+ {"command": ".uno:DefineLabelRange", "closeButton": "cancel"},
+ # {"command": ".uno:RenameTable", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests/sheetRename.py
+ # {"command": ".uno:Move", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests6/moveCopySheet.py
+ {"command": ".uno:SetTabBgColor", "closeButton": "cancel"},
+ {"command": ".uno:TableEvents", "closeButton": "cancel"},
+ # {"command": ".uno:DataSort", "closeButton": "cancel"},
+ # cancel button tested in sc/qa/uitest/calc_tests/sorting.py
+ # OK button tested in sc/qa/uitest/calc_tests/naturalSort.py
+ # {"command": ".uno:DataFilterAutoFilter", "closeButton": "ok", "skipTestOK": True},
+ # tested in sc/qa/uitest/autofilter/autofilterBugs.py
+ # {"command": ".uno:DataFilterStandardFilter", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests2/standardFilter.py
+ {"command": ".uno:DataFilterSpecialFilter", "closeButton": "cancel", "skipTestOK": True},
+ # OK button triggers a new dialog
+ # {"command": ".uno:DefineDBName", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/range_name/tdf119954.py
+ {"command": ".uno:SelectDB", "closeButton": "cancel"},
+ # {"command": ".uno:InsertPivotTable", "closeButton": "cancel"},
+ # dialog does not open
+ # {"command": ".uno:Validation", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/validity/validity.py
+ # {"command": ".uno:DataSubTotals", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests2/subtotals.py
+ {"command": ".uno:DataForm", "closeButton": "close"},
+ # {"command": ".uno:DataConsolidate", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests2/consolidate.py
+ {"command": ".uno:Group", "closeButton": "cancel"},
+ # {"command": ".uno:SamplingDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/sampling.py
+ # {"command": ".uno:DescriptiveStatisticsDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/descriptiveStatistics.py
+ # {"command": ".uno:AnalysisOfVarianceDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/anova.py
+ # {"command": ".uno:CorrelationDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/correlation.py
+ # {"command": ".uno:CovarianceDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/covariance.py
+ # {"command": ".uno:ExponentialSmoothingDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/exponentialSmoothing.py
+ # {"command": ".uno:MovingAverageDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/movingAverage.py
+ # {"command": ".uno:RegressionDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/regression.py
+ # {"command": ".uno:TTestDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/tTest.py
+ # {"command": ".uno:FTestDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/fTest.py
+ # {"command": ".uno:ZTestDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/zTest.py
+ # {"command": ".uno:ChiSquareTestDialog", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/statistics/chiSquare.py:53
+ {"command": ".uno:FourierAnalysisDialog", "closeButton": "cancel"},
+ # {"command": ".uno:SpellDialog", "closeButton": "close"},
+ # an extra dialog appears
+ {"command": ".uno:Hyphenate", "closeButton": "cancel"},
+ {"command": ".uno:ChineseConversion", "closeButton": "cancel"},
+ # {"command": ".uno:AutoCorrectDlg", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests6/autocorrectOptions.py
+ {"command": ".uno:GoalSeekDialog", "closeButton": "cancel", "skipTestOK": True},
+ # OK button triggers a new dialog
+ {"command": ".uno:SolverDialog", "closeButton": "close", "skipTestOK": True},
+ # OK button triggers a new dialog
+ # {"command": ".uno:ShareDocument", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/calc_tests6/shareSpreadsheet.py
+ # {"command": ".uno:Protect", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/protect/protectSheet.py
+ # {"command": ".uno:ToolProtectionDocument", "closeButton": "cancel"},
+ # tested in sc/qa/uitest/protect/protectSpreadsheet.py
+ {"command": ".uno:RunMacro", "closeButton": "cancel"},
+ {"command": ".uno:ScriptOrganizer", "closeButton": "close"},
+ {"command": ".uno:ShowLicense", "closeButton": "close"},
+ # {"command": ".uno:About", "closeButton": "close"},
+ # tested in sc/qa/uitest/calc_tests7/tdf106667.py
+]
+
+
+def load_tests(loader, tests, pattern):
+ return unittest.TestSuite(openDialogs(dialog)
+ for dialog in dialogs)
+
+# Test to open all listed dialogs one by one, close it with the given close button
+# and if there is an "OK" button open the dialog again and close it by using the OK button
+# the test only checks if calc crashes by opening the dialog, see e.g. tdf#120227, tdf#125985, tdf#125982
+class openDialogs(UITestCase):
+ def check(self, dialog):
+ testDialog(self, "calc", dialog)
+
+dialogCount = 0
+for dialog in dialogs:
+ dialogCount = dialogCount + 1
+
+
+ def ch(dialog):
+ return lambda self: self.check(dialog)
+
+
+ setattr(openDialogs, "test_%02d_%s" % (dialogCount, dialog["command"]), ch(dialog))
+# vim: set shiftwidth=4 softtabstop=4 expandtab: