From c408cc2e0e6e01fff04ae7425f3eee336edb4017 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Thu, 12 Nov 2026 15:03:16 +0900 Subject: [PATCH] =?UTF-8?q?test(e2e):=20=ED=85=9C=ED=94=8C=EB=A6=BF?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=98=A8=20=ED=99=94=EB=A9=B4=20=EC=8B=9C?= =?UTF-8?q?=ED=97=98=EC=9D=84=20TechLog=20=ED=99=94=EB=A9=B4=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=98=AE=EA=B8=B4=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 09-29 템플릿 동기화(c80320d, ebea300→af3d8e6)가 템플릿 e2e 시험을 그대로 들여왔다. 그 시험은 이 제품이 지운 템플릿 예시 화면을 연다. - app-shell: 제목 「Tech Log」(지금 브랜드는 「TechLog」), 템플릿 drawer의 「메뉴」 버튼과 /examples/states. - production-csp: 제목 「Clean Architecture Frontend」와 「화면 상태」 링크. - scroll-restoration: /examples/ui와 .app-shell__header. 그래서 세 엔진 모두에서 요소를 찾지 못해 떨어진다. 같은 동작을 TechLog 화면으로 본다. - 홈 제목은 TechLog, 이동할 화면은 주요 탐색의 「프로젝트」. - drawer는 TechLog의 details.mobile-nav와 「모바일 주요 탐색」. - 긴 화면은 Case(1280x720에서 약 6,000px), 해시 대상은 그 안의 h2. - production-csp는 경로가 바뀐 것을 URL과 제목으로만 확인한다. 초점은 app-shell 시험이 따로 본다. 그래야 초점 결함과 상관없이 CSP 검사가 돈다. 위험·한계: 옮긴 시험 가운데 셋은 제품이 그 동작을 하지 않아 여전히 떨어진다. 시험을 고쳐서 생긴 실패가 아니라, 템플릿 이름 때문에 가려져 있던 실패다. - 경로 이동 뒤 초점: app-router.tsx는 「shell이 초점을 맡는다」며 이동을 뺐지만, TechLog Public shell에는 초점 처리가 없다. drawer 링크로 이동해도 새 화면의 제목으로 초점이 가지 않는다. - 뒤로 가기 스크롤 복원: Case에서 900px 내려갔다가 다른 화면에 갔다 돌아오면 0이다. - 해시로 연 Case에서 대상 h2로 스크롤하지 않는다. TechLog 화면은 해시를 처리하는 PageHeader를 쓰지 않는다(project-decisions-page만 따로 처리). 정할 것(초점 정책)이 있어 이 PR에서 제품을 고치지 않는다. 검증: production-csp는 세 엔진 모두 통과한다. 첫 번째 app-shell 시험(홈 부팅)과 scroll-restoration의 화면 열기까지는 통과하고, 위 세 동작에서 떨어진다. --- tests/e2e/app-shell.spec.ts | 34 ++++++++++++---------------- tests/e2e/production-csp.spec.ts | 16 ++++++++----- tests/e2e/scroll-restoration.spec.ts | 26 ++++++++++++++------- 3 files changed, 42 insertions(+), 34 deletions(-) diff --git a/tests/e2e/app-shell.spec.ts b/tests/e2e/app-shell.spec.ts index a0455e9..88b6044 100644 --- a/tests/e2e/app-shell.spec.ts +++ b/tests/e2e/app-shell.spec.ts @@ -3,9 +3,7 @@ import { gotoTechLog } from "../support/browser/tech-log-fixtures.ts"; test("boots the public app shell", async ({ page }) => { await gotoTechLog(page, "/"); - await expect(page.getByRole("heading", { level: 1 })).toHaveText( - "Tech Log", - ); + await expect(page.getByRole("heading", { level: 1 })).toHaveText("TechLog"); await expect(page.getByRole("navigation", { name: "주요 탐색" })).toBeVisible(); await expect(page.getByRole("main")).toBeVisible(); }); @@ -40,25 +38,27 @@ test("provides an escape-dismissible mobile navigation", async ({ page }) => { await expect(menu).toBeFocused(); }); -// R3-6. A drawer link closes the modal drawer and changes the route in the -// same click. The drawer's deferred focus restore must not win over the new -// page's heading focus; Escape (no navigation) still returns to the menu. +// R3-6 (template sync af3d8e6). A drawer link closes the drawer and changes +// the route in the same click. The new page's heading takes focus; it must not +// go back to the menu. Upstream drives its own drawer and example page; this is +// TechLog's `details.mobile-nav` and a primary-navigation page. test("moves focus to the new page after a mobile drawer link, not back to the menu", async ({ page, }) => { await page.setViewportSize({ width: 390, height: 844 }); - await page.goto("/"); - const menu = page.getByRole("button", { name: "메뉴", exact: true }); - const navigation = page.getByRole("navigation", { name: "주요 탐색" }); + await gotoTechLog(page, "/"); + const drawer = page.locator("details.mobile-nav"); + const menu = drawer.locator("> summary"); + const navigation = page.getByRole("navigation", { name: "모바일 주요 탐색" }); await menu.click(); - await navigation.getByRole("link", { name: "화면 상태" }).click(); + await navigation.getByRole("link", { name: "프로젝트" }).click(); - await expect(page).toHaveURL(/\/examples\/states$/); - await expect(menu).toHaveAttribute("aria-expanded", "false"); - const heading = page.getByRole("heading", { level: 1, name: "화면 상태" }); + await expect(page).toHaveURL(/\/projects$/); + await expect(drawer).not.toHaveAttribute("open", ""); + const heading = page.getByRole("heading", { level: 1, name: "프로젝트" }); await expect(heading).toBeFocused(); - // Give any late restore (dialog close timer, lazy route commit) time to run. + // Give any late restore (lazy route commit) time to run. await page.waitForTimeout(300); expect( await page.evaluate(() => { @@ -67,10 +67,4 @@ test("moves focus to the new page after a mobile drawer link, not back to the me }), ).toBe(true); await expect(menu).not.toBeFocused(); - - await menu.click(); - await expect(navigation).toBeVisible(); - await page.keyboard.press("Escape"); - await expect(navigation).toBeHidden(); - await expect(menu).toBeFocused(); }); diff --git a/tests/e2e/production-csp.spec.ts b/tests/e2e/production-csp.spec.ts index 954eafd..811ce0e 100644 --- a/tests/e2e/production-csp.spec.ts +++ b/tests/e2e/production-csp.spec.ts @@ -54,17 +54,21 @@ test("boots and changes route under the production security headers", async ({ p expect(response?.headers()["content-security-policy"]).toBe( securityHeaders["Content-Security-Policy"], ); - await expect(page.getByRole("heading", { level: 1 })).toHaveText( - "Clean Architecture Frontend", - ); + // Template sync (af3d8e6): TechLog's home and a primary-navigation page in + // place of upstream's example screens. + await expect(page.getByRole("heading", { level: 1 })).toHaveText("TechLog"); await page .getByRole("navigation", { name: "주요 탐색" }) - .getByRole("link", { name: "화면 상태" }) + .getByRole("link", { name: "프로젝트" }) .click(); + // Upstream also waits for route focus here. TechLog's Public shell does not + // move focus on navigation (app-router.tsx leaves it to the shell); that is + // app-shell.spec.ts's to check, so this smoke stays about the policy. + await expect(page).toHaveURL(/\/projects$/); await expect( - page.getByRole("heading", { level: 1, name: "화면 상태" }), - ).toBeFocused(); + page.getByRole("heading", { level: 1, name: "프로젝트" }), + ).toBeVisible(); expect(await cspViolations(page)).toEqual([]); }); diff --git a/tests/e2e/scroll-restoration.spec.ts b/tests/e2e/scroll-restoration.spec.ts index f4f99d8..b96b8d8 100644 --- a/tests/e2e/scroll-restoration.spec.ts +++ b/tests/e2e/scroll-restoration.spec.ts @@ -2,37 +2,47 @@ import { expect, test, type Page } from "../support/browser/strict-browser-test. const scrollY = (page: Page) => page.evaluate(() => Math.round(window.scrollY)); +// Template sync (af3d8e6). Upstream scrolls its long example page; this product +// deleted it, and a TechLog Case (about 6,000px at 1280x720) is the long page. +const LONG_PAGE = "/cases/collection-fetch-join-pagination"; +const LONG_PAGE_TITLE = "컬렉션 Fetch Join과 페이징은 왜 충돌하는가"; + // 08-08. Back restores where the user was; a new route starts at the top. +// The Case body fills in after the title, so the test waits for it before it +// scrolls. test("restores the scroll position when navigating back", async ({ page }) => { const heading = page.getByRole("heading", { level: 1 }); - await page.goto("/examples/ui"); - await expect(heading).toHaveText("UI 구성요소"); + await page.goto(LONG_PAGE); + await expect(heading).toHaveText(LONG_PAGE_TITLE); + await expect(page.locator("main [aria-busy='true']")).toHaveCount(0); + await expect(page.locator("#remaining-cost")).toBeAttached(); await page.evaluate(() => window.scrollTo(0, 900)); await expect.poll(() => scrollY(page)).toBe(900); await page .getByRole("navigation", { name: "주요 탐색" }) - .getByRole("link", { name: "화면 상태" }) + .getByRole("link", { name: "프로젝트" }) .click(); - await expect(heading).toHaveText("화면 상태"); + await expect(heading).toHaveText("프로젝트"); await expect.poll(() => scrollY(page)).toBe(0); await page.goBack(); - await expect(heading).toHaveText("UI 구성요소"); + await expect(heading).toHaveText(LONG_PAGE_TITLE); await expect.poll(() => scrollY(page)).toBe(900); }); +// A section well below the first screen. The header is the TechLog site header. test("opens a hash link at its target below the sticky header", async ({ page, }) => { - await page.goto("/examples/ui#tokens-title"); - const target = page.locator("#tokens-title"); + await page.goto(`${LONG_PAGE}#separate-loading`); + const target = page.locator("#separate-loading"); await expect(target).toBeInViewport(); const top = await target.evaluate((element) => Math.round(element.getBoundingClientRect().top), ); const headerBottom = await page - .locator(".app-shell__header") + .locator(".site-header") .evaluate((element) => Math.round(element.getBoundingClientRect().bottom)); expect(top).toBeGreaterThanOrEqual(headerBottom); expect(await scrollY(page)).toBeGreaterThan(0);