From b4908d99310ddb9f82f6e2e479930c6628529832 Mon Sep 17 00:00:00 2001 From: jvsena42 Date: Fri, 18 Sep 2026 15:00:23 -0300 Subject: [PATCH] fix: dismiss best-effort toast so it stops covering header Co-Authored-By: Claude Opus 5 (1M context) (cherry picked from commit 9b95a973d585b771954a038e5df4910d504cc1a7) --- test/helpers/actions.ts | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/test/helpers/actions.ts b/test/helpers/actions.ts index 09a7685..b0eadb0 100644 --- a/test/helpers/actions.ts +++ b/test/helpers/actions.ts @@ -1396,6 +1396,10 @@ export async function waitForToast( * or dismissed too quickly). Does not throw on timeout—callers must handle * verification via other means (e.g., UI state confirmation). * + * Once the toast is observed it is cleared before returning, so it cannot keep + * covering the header: a toast overlays HeaderMenu for its whole lifetime and + * swallows the tap that opens the drawer. + * * On iOS, uses waitToDisappear pattern since toasts render in a separate window * where drag-dismiss hits wrong coordinates. */ @@ -1421,17 +1425,31 @@ export async function waitForToastBestEffort( }, { timeout, interval: pollingInterval } ); - - if (driver.isIOS) { - await el.waitForDisplayed({ reverse: true, timeout: 5_000 }).catch(() => { - // Toast may have dismissed immediately; that's fine - }); - } } catch { // Toast wasn't displayed within timeout—may have already appeared and dismissed // or never appeared. Caller should verify via other means. } + if (!toastSeen) { + return false; + } + + // Re-check instead of trusting toastSeen: dragOnElement waits on the element + // with the global 30s timeout, which would be spent in full on a toast that + // already went away. + if (driver.isAndroid && (await el.isDisplayed().catch(() => false))) { + // Drag it away like waitForToast does: an undismissed toast keeps covering + // HeaderMenu for its full duration, so the next openSettings() tap lands on + // the toast instead of the drawer button. + await dragOnElement(toastId, 'up', 0.2).catch(() => { + // Toast may have auto-dismissed mid-drag; the wait below settles it + }); + } + + await el.waitForDisplayed({ reverse: true, timeout: 5_000 }).catch(() => { + // Toast may have dismissed immediately; that's fine + }); + return toastSeen; }