summaryrefslogtreecommitdiff
path: root/uitest
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 /uitest
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 'uitest')
-rw-r--r--uitest/uitest/uihelper/testDialog.py39
-rw-r--r--uitest/writer_tests/goToPage.py8
-rw-r--r--uitest/writer_tests/insertBreakDialog.py13
-rw-r--r--uitest/writer_tests/insertTableDialog.py9
-rw-r--r--uitest/writer_tests/pageDialog.py10
5 files changed, 79 insertions, 0 deletions
diff --git a/uitest/uitest/uihelper/testDialog.py b/uitest/uitest/uihelper/testDialog.py
new file mode 100644
index 000000000000..43f0a5bc0794
--- /dev/null
+++ b/uitest/uitest/uihelper/testDialog.py
@@ -0,0 +1,39 @@
+# -*- 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
+from uitest.uihelper.common import get_state_as_dict
+
+# opens the dialogs, closes 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 LibreOffice crashes by opening the dialog
+def testDialog(UITestCase, app, dialog):
+ doc = UITestCase.ui_test.create_doc_in_start_center(app)
+ UITestCase.ui_test.execute_dialog_through_command(dialog['command'])
+ xDialog = UITestCase.xUITest.getTopFocusWindow()
+
+ xCloseBtn = xDialog.getChild(dialog['closeButton'])
+ if 'skipTestOK' in dialog and dialog['skipTestOK'] == True:
+ xOKBtn = None
+ else:
+ try:
+ xOKBtn = xDialog.getChild("ok")
+ if (get_state_as_dict(xOKBtn)["Enabled"] != "true"):
+ xOKBtn = None
+ except:
+ xOKBtn = None
+
+ UITestCase.ui_test.close_dialog_through_button(xCloseBtn)
+ if (xOKBtn != None):
+ print("check also OK button")
+ UITestCase.ui_test.execute_dialog_through_command(dialog['command'])
+ xDialog = UITestCase.xUITest.getTopFocusWindow()
+ xOKBtn = xDialog.getChild("ok")
+ UITestCase.ui_test.close_dialog_through_button(xOKBtn)
+ UITestCase.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/writer_tests/goToPage.py b/uitest/writer_tests/goToPage.py
index 63a21f04d840..d20f042dfb9a 100644
--- a/uitest/writer_tests/goToPage.py
+++ b/uitest/writer_tests/goToPage.py
@@ -37,4 +37,12 @@ class GoToPage_dialog(UITestCase):
self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
+ # check cancel button
+ self.ui_test.execute_dialog_through_command(".uno:GotoPage")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
+
self.ui_test.close_doc()
diff --git a/uitest/writer_tests/insertBreakDialog.py b/uitest/writer_tests/insertBreakDialog.py
index 1ec61aff2368..291ffdac53b4 100644
--- a/uitest/writer_tests/insertBreakDialog.py
+++ b/uitest/writer_tests/insertBreakDialog.py
@@ -69,4 +69,17 @@ class WriterInsertBreakDialog(UITestCase):
self.ui_test.close_doc()
+ def test_cancel_button_insert_line_break_dialog(self):
+
+ self.ui_test.create_doc_in_start_center("writer")
+
+ self.ui_test.execute_dialog_through_command(".uno:InsertBreak")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.getPages(1)
+
+ self.ui_test.close_doc()
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/writer_tests/insertTableDialog.py b/uitest/writer_tests/insertTableDialog.py
index 60bd9d3342a6..60d427954a4c 100644
--- a/uitest/writer_tests/insertTableDialog.py
+++ b/uitest/writer_tests/insertTableDialog.py
@@ -118,4 +118,13 @@ class WriterInsertTableDialog(UITestCase):
self.ui_test.close_doc()
+ def test_cancel_button_insert_line_break_dialog(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ self.ui_test.execute_dialog_through_command(".uno:InsertTable")
+ Dialog = self.xUITest.getTopFocusWindow()
+ CancelBtn = Dialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(CancelBtn)
+
+ self.ui_test.close_doc()
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/writer_tests/pageDialog.py b/uitest/writer_tests/pageDialog.py
index 8165008d4f2b..233c269d891f 100644
--- a/uitest/writer_tests/pageDialog.py
+++ b/uitest/writer_tests/pageDialog.py
@@ -226,4 +226,14 @@ class WriterPageDialog(UITestCase):
self.ui_test.close_doc()
+ def test_cancel_button_page_dialog(self):
+ self.ui_test.create_doc_in_start_center("writer")
+
+ self.ui_test.execute_dialog_through_command(".uno:PageDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.ui_test.close_doc()
+
# vim: set shiftwidth=4 softtabstop=4 expandtab: