셸 동작을 보는 e2e(반응형, 스크롤 복원, 해시 링크, 타이포그래피, 건너뛰기 링크, 메뉴 이동, 운영 CSP, compact, en-US의 lang)가 지울 예제 화면을 열거나 그 메뉴를 누른다. 홈과 /examples/platform으로 옮겼다. 스크롤 복원은 계약 표가 그려진 뒤 스크롤하고, 해시 링크는 비동기 표보다 위에 있는 첫 절을 대상으로 한다. WebKit은 scroll anchoring이 없어 표 아래 대상이 1px 밀렸다. 갤러리 자체의 320px 리플로는 앞 커밋의 workshop 시험이 맡는다. 위험: 홈과 플랫폼 개요의 모양이 바뀌면 이 시험들의 대상도 바뀐다. 검증(desktop): 샘플을 지운 최종 트리에서 test:e2e 183 passed.
75 lines
2.8 KiB
TypeScript
75 lines
2.8 KiB
TypeScript
import { expect, test } from "../support/browser/strict-browser-test.ts";
|
|
|
|
// The gallery's own 320px reflow is a workshop check
|
|
// (tests/storybook/galleries.spec.ts); this one is the shell around a page.
|
|
test("reflows the shell at the 320px minimum without horizontal overflow", async ({
|
|
page,
|
|
}) => {
|
|
await page.setViewportSize({ width: 320, height: 720 });
|
|
await page.goto("/");
|
|
await expect(
|
|
page.getByRole("heading", { level: 1, name: "Clean Architecture Frontend" }),
|
|
).toBeVisible();
|
|
await expect(
|
|
page.getByRole("button", { name: "메뉴", exact: true }),
|
|
).toBeVisible();
|
|
|
|
const viewport = await page.evaluate(() => ({
|
|
clientWidth: document.documentElement.clientWidth,
|
|
scrollWidth: document.documentElement.scrollWidth,
|
|
}));
|
|
expect(viewport.scrollWidth).toBeLessThanOrEqual(viewport.clientWidth);
|
|
});
|
|
|
|
// 08-01. Below 48rem the header hides the theme selector, the session status
|
|
// and the brand. WCAG 1.4.10 allows moving them, not dropping them: the menu
|
|
// drawer carries them. 640px is a 1280px window at 200% zoom.
|
|
for (const width of [320, 375, 640]) {
|
|
test(`keeps the theme selector and session status in the menu drawer at ${width}px`, async ({
|
|
page,
|
|
}) => {
|
|
await page.setViewportSize({ width, height: 720 });
|
|
await page.goto("/");
|
|
await expect(page.getByRole("heading", { level: 1 })).toBeVisible();
|
|
await page.getByRole("button", { name: "메뉴", exact: true }).click();
|
|
const drawer = page.getByRole("dialog", { name: "메뉴" });
|
|
await expect(drawer).toBeVisible();
|
|
|
|
const theme = drawer.getByRole("combobox", { name: "색상 테마" });
|
|
await expect(theme).toBeVisible();
|
|
// Keyboard reach: the selector follows the last navigation link.
|
|
await drawer
|
|
.getByRole("navigation", { name: "주요 탐색" })
|
|
.getByRole("link")
|
|
.last()
|
|
.focus();
|
|
await page.keyboard.press("Tab");
|
|
await expect(theme).toBeFocused();
|
|
await theme.selectOption("dark");
|
|
await expect(page.locator("html")).toHaveAttribute("data-theme", "dark");
|
|
await theme.selectOption("light");
|
|
await expect(page.locator("html")).toHaveAttribute("data-theme", "light");
|
|
|
|
await expect(drawer.getByText("로그인 전", { exact: true })).toBeVisible();
|
|
await expect(
|
|
drawer.getByText("Frontend Skeleton", { exact: true }),
|
|
).toBeVisible();
|
|
});
|
|
}
|
|
|
|
test("keeps desktop navigation and two-column sections at wide viewports", async ({
|
|
page,
|
|
}) => {
|
|
await page.setViewportSize({ width: 1440, height: 900 });
|
|
await page.goto("/examples/platform");
|
|
|
|
await expect(page.getByRole("navigation", { name: "주요 탐색" })).toBeVisible();
|
|
await expect(
|
|
page.getByRole("button", { name: "메뉴", exact: true }),
|
|
).toBeHidden();
|
|
await expect(page.locator(".component-grid--two").first()).toHaveCSS(
|
|
"grid-template-columns",
|
|
/.+px .+px/,
|
|
);
|
|
});
|