parent
96a2310df0
commit
c85cead983
|
@ -28,12 +28,24 @@ _MAX_WAIT_OBJ_TIMEOUT = 5000
|
||||||
# The default minimum timeout to find ui object
|
# The default minimum timeout to find ui object
|
||||||
_MIN_WAIT_OBJ_TIMEOUT = 500
|
_MIN_WAIT_OBJ_TIMEOUT = 500
|
||||||
|
|
||||||
|
# The default maximum time to application load
|
||||||
|
_MAX_WAIT_APP_TIMEOUT = 15000
|
||||||
|
|
||||||
_SEARCH_IMAGES_PATH = "../shared/searchImages/"
|
_SEARCH_IMAGES_PATH = "../shared/searchImages/"
|
||||||
|
|
||||||
|
|
||||||
def start_application(app_name: str):
|
def start_application(app_name: str, attempt=2):
|
||||||
squish.startApplication(app_name)
|
try:
|
||||||
toplevelwindow.ToplevelWindow(squish.waitForObject(names.statusDesktop_mainWindow)).maximize()
|
ctx = squish.startApplication(app_name)
|
||||||
|
assert squish.waitFor(lambda: ctx.isRunning, _MAX_WAIT_APP_TIMEOUT), 'Start application error'
|
||||||
|
toplevelwindow.ToplevelWindow(squish.waitForObject(names.statusDesktop_mainWindow)).maximize()
|
||||||
|
except (AssertionError, RuntimeError):
|
||||||
|
if attempt:
|
||||||
|
[ctx.detach() for ctx in squish.applicationContextList()]
|
||||||
|
time.sleep(1)
|
||||||
|
start_application(app_name, attempt - 1)
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
# Waits for the given object is loaded, visible and enabled.
|
# Waits for the given object is loaded, visible and enabled.
|
||||||
|
|
|
@ -14,8 +14,9 @@ def hook(context):
|
||||||
|
|
||||||
@OnScenarioEnd
|
@OnScenarioEnd
|
||||||
def hook(context):
|
def hook(context):
|
||||||
currentApplicationContext().detach()
|
ctx = currentApplicationContext()
|
||||||
snooze(_app_closure_timeout)
|
ctx.detach()
|
||||||
|
assert waitFor(lambda: not ctx.isRunning, _app_closure_timeout), 'Detach application failed'
|
||||||
|
|
||||||
@OnStepEnd
|
@OnStepEnd
|
||||||
def hook(context):
|
def hook(context):
|
||||||
|
|
Loading…
Reference in New Issue