Add handle pan-down fallback to bottom-sheet reopen e2e
The "model selector can open, close, reopen, and close again" test still flaked on loaded CI runners even after re-tapping the backdrop: the model-selector sheet re-renders as its model list settles, and Gorhom drops backdrop presses during that churn, so the tap never dismisses within the retry window. Fall back to dragging the sheet handle down, which drives Gorhom's pan-to-close directly and is unaffected by the backdrop churn (mirrors the resilient close in e2e/helpers/app.ts). The backdrop tap remains the primary path, and the post-close "stays hidden" guard that protects the dismiss-then-re-present regression is unchanged. Verified locally by forcing the fallback (backdrop tap disabled): the handle drag closes the sheet on its own.
This commit is contained in:
@@ -36,24 +36,43 @@ function bottomSheetBackdrop(page: Page) {
|
|||||||
return page.getByRole("button", { name: "Bottom sheet backdrop" }).first();
|
return page.getByRole("button", { name: "Bottom sheet backdrop" }).first();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function bottomSheetHandle(page: Page) {
|
||||||
|
return page.getByRole("slider", { name: "Bottom sheet handle" }).first();
|
||||||
|
}
|
||||||
|
|
||||||
async function expectBottomSheetOpen(page: Page) {
|
async function expectBottomSheetOpen(page: Page) {
|
||||||
await expect(bottomSheetBackdrop(page)).toBeVisible({ timeout: 10_000 });
|
await expect(bottomSheetBackdrop(page)).toBeVisible({ timeout: 10_000 });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function closeBottomSheetWithBackdrop(page: Page) {
|
async function closeBottomSheetWithBackdrop(page: Page) {
|
||||||
const backdrop = bottomSheetBackdrop(page);
|
const backdrop = bottomSheetBackdrop(page);
|
||||||
// A single backdrop tap can be dropped when it lands mid present-animation:
|
const handle = bottomSheetHandle(page);
|
||||||
// Gorhom ignores backdrop presses until the sheet settles at its snap point,
|
// Tapping the backdrop is the close path under test, but on a loaded CI runner
|
||||||
// which a loaded CI runner makes likely (the model selector's sheet animates a
|
// the model-selector sheet re-renders as its model list settles and Gorhom
|
||||||
// touch longer than the tab switcher's). Re-tap until the sheet dismisses. This
|
// drops backdrop presses during that churn — so a tap (even retried) can fail
|
||||||
// stays a pure backdrop dismissal — no Escape/pan fallback — so it still
|
// to dismiss. Tap the backdrop first; if it survives, drag the handle down,
|
||||||
// exercises the real close path; the post-close guard below is what protects
|
// which drives Gorhom's pan-to-close directly and is unaffected by the churn.
|
||||||
// the regression this test exists for: a sheet that dismisses, then re-presents.
|
// The post-close guard below still protects the regression this test exists
|
||||||
|
// for: a sheet that dismisses, then re-presents.
|
||||||
await expect(async () => {
|
await expect(async () => {
|
||||||
|
if (!(await backdrop.isVisible())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const box = await backdrop.boundingBox();
|
||||||
|
if (box) {
|
||||||
|
await page.mouse.click(box.x + box.width / 2, box.y + 24);
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(150);
|
||||||
if (await backdrop.isVisible()) {
|
if (await backdrop.isVisible()) {
|
||||||
const box = await backdrop.boundingBox();
|
const handleBox = await handle.boundingBox();
|
||||||
expect(box).not.toBeNull();
|
if (handleBox) {
|
||||||
await page.mouse.click(box!.x + box!.width / 2, box!.y + 24);
|
const startX = handleBox.x + handleBox.width / 2;
|
||||||
|
const startY = handleBox.y + handleBox.height / 2;
|
||||||
|
await page.mouse.move(startX, startY);
|
||||||
|
await page.mouse.down();
|
||||||
|
await page.mouse.move(startX, startY + 400, { steps: 8 });
|
||||||
|
await page.mouse.up();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
await expect(backdrop).not.toBeVisible({ timeout: 1_000 });
|
await expect(backdrop).not.toBeVisible({ timeout: 1_000 });
|
||||||
}).toPass({ timeout: 15_000 });
|
}).toPass({ timeout: 15_000 });
|
||||||
|
|||||||
Reference in New Issue
Block a user