Files
clean-architecture-frontend…/tests/e2e/app-shell.spec.ts
T
DongHyeonka e7210c71bf test(e2e): 예제 화면 대신 플랫폼 라우트에서 셸 동작을 확인한다
셸 동작을 보는 e2e(반응형, 스크롤 복원, 해시 링크, 타이포그래피,
건너뛰기 링크, 메뉴 이동, 운영 CSP, compact, en-US의 lang)가 지울 예제
화면을 열거나 그 메뉴를 누른다.

홈과 /examples/platform으로 옮겼다. 스크롤 복원은 계약 표가 그려진 뒤
스크롤하고, 해시 링크는 비동기 표보다 위에 있는 첫 절을 대상으로
한다. WebKit은 scroll anchoring이 없어 표 아래 대상이 1px 밀렸다.
갤러리 자체의 320px 리플로는 앞 커밋의 workshop 시험이 맡는다.

위험: 홈과 플랫폼 개요의 모양이 바뀌면 이 시험들의 대상도 바뀐다.

검증(desktop): 샘플을 지운 최종 트리에서 test:e2e 183 passed.
2026-11-08 13:51:54 +09:00

80 lines
3.0 KiB
TypeScript

import { expect, test } from "../support/browser/strict-browser-test.ts";
test("boots the public app shell", async ({ page }) => {
await page.goto("/");
await expect(page.getByRole("heading", { level: 1 })).toHaveText(
"Clean Architecture Frontend",
);
await expect(page.getByRole("navigation", { name: "주요 탐색" })).toBeVisible();
await expect(page.getByRole("main")).toBeVisible();
});
test("navigates to a registry-backed example without a page reload", async ({
page,
}) => {
await page.goto("/");
await page
.getByRole("navigation", { name: "주요 탐색" })
.getByRole("link", { name: "플랫폼 구성" })
.click();
await expect(page).toHaveURL(/\/examples\/platform$/);
await expect(
page.getByRole("heading", { level: 1, name: "플랫폼 구성" }),
).toBeFocused();
});
test("provides an escape-dismissible mobile navigation", async ({ page }) => {
await page.setViewportSize({ width: 390, height: 844 });
await page.goto("/");
const menu = page.getByRole("button", { name: "메뉴", exact: true });
await menu.click();
await expect(menu).toHaveAttribute("aria-expanded", "true");
await expect(page.getByRole("navigation", { name: "주요 탐색" })).toBeVisible();
await expect(page.locator(".ui-drawer")).toHaveJSProperty("open", true);
expect(
await page.locator(".ui-drawer").evaluate((drawer) => drawer.matches(":modal")),
).toBe(true);
await page.keyboard.press("Escape");
await expect(menu).toHaveAttribute("aria-expanded", "false");
await expect(page.getByRole("navigation", { name: "주요 탐색" })).toBeHidden();
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.
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 menu.click();
await navigation.getByRole("link", { name: "플랫폼 구성" }).click();
await expect(page).toHaveURL(/\/examples\/platform$/);
await expect(menu).toHaveAttribute("aria-expanded", "false");
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.
await page.waitForTimeout(300);
expect(
await page.evaluate(() => {
const active = document.activeElement;
return active?.matches("h1, main") === true;
}),
).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();
});