From 8ca90db72ff3576c75246acbf21ddc21fa6fb38f Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Thu, 12 Nov 2026 16:21:18 +0900 Subject: [PATCH] =?UTF-8?q?test(e2e):=20=EC=8A=A4=ED=81=AC=EB=A1=A4=20?= =?UTF-8?q?=EB=B3=B5=EC=9B=90=20=EC=8B=9C=ED=97=98=EC=9D=B4=20900px=20?= =?UTF-8?q?=EC=A7=80=EC=A0=90=EC=97=90=EC=84=9C=20=ED=99=94=EB=A9=B4?= =?UTF-8?q?=EC=9D=84=20=EB=96=A0=EB=82=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit scroll-restoration 시험은 Case를 900px 내린 뒤 주요 탐색의 「프로젝트」를 누르고, 뒤로 가서 900px로 돌아오는지 본다. TechLog 머리말은 sticky가 아니어서, Playwright는 링크를 누르기 전에 머리말까지 페이지를 올린다. 그래서 화면을 떠나는 위치가 0이 되고, 900을 기대한 시험은 복원이 되든 안 되든 떨어진다. 템플릿의 머리말은 sticky라서 이 문제가 없었다. 링크를 스크롤 없이 누른다(dispatchEvent). 실제 사용자가 머리말까지 올려 누르면 떠나는 위치는 맨 위이고, 그것이 복원할 위치다. 검증: 이 수정만 넣고(복원 처리 없음) 돌리면 chromium은 브라우저 기본 복원으로 통과한다. firefox는 두 번 모두 실패하고, webkit은 두 번 중 한 번 실패한다. 다음 커밋이 그 복원을 맡는다. --- tests/e2e/scroll-restoration.spec.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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);