[Libreoffice-commits] core.git: uitest/uitest

Markus Mohrhard markus.mohrhard at googlemail.com
Mon Feb 27 09:45:34 UTC 2017


 uitest/uitest/test.py |   23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 48c8675b030ec597f3f7430963841901dbececff
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Feb 27 04:07:01 2017 +0100

    uitest: handle crash reporter dialog correctly during start-up
    
    Change-Id: I1db54ad2ad38642ac84211fd6d6505e171fc4423
    Reviewed-on: https://gerrit.libreoffice.org/34671
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py
index 2de8b31..e171492 100644
--- a/uitest/uitest/test.py
+++ b/uitest/uitest/test.py
@@ -8,6 +8,9 @@
 import time
 import threading
 from uitest.config import DEFAULT_SLEEP
+from uitest.uihelper.common import get_state_as_dict
+
+from com.sun.star.uno import RuntimeException
 
 from libreoffice.uno.eventlistener import EventListener
 
@@ -105,9 +108,27 @@ class UITest(object):
                 time.sleep(DEFAULT_SLEEP)
         raise DialogNotExecutedException(action)
 
+    def _handle_crash_reporter(self):
+        xCrashReportDlg = self._xUITest.getTopFocusWindow()
+        state = get_state_as_dict(xCrashReportDlg)
+        print(state)
+        if state['ID'] == "CrashReportDialog":
+            print("found a crash reporter")
+            xCancelBtn = xCrashReportDlg.getChild("btn_cancel")
+            self.close_dialog_through_button(xCancelBtn)
+        else:
+            raise RuntimeException("not a crashreporter")
+
     def create_doc_in_start_center(self, app):
         xStartCenter = self._xUITest.getTopFocusWindow()
-        xBtn = xStartCenter.getChild(app + "_all")
+        try:
+            xBtn = xStartCenter.getChild(app + "_all")
+        except RuntimeException:
+            print("Handled crash reporter")
+            self._handle_crash_reporter()
+            xStartCenter = self._xUITest.getTopFocusWindow()
+            xBtn = xStartCenter.getChild(app + "_all")
+
         with EventListener(self._xContext, "OnNew") as event:
             xBtn.executeAction("CLICK", tuple())
             time_ = 0


More information about the Libreoffice-commits mailing list