From 17aa957d3e6bef4fc7d0fb5dcdb63c7b6def5ed7 Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Sat, 30 May 2026 22:59:02 +0800 Subject: [PATCH] Stabilize bottom-sheet reopen e2e by retrying the backdrop tap (#1238) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "model selector can open, close, reopen, and close again" test fails on loaded CI runners: a single backdrop tap that lands while the sheet is still present-animating is dropped (Gorhom ignores backdrop presses until the sheet settles at its snap point), so the sheet never dismisses and the backdrop stays visible. The reopen behaviour itself is correct — the visibility tracker is unit-tested and the spec passes locally (3x), so this is test-interaction fragility, not a product regression. Re-tap the backdrop until the sheet dismisses, mirroring the resilient close loop already used in e2e/helpers/app.ts. It stays a pure backdrop dismissal (no Escape/pan fallback) so the real close path is still exercised, and the post-close "stays hidden" guard that protects the dismiss-then-re-present regression is unchanged. --- packages/app/e2e/bottom-sheet-reopen.spec.ts | 22 +++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/packages/app/e2e/bottom-sheet-reopen.spec.ts b/packages/app/e2e/bottom-sheet-reopen.spec.ts index a0bbdda00..39131e27b 100644 --- a/packages/app/e2e/bottom-sheet-reopen.spec.ts +++ b/packages/app/e2e/bottom-sheet-reopen.spec.ts @@ -41,13 +41,25 @@ async function expectBottomSheetOpen(page: Page) { } async function closeBottomSheetWithBackdrop(page: Page) { - const box = await bottomSheetBackdrop(page).boundingBox(); - expect(box).not.toBeNull(); - await page.mouse.click(box!.x + box!.width / 2, box!.y + 24); - await expect(bottomSheetBackdrop(page)).not.toBeVisible({ timeout: 10_000 }); + const backdrop = bottomSheetBackdrop(page); + // A single backdrop tap can be dropped when it lands mid present-animation: + // Gorhom ignores backdrop presses until the sheet settles at its snap point, + // which a loaded CI runner makes likely (the model selector's sheet animates a + // touch longer than the tab switcher's). Re-tap until the sheet dismisses. This + // stays a pure backdrop dismissal — no Escape/pan fallback — so it still + // exercises the real close path; the post-close guard below is what protects + // the regression this test exists for: a sheet that dismisses, then re-presents. + await expect(async () => { + if (await backdrop.isVisible()) { + const box = await backdrop.boundingBox(); + expect(box).not.toBeNull(); + await page.mouse.click(box!.x + box!.width / 2, box!.y + 24); + } + await expect(backdrop).not.toBeVisible({ timeout: 1_000 }); + }).toPass({ timeout: 15_000 }); // Guard against the regression where the sheet starts dismissing, then re-presents. await page.waitForTimeout(500); - await expect(bottomSheetBackdrop(page)).not.toBeVisible({ timeout: 1_000 }); + await expect(backdrop).not.toBeVisible({ timeout: 1_000 }); } async function openTabSwitcher(page: Page) {