summaryrefslogtreecommitdiff
path: root/uitest
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-02-24 18:34:27 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-02-24 19:47:47 +0100
commit8e8236500ce862ce27acbbfc7bbeab545931798e (patch)
treec7277b8836dc8be8e032dc8670a2b91097c84c6d /uitest
parent2baf13e903164e92af6c87346e368043bbd09b28 (diff)
uitest: try harder to close the dialog when it fails ...
... and close_button is empty This was introduced in 2021-06-29 15:35:55 - ff641dc9e4d2aff1d1cbe4425cd9c03a2edc847e < uitest: try harder to close the dialog when it fails... > and later reverted in 2021-07-02 20:41:50 - 4f8748fc973acdb67790ff048a247717afa9b9c7 < Revert "uitest: try harder to close the dialog when it fails..." > Reintroduce it again and also fix the problem why it was reverted. Without this fix, it will hang when an assert is triggered inside a dialog when close_button is empty Change-Id: If643caea61139f69f72c9b429aaad5b9d7d78c72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130506 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'uitest')
-rw-r--r--uitest/uitest/test.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py
index 3beee0d274f2..11cb15dab9c8 100644
--- a/uitest/uitest/test.py
+++ b/uitest/uitest/test.py
@@ -133,6 +133,11 @@ class UITest(object):
xDialog = self._xUITest.getTopFocusWindow()
try:
yield xDialog
+ except:
+ if not close_button:
+ if 'cancel' in xDialog.getChildren():
+ self.close_dialog_through_button(xDialog.getChild("cancel"))
+ raise
finally:
if close_button:
self.close_dialog_through_button(xDialog.getChild(close_button))
@@ -259,6 +264,11 @@ class UITest(object):
xDialog = self._xUITest.getTopFocusWindow()
try:
yield xDialog
+ except:
+ if not close_button:
+ if 'cancel' in xDialog.getChildren():
+ self.close_dialog_through_button(xDialog.getChild("cancel"))
+ raise
finally:
if close_button:
self.close_dialog_through_button(xDialog.getChild(close_button))