updated polling so we wont timeout
This commit is contained in:
@@ -177,6 +177,7 @@ def wait_for_export(app, ctrl, timeouts, log):
|
|||||||
4. Dismiss it by clicking OK
|
4. Dismiss it by clicking OK
|
||||||
"""
|
"""
|
||||||
progress = app.window(title=ctrl["progress_title"], class_name=ctrl["progress_class"])
|
progress = app.window(title=ctrl["progress_title"], class_name=ctrl["progress_class"])
|
||||||
|
saved = app.window(title=ctrl["saved_title"], class_name=ctrl["saved_class"])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
progress.wait("visible", timeout=timeouts["progress_appear"])
|
progress.wait("visible", timeout=timeouts["progress_appear"])
|
||||||
@@ -185,15 +186,19 @@ def wait_for_export(app, ctrl, timeouts, log):
|
|||||||
log(" NOTE: progress dialog not seen; checking for confirmation dialog "
|
log(" NOTE: progress dialog not seen; checking for confirmation dialog "
|
||||||
"(drawer may have exported very quickly).")
|
"(drawer may have exported very quickly).")
|
||||||
|
|
||||||
try:
|
# Poll until the confirmation dialog appears OR we time out.
|
||||||
progress.wait_not("visible", timeout=timeouts["progress_finish"])
|
# We do NOT rely on wait_not for the progress dialog because it can
|
||||||
except timings.TimeoutError:
|
# briefly disappear and reappear during long exports.
|
||||||
|
deadline = time.time() + timeouts["progress_finish"]
|
||||||
|
while time.time() < deadline:
|
||||||
|
# Check if the confirmation dialog has appeared
|
||||||
|
if saved.exists(timeout=0):
|
||||||
|
break
|
||||||
|
time.sleep(2)
|
||||||
|
else:
|
||||||
log(f" ERROR: export did not finish within {timeouts['progress_finish']}s.")
|
log(f" ERROR: export did not finish within {timeouts['progress_finish']}s.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Look for the confirmation dialog — try multiple times with short waits
|
|
||||||
# since there can be a delay between progress closing and confirmation appearing.
|
|
||||||
saved = app.window(title=ctrl["saved_title"], class_name=ctrl["saved_class"])
|
|
||||||
try:
|
try:
|
||||||
saved.wait("visible ready", timeout=timeouts["confirm"])
|
saved.wait("visible ready", timeout=timeouts["confirm"])
|
||||||
log(" Confirmation dialog appeared - export succeeded.")
|
log(" Confirmation dialog appeared - export succeeded.")
|
||||||
|
|||||||
Reference in New Issue
Block a user