frontend-quality-gates / main / self-tests and removal drills (pull_request) Skipped
frontend-quality-gates / merge / static checks (pull_request) Successful in 1m43s
frontend-quality-gates / merge / tests (pull_request) Successful in 15m44s
frontend-quality-gates / merge / browser tests (pull_request) Successful in 5m56s
frontend-quality-gates / FE-GATE-017 / diagram-review (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
`tests/e2e/accessibility.spec.ts`의 공개 라우트 분기는 h1만 기다리고 axe를 돌린다. 보호 분기에는 `[aria-busy='true']` 0개 대기가 있는데 공개 분기에는 없다. EXAMPLES_PLATFORM은 HTTP 오퍼레이션 표를 Suspense 뒤에(LoadingSurface는 `aria-busy`), 릴리스 지표 `dl`도 `aria-busy`로 그린다. 그래서 그 표가 검사됐는지가 실행마다 달라지고, 그래도 `a11y.json`은 검사한 것으로 센다(fe-a11y 함정 2). 고른 방법: 공개 분기도 h1 뒤에 `aria-busy` 표면이 0개가 될 때까지 기다린 뒤 axe를 돌린다. checklist의 「자동 실행이 검사하는 것」에 같은 조건을 적는다. 버린 대안: EXAMPLES_PLATFORM에만 전용 대기를 두기(다음 공개 라우트에서 같은 구멍이 다시 생긴다). 검증: 실험 V4-X2(E-L5-05) — 고치기 전과 뒤에 스캔 직전 busy 개수를 찍는 desktop 실행 결과를 PR 본문에 적는다. Refs: 1112/05-16
154 lines
6.9 KiB
TypeScript
154 lines
6.9 KiB
TypeScript
import AxeBuilder from "@axe-core/playwright";
|
|
import { recordA11yDataState } from "../../scripts/lib/a11y-data-state.ts";
|
|
import { expect, test, type Page } from "../support/browser/strict-browser-test.ts";
|
|
import { ROUTE_REGISTRY } from "../../src/features/installed-feature-contracts.ts";
|
|
import { COMPOSED_CONTRACT_CONTRIBUTIONS } from "../../src/features/loaded-feature-runtimes.ts";
|
|
import type { RouteDefinition } from "../../src/contracts/routes.ts";
|
|
import { KO_MESSAGES } from "../../src/presentation/i18n/catalog.ts";
|
|
import {
|
|
answerInstalledApiRequest,
|
|
type InstalledApiAnswer,
|
|
} from "./support/installed-api-answers.ts";
|
|
import { WCAG_AXE_TAGS } from "../support/browser/axe-tags.ts";
|
|
|
|
const WCAG_TAGS = [...WCAG_AXE_TAGS];
|
|
const SIGN_IN_TITLE = KO_MESSAGES["route.auth.required.title"];
|
|
const CATALOG = KO_MESSAGES as Readonly<Record<string, string>>;
|
|
|
|
async function blockingViolations(page: Page) {
|
|
const results = await new AxeBuilder({ page }).withTags(WCAG_TAGS).analyze();
|
|
return results.violations.filter((violation) =>
|
|
["critical", "serious"].includes(violation.impact ?? ""),
|
|
);
|
|
}
|
|
|
|
// 08-05/11-02. The app shell draws `main` before the route chunk arrives, so
|
|
// axe waits for the route's own h1. A public route's h1 is its catalog title.
|
|
// A protected route is scanned after the demo sign-in, never on the sign-in
|
|
// prompt; the feature's own spec pins its exact headings and states.
|
|
// Widened: without an installed feature every route is public, and the
|
|
// `session-required` branch must still typecheck (sample removal).
|
|
const ROUTES: readonly RouteDefinition[] = Object.values(ROUTE_REGISTRY);
|
|
// 1103/16-03. Every path parameter gets one value: a feature with its own
|
|
// parameter names needs no edit here.
|
|
const PATH_PARAMETER_VALUE = "a11y-1";
|
|
const API_ORIGIN = "http://localhost:8080";
|
|
for (const definition of ROUTES) {
|
|
const route =
|
|
definition.path === "*"
|
|
? "/not-found"
|
|
: definition.path.replace(/:[A-Za-z][A-Za-z0-9_]*/gu, PATH_PARAMETER_VALUE);
|
|
test(`@a11y ${route} has no critical or serious axe violations`, async ({
|
|
page,
|
|
}) => {
|
|
// 1106/11-01. An earlier run's record never outlives this run, even when
|
|
// no record call below is reached. scripts/write-a11y-report.ts then
|
|
// fails on a route the descriptors say reads one resource.
|
|
await recordA11yDataState(definition.routeId, null);
|
|
const heading = page.getByRole("heading", { level: 1 });
|
|
if (definition.access === "session-required") {
|
|
// 1103/11-01. Feature data is not this spec's subject: a list read gets
|
|
// an empty list in the frame its descriptor declares, so the page is
|
|
// scanned in its empty state, not on a response-shape error.
|
|
const answers: InstalledApiAnswer[] = [];
|
|
await page.route(`${API_ORIGIN}/**`, (request) => {
|
|
const answer = answerInstalledApiRequest(
|
|
COMPOSED_CONTRACT_CONTRIBUTIONS,
|
|
request.request().method(),
|
|
new URL(request.request().url()).pathname,
|
|
);
|
|
answers.push(answer);
|
|
return answer.kind === "unanswerable"
|
|
? request.fulfill({ status: 501, body: answer.reason ?? answer.request })
|
|
: request.fulfill({ json: answer.body });
|
|
});
|
|
await page.goto(route);
|
|
await expect(heading).toHaveText(SIGN_IN_TITLE);
|
|
await page.getByRole("button", { name: "로그인 시작" }).click();
|
|
await expect(heading).toBeVisible();
|
|
await expect(heading).not.toHaveText(SIGN_IN_TITLE);
|
|
await expect(page.locator("[aria-busy='true']")).toHaveCount(0);
|
|
expect(
|
|
answers.filter((answer) => answer.kind === "unanswerable"),
|
|
"requests no installed list or single-resource read answers",
|
|
).toEqual([]);
|
|
const singleResourceReads = answers.flatMap((answer) =>
|
|
answer.kind === "single-resource" ? [answer.operationId] : [],
|
|
);
|
|
if (singleResourceReads.length === 0) {
|
|
// A shape the page does not read fails here, before axe passes it.
|
|
await expect(page.getByRole("alert")).toHaveCount(0);
|
|
await recordA11yDataState(definition.routeId, null);
|
|
} else {
|
|
// No generic body answers a read of one resource: a detail page is
|
|
// scanned in its failure state. 1103/11-01. a11y.json then lists it
|
|
// under `notChecked`, not as passed.
|
|
const reason = `scanned on its failure state only: ${singleResourceReads.join(", ")} reads one resource`;
|
|
test.info().annotations.push({ type: "a11y-data-state", description: reason });
|
|
await recordA11yDataState(definition.routeId, reason);
|
|
}
|
|
} else {
|
|
await page.goto(route);
|
|
const title = CATALOG[`route.${definition.routeId}.title`];
|
|
await expect(heading).toHaveText(title ?? definition.title);
|
|
// 1112/05-16. A public page can still be loading behind Suspense (the
|
|
// platform page's operation table) when its h1 is up; scan it settled.
|
|
await expect(page.locator("[aria-busy='true']")).toHaveCount(0);
|
|
await recordA11yDataState(definition.routeId, null);
|
|
}
|
|
expect(await blockingViolations(page)).toEqual([]);
|
|
});
|
|
}
|
|
|
|
test("@a11y keyboard reaches the primary route action with visible focus", async ({
|
|
page,
|
|
}) => {
|
|
await page.goto("/");
|
|
const action = page.getByRole("link", { name: "플랫폼 구성 보기" });
|
|
await expect(action).toBeVisible();
|
|
await page.keyboard.press("Tab");
|
|
await expect(action).toBeFocused();
|
|
await expect(action).toHaveCSS("outline-style", "solid");
|
|
});
|
|
|
|
// 08-09. axe's skip-link rule is best-practice, outside WCAG_TAGS, so the only
|
|
// way past the header and sidebar (WCAG 2.4.1) needs its own check.
|
|
test("@a11y skip link moves keyboard focus into main", async ({ page }) => {
|
|
await page.goto("/examples/platform");
|
|
await expect(page.getByRole("heading", { level: 1 })).toBeFocused();
|
|
const skipLink = page.getByRole("link", { name: "본문으로 건너뛰기" });
|
|
await skipLink.focus();
|
|
await expect(skipLink).toBeFocused();
|
|
|
|
await page.keyboard.press("Enter");
|
|
|
|
await expect
|
|
.poll(() =>
|
|
page.evaluate(
|
|
() => document.querySelector("main")?.contains(document.activeElement) ?? false,
|
|
),
|
|
)
|
|
.toBe(true);
|
|
});
|
|
|
|
// 1112/05-08. The policy is the reduced-motion rule (responsive.css): every
|
|
// animation and transition becomes 0.01 ms. The browser default is 0s, so the
|
|
// check reads the rule's own value and compares it with the default, or a
|
|
// deleted rule passes.
|
|
test("@a11y reduced-motion policy disables long animation", async ({ page }) => {
|
|
const durations = () =>
|
|
page.locator("body").evaluate((body) => {
|
|
const style = getComputedStyle(body);
|
|
return [style.animationDuration, style.transitionDuration];
|
|
});
|
|
const REDUCED = ["0.00001s", "1e-05s"];
|
|
await page.goto("/");
|
|
expect(await durations()).toEqual(["0s", "0s"]);
|
|
|
|
await page.emulateMedia({ reducedMotion: "reduce" });
|
|
|
|
const [animation, transition] = await durations();
|
|
expect(REDUCED).toContain(animation);
|
|
expect(REDUCED).toContain(transition);
|
|
});
|