Files
clean-architecture-frontend…/tests/storybook/galleries.spec.ts
DongHyeonka 978170cb03
frontend-quality-gates / merge / static checks (pull_request) Successful in 3m52s
frontend-quality-gates / merge / tests (pull_request) Failing after 15m28s
frontend-quality-gates / merge / browser tests (pull_request) Successful in 10m56s
frontend-quality-gates / FE-GATE-017 / diagram-review (pull_request) Skipped
frontend-quality-gates / main / checker self-tests (pull_request) Skipped
frontend-quality-gates / FE-GATE-014 / config-compatibility (pull_request) Skipped
frontend-quality-gates / FE-GATE-028 / manual-accessibility-review (pull_request) Skipped
frontend-quality-gates / FE-GATE-026 / lab-performance (pull_request) Skipped
frontend-quality-gates / FE-GATE-015 / immutable-release-candidate (pull_request) Skipped
frontend-quality-gates / external-vulnerability-provider (pull_request) Skipped
frontend-quality-gates / external-provenance-provider (pull_request) Skipped
frontend-quality-gates / promote-verified-immutable-candidate (pull_request) Skipped
frontend-quality-gates / deploy-promoted-release (pull_request) Skipped
frontend-quality-gates / FE-GATE-019 / hosting-header (pull_request) Skipped
frontend-quality-gates / FE-GATE-021 / runbook-boot-config (pull_request) Skipped
frontend-quality-gates / FE-GATE-022 / runbook-chunk-mismatch (pull_request) Skipped
frontend-quality-gates / FE-GATE-023 / runbook-api-degradation (pull_request) Skipped
frontend-quality-gates / FE-GATE-024 / runbook-telemetry (pull_request) Skipped
frontend-quality-gates / FE-GATE-025 / runbook-release-rollback (pull_request) Skipped
frontend-quality-gates / FE-GATE-018 / field-web-vitals (pull_request) Skipped
test(a11y): 접근성 자동 검사가 지키는 규칙에 실제로 닿게 한다
접근성 자동 검사 셋이 지키는 것에 닿지 않는다.

- reduced-motion e2e가 body의 animationDuration으로 브라우저 기본값
  0s도 받아들인다. responsive.css의 reduced-motion 규칙을 지워도
  통과한다(1112/05-08).
- 예제 화면을 Storybook 갤러리로 옮기면서 화면 전체 axe 검사가 빠졌다.
  기능이 없는 템플릿에서 빈·오류·로그인·권한 표면이 axe를 받지
  않는다(05-04).
- 제품이 WCAG 2.2 AA를 약속하는데 스캔 태그는 2.1까지다. 같은 태그 목록이
  네 곳에 손으로 적혀 있다(05-05 일부).
- 셸 compact drawer는 modal이고 모든 셸 route에 있는데, 라우트 수동 기록
  셋과 checklist 예시가 M4를 "modal 없음"으로 채운다(05-07).

고른 방법: reduced-motion 시험은 규칙이 없을 때의 값(0s)과 규칙의 값
(0.01ms)을 함께 본다. 갤러리 두 story를 light·dark에서 화면 전체 axe로
본다. 태그는 tests/support/browser/axe-tags.ts 하나에 두고 wcag22aa를
더한다. 라우트 기록의 M4를 pending으로 바꾸고 checklist에 셸 drawer를
적는다. 수동 기록 양식에 2.4.11·2.5.8 칸을 더하는 일(05-05의 나머지)은 양식과 생성
출력이 바뀌는 일이라 이 커밋에 넣지 않았다. R9-D9(권하는 안으로 정함
(2026-11-12, 총괄))에 따라 따로 한다.

위험·한계: wcag22aa는 axe의 target-size 규칙만 더한다. 포커스 가림(2.4.11)
같은 기준은 여전히 수동이다.

검증: reduced-motion 시험이 규칙을 지운 변이에서 실패하고 원래 코드에서
통과한다. 갤러리 axe 넷과 FE-GATE-009는 desktop에서 돈다(PR 본문).

Refs: 1112/05-04, 1112/05-05, 1112/05-07, 1112/05-08
2026-11-13 00:13:36 +09:00

140 lines
5.3 KiB
TypeScript

import AxeBuilder from "@axe-core/playwright";
import { WCAG_AXE_TAGS } from "../support/browser/axe-tags.ts";
import {
expect,
test,
type Page,
} from "../support/browser/strict-browser-test.ts";
/**
* The design-system gallery (src/presentation/design-system/galleries.stories.tsx)
* in a real browser. These checks ran on the template's example screen
* `/examples/ui` until the galleries became workshop stories; the primitives
* keep their own component suites. The a11y addon's own axe run is switched
* off, as in workshop.spec.ts: the dialog check below owns it.
*/
async function openDesignSystemGallery(page: Page) {
await page.goto(
"/iframe.html?id=platform-galleries--design-system&viewMode=story&globals=a11y.manual:!true",
);
await expect(
page.getByRole("heading", { level: 1, name: "UI 구성요소" }),
).toBeVisible();
}
test("validates and reports the common text-field flow", async ({ page }) => {
await openDesignSystemGallery(page);
await page.getByRole("button", { name: "입력 확인" }).click();
const field = page.getByRole("textbox", { name: "프로젝트 이름" });
await expect(field).toHaveAttribute("aria-invalid", "true");
await expect(field).toHaveAccessibleDescription(
/프로젝트 이름을 입력해 주세요/,
);
await field.fill("Starter");
await page.getByRole("button", { name: "입력 확인" }).click();
await expect(page.getByText("“Starter” 입력을 확인했습니다.")).toBeVisible();
});
test("traps modal interaction and restores focus to the trigger", async ({
page,
}) => {
await openDesignSystemGallery(page);
const trigger = page.getByRole("button", { name: "모달 열기" });
await trigger.click();
const dialog = page.getByRole("dialog", { name: "연동 확인" });
await expect(dialog).toBeVisible();
await expect(
dialog.getByRole("button", { name: "연동 확인 닫기" }),
).toBeFocused();
await page.keyboard.press("Escape");
await expect(dialog).toBeHidden();
await expect(trigger).toBeFocused();
});
test("opened design-system dialog has no blocking violations", async ({
page,
}) => {
await openDesignSystemGallery(page);
await page.getByRole("button", { name: "모달 열기" }).click();
const results = await new AxeBuilder({ page })
.include(".ui-dialog")
.withTags([...WCAG_AXE_TAGS])
.analyze();
expect(
results.violations.filter((violation) =>
["critical", "serious"].includes(violation.impact ?? ""),
),
).toEqual([]);
});
// 1112/05-04. The galleries replaced the example screens, whose whole page
// the route scan checked. With no feature installed they are the only place
// the empty, error, sign-in and access surfaces are drawn, so the whole story
// is scanned, in both colour schemes, as the screens were.
for (const story of [
{ id: "platform-galleries--design-system", heading: "UI 구성요소" },
{ id: "platform-galleries--screen-states", heading: "화면 상태" },
] as const) {
for (const colorScheme of ["light", "dark"] as const) {
test(`${story.id} has no blocking violations in ${colorScheme}`, async ({ page }) => {
await page.emulateMedia({ colorScheme });
await page.goto(`/iframe.html?id=${story.id}&viewMode=story&globals=a11y.manual:!true`);
await expect(page.getByRole("heading", { level: 1, name: story.heading })).toBeVisible();
const results = await new AxeBuilder({ page })
.withTags([...WCAG_AXE_TAGS])
.analyze();
expect(
results.violations
.filter((violation) => ["critical", "serious"].includes(violation.impact ?? ""))
.map((violation) => `${violation.id}: ${violation.nodes.map((node) => node.target.join(" ")).join(", ")}`),
).toEqual([]);
});
}
}
test("runs menu typeahead, tabs and duplicate toast interactions", async ({
page,
}) => {
await openDesignSystemGallery(page);
const menuTrigger = page.getByRole("button", { name: "작업 메뉴" });
await menuTrigger.focus();
await page.keyboard.press("ArrowDown");
await page.keyboard.type("toast");
const toastItem = page.getByRole("menuitem", { name: "Toast 표시" });
await expect(toastItem).toBeFocused();
await page.keyboard.press("Enter");
await expect(page.getByText("예제가 저장되었습니다.")).toBeVisible();
await expect(menuTrigger).toBeFocused();
const tokenTab = page.getByRole("tab", { name: "토큰" });
await tokenTab.focus();
await page.keyboard.press("ArrowRight");
const primitiveTab = page.getByRole("tab", { name: "프리미티브" });
await expect(primitiveTab).toBeFocused();
await expect(primitiveTab).toHaveAttribute("aria-selected", "false");
await page.keyboard.press("Enter");
await expect(primitiveTab).toHaveAttribute("aria-selected", "true");
await expect(
page.getByRole("tabpanel", { name: "프리미티브" }),
).toContainText("native semantics");
});
test("reflows the gallery at the 320px minimum without horizontal overflow", async ({
page,
}) => {
await page.setViewportSize({ width: 320, height: 720 });
await openDesignSystemGallery(page);
const viewport = await page.evaluate(() => ({
clientWidth: document.documentElement.clientWidth,
scrollWidth: document.documentElement.scrollWidth,
}));
expect(viewport.scrollWidth).toBeLessThanOrEqual(viewport.clientWidth);
});