diff options
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/uitest/test.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py index 2860c0283403..372095880ba7 100644 --- a/uitest/uitest/test.py +++ b/uitest/uitest/test.py @@ -17,6 +17,11 @@ class DialogNotExecutedException(Exception): def __str__(self): return "Dialog not executed for: " + self.command +class DialogNotClosedException(Exception): + + def __str__(self): + return "Dialog was not closed" + class UITest(object): def __init__(self, xUITest, xContext): @@ -105,6 +110,18 @@ class UITest(object): # report a failure here + def close_dialog_through_button(self, button): + with EventListener(self._xContext, "DialogClosed" ) as event: + button.executeAction("CLICK", tuple()) + time_ = 0 + while time_ < 30: + if event.executed: + time.sleep(DEFAULT_SLEEP) + return + time_ += DEFAULT_SLEEP + time.sleep(DEFAULT_SLEEP) + raise DialogNotClosedException() + def close_doc(self): with EventListener(self._xContext, ["DialogExecute", "OnViewClosed"] ) as event: self._xUITest.executeCommand(".uno:CloseDoc") |