diff --git a/tests/ui-overlap.spec.ts b/tests/ui-overlap.spec.ts index 0735bd3dc..46a19a4c8 100644 --- a/tests/ui-overlap.spec.ts +++ b/tests/ui-overlap.spec.ts @@ -62,10 +62,14 @@ async function mockDemoDashboard(page: Page) { } async function gotoHome(page: Page) { - await page.goto("/", { waitUntil: "domcontentloaded" }); + // Pin mode=answer so GlobalSearchShell does not immediately router.replace() + // for a stored landing preference. That replace can briefly leave two mounted + // shells (and two header#search nodes), which trips Playwright strict mode. + await page.goto("/?mode=answer", { waitUntil: "domcontentloaded" }); // Wait until React settles on a single header. During client remount / // hydration a second transient header#search can exist briefly and trip // Playwright strict mode even though the stable tree has only one banner. + // Permanent double-render still fails toHaveCount(1). const header = page.locator("header#search"); await expect(header).toHaveCount(1, { timeout: 30_000 }); await header.waitFor({ state: "visible", timeout: 30_000 });