From 144edb88d29d397604010734f2d6c2e9d7626d1c Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Tue, 13 Jun 2017 05:17:12 +0200 Subject: uitest: extract the wait time for the dialogs Change-Id: Ieb82b643de58523cef30f88363276874b6169021 --- uitest/uitest/config.py | 2 ++ uitest/uitest/test.py | 17 +++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'uitest') diff --git a/uitest/uitest/config.py b/uitest/uitest/config.py index 890d88475b94..4ba4146a15a8 100644 --- a/uitest/uitest/config.py +++ b/uitest/uitest/config.py @@ -9,4 +9,6 @@ use_sleep = False DEFAULT_SLEEP = 0.1 +MAX_WAIT = 30 + # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py index e17149251c03..04168c48ae2a 100644 --- a/uitest/uitest/test.py +++ b/uitest/uitest/test.py @@ -8,6 +8,7 @@ import time import threading from uitest.config import DEFAULT_SLEEP +from uitest.config import MAX_WAIT from uitest.uihelper.common import get_state_as_dict from com.sun.star.uno import RuntimeException @@ -57,7 +58,7 @@ class UITest(object): with EventListener(self._xContext, "OnLoad") as event: component = desktop.loadComponentFromURL(url, "_default", 0, tuple()) time_ = 0 - while time_ < 30: + while time_ < MAX_WAIT: if event.executed: frames = self.get_frames() if len(frames) == 1: @@ -71,7 +72,7 @@ class UITest(object): with EventListener(self._xContext, "DialogExecute") as event: self._xUITest.executeDialog(command) time_ = 0 - while time_ < 30: + while time_ < MAX_WAIT: if event.executed: time.sleep(DEFAULT_SLEEP) return @@ -84,7 +85,7 @@ class UITest(object): with EventListener(self._xContext, "ModelessDialogVisible") as event: self._xUITest.executeCommand(command) time_ = 0 - while time_ < 30: + while time_ < MAX_WAIT: if event.executed: time.sleep(DEFAULT_SLEEP) return @@ -100,7 +101,7 @@ class UITest(object): with EventListener(self._xContext, event_name) as event: ui_object.executeAction(action, parameters) time_ = 0 - while time_ < 30: + while time_ < MAX_WAIT: if event.executed: time.sleep(DEFAULT_SLEEP) return @@ -132,7 +133,7 @@ class UITest(object): with EventListener(self._xContext, "OnNew") as event: xBtn.executeAction("CLICK", tuple()) time_ = 0 - while time_ < 30: + while time_ < MAX_WAIT: if event.executed: frames = self.get_frames() self.get_desktop().setActiveFrame(frames[0]) @@ -149,7 +150,7 @@ class UITest(object): with EventListener(self._xContext, "DialogClosed" ) as event: button.executeAction("CLICK", tuple()) time_ = 0 - while time_ < 30: + while time_ < MAX_WAIT: if event.executed: time.sleep(DEFAULT_SLEEP) return @@ -161,7 +162,7 @@ class UITest(object): with EventListener(self._xContext, ["DialogExecute", "OnViewClosed"] ) as event: self._xUITest.executeDialog(".uno:CloseDoc") time_ = 0 - while time_ < 30: + while time_ < MAX_WAIT: if event.hasExecuted("DialogExecute"): xCloseDlg = self._xUITest.getTopFocusWindow() xNoBtn = xCloseDlg.getChild("discard") @@ -178,7 +179,7 @@ class UITest(object): with EventListener(self._xContext, ["DialogExecute", "ModelessDialogExecute"]) as event: thread.start() time_ = 0 - while time_ < 30: + while time_ < MAX_WAIT: if event.executed: xDlg = self._xUITest.getTopFocusWindow() xUIElement = xDlg.getChild(dialog_element) -- cgit