diff --git a/tests/e2e/scroll-restoration.spec.ts b/tests/e2e/scroll-restoration.spec.ts index b96b8d8..f6b068e 100644 --- a/tests/e2e/scroll-restoration.spec.ts +++ b/tests/e2e/scroll-restoration.spec.ts @@ -19,10 +19,13 @@ test("restores the scroll position when navigating back", async ({ page }) => { await page.evaluate(() => window.scrollTo(0, 900)); await expect.poll(() => scrollY(page)).toBe(900); + // TechLog's header is not sticky, so a real click first scrolls up to the + // link and the reader leaves from the top. The click is dispatched where the + // reader is, so the page is left at 900. await page .getByRole("navigation", { name: "주요 탐색" }) .getByRole("link", { name: "프로젝트" }) - .click(); + .dispatchEvent("click"); await expect(heading).toHaveText("프로젝트"); await expect.poll(() => scrollY(page)).toBe(0);