updated polling so we wont timeout

This commit is contained in:
2026-07-06 23:50:22 -05:00
parent 65947638cb
commit acfe5de23a

View File

@@ -177,6 +177,7 @@ def wait_for_export(app, ctrl, timeouts, log):
4. Dismiss it by clicking OK
"""
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:
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 "
"(drawer may have exported very quickly).")
try:
progress.wait_not("visible", timeout=timeouts["progress_finish"])
except timings.TimeoutError:
# Poll until the confirmation dialog appears OR we time out.
# We do NOT rely on wait_not for the progress dialog because it can
# 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.")
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:
saved.wait("visible ready", timeout=timeouts["confirm"])
log(" Confirmation dialog appeared - export succeeded.")