From a277db78b7f2cfabc8120369af7ceef3429a4a80 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Wed, 9 Sep 2026 16:20:40 +0200 Subject: [PATCH] Try to improve test checks & timeouts --- test/android/device.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/android/device.ts b/test/android/device.ts index 3320cf0..2b48648 100644 --- a/test/android/device.ts +++ b/test/android/device.ts @@ -356,7 +356,7 @@ export class DeviceApp { * entirely, so we re-tap once before giving up. */ async waitForButtonResult(text: string, options: { timeout: number, retryTapAfter: number }) { - const startTime = Date.now(); + let startTime = Date.now(); let retapped = false; while (true) { @@ -367,6 +367,11 @@ export class DeviceApp { const elapsed = Date.now() - startTime; if (elapsed > options.timeout) { + // Look once more before giving up: + const settledButton = this.buttons(await this.readScreen()) + .find((b) => b.text === text); + if (settledButton?.description) return settledButton.description; + // N.b. a button missing from this entirely (rather than present with no result) // means it wasn't in the UI at all, e.g. it was covered or scrolled away: throw await this.explainFailure( @@ -379,7 +384,11 @@ export class DeviceApp { console.log(`Re-tapping button ${text}`); await this.tap(button); retapped = true; + + startTime = Date.now(); } + + await delay(250); } }