Files
clean-architecture-frontend…/tests/visual/platform.visual.spec.ts
DongHyeonkaandClaude Opus 5.5 f17572a4be test(a11y): scan the rendered route, signed in and per state (08-05, 11-02)
axe ran as soon as `main` showed, which is the app shell's loading surface,
and protected routes were scanned on the sign-in prompt. The specs now wait
for the route's h1, sign in first, and scan the reference list, detail, form
and status states. The state-surfaces baseline was the loading surface.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 00:25:46 +09:00

66 lines
2.3 KiB
TypeScript

import {
expect,
test,
type Page,
} from "../support/browser/strict-browser-test.ts";
// 11-02. `main` is drawn before the route chunk arrives; a screenshot taken
// then pins the loading surface instead of the page.
async function expectRouteHeading(page: Page, title: string) {
await expect(page.getByRole("heading", { level: 1 })).toHaveText(title);
}
test("wide application shell visual contract", async ({ page }) => {
await page.setViewportSize({ width: 1440, height: 900 });
await page.goto("/");
await expectRouteHeading(page, "Clean Architecture Frontend");
await expect(page).toHaveScreenshot("app-shell-wide-light.png", {
fullPage: true,
});
});
test("compact drawer and pseudo-locale visual contract", async ({ page }) => {
await page.setViewportSize({ width: 390, height: 844 });
await page.goto("/");
await expectRouteHeading(page, "Clean Architecture Frontend");
await page.locator("#locale-preference").selectOption("en-XA");
await page.locator(".app-shell__menu-button").click();
await expect(page.locator(".ui-drawer")).toHaveJSProperty("open", true);
await expect(page).toHaveScreenshot("app-shell-compact-pseudo-drawer.png", {
fullPage: true,
});
});
test("design-system gallery dark visual contract", async ({ page }) => {
await page.setViewportSize({ width: 1280, height: 900 });
await page.goto("/examples/ui");
await expectRouteHeading(page, "UI 구성요소");
await page.locator("#theme-preference").selectOption("dark");
await expect(page.getByRole("main")).toHaveScreenshot(
"design-system-gallery-dark.png",
);
});
test("loading empty error and access surfaces visual contract", async ({
page,
}) => {
await page.setViewportSize({ width: 1280, height: 1100 });
await page.goto("/examples/states");
await expectRouteHeading(page, "화면 상태");
await expect(page.getByRole("main")).toHaveScreenshot(
"state-surfaces-light.png",
);
});
test("platform composition overview visual contract", async ({ page }) => {
await page.setViewportSize({ width: 1280, height: 1100 });
await page.goto("/examples/platform");
await expectRouteHeading(page, "플랫폼 구성");
await expect(
page.locator("section[aria-labelledby='platform-capabilities-title']"),
).toBeVisible();
await expect(page.getByRole("main")).toHaveScreenshot(
"platform-overview-light.png",
);
});