From 1a20e663322d0c37e985df1b9cefdb4827ed74ef Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sat, 16 Jul 2016 17:35:29 +0200 Subject: uitest: provide a way to open a dialog through an action on an object This allows for example to open a dialog through clicking on a button or through a chart command. Change-Id: Iaca6faa3a1b26f4f677a3a670e2c9891373524d3 --- uitest/uitest/test.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'uitest') diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py index 05e5c91422ba..4eb8c846c050 100644 --- a/uitest/uitest/test.py +++ b/uitest/uitest/test.py @@ -49,6 +49,21 @@ class UITest(object): raise DialogNotExecutedException(command) + def execute_dialog_through_action(self, ui_object, action, parameters = None): + if parameters is None: + parameters = tuple() + + with EventListener(self._xContext, "DialogExecute") as event: + ui_object.executeAction(action, parameters) + time_ = 0 + while time_ < 30: + if event.executed: + time.sleep(DEFAULT_SLEEP) + return + time_ += DEFAULT_SLEEP + time.sleep(DEFAULT_SLEEP) + raise DialogNotExecutedException(command) + def create_doc_in_start_center(self, app): xStartCenter = self._xUITest.getTopFocusWindow() xBtn = xStartCenter.getChild(app + "_all") -- cgit