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
접근성 자동 검사 셋이 지키는 것에 닿지 않는다. - 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
373 lines
14 KiB
TypeScript
373 lines
14 KiB
TypeScript
import AxeBuilder from "@axe-core/playwright";
|
|
import type { Page, Route } from "@playwright/test";
|
|
import { WCAG_AXE_TAGS } from "../support/browser/axe-tags.ts";
|
|
|
|
import { KO_MESSAGES } from "../../src/presentation/i18n/catalog.ts";
|
|
import { expect, test } from "../support/browser/strict-browser-test.ts";
|
|
import {
|
|
prepareFixtureBuilds,
|
|
removeFixtureBuilds,
|
|
type FixtureBuilds,
|
|
} from "./support/fixture-builds.ts";
|
|
import {
|
|
addGeneratedFeature,
|
|
generatedFeature,
|
|
routePath,
|
|
type GeneratedFeature,
|
|
} from "../../scripts/lib/generated-feature.ts";
|
|
import { startBuildServer } from "./support/service-worker-builds.ts";
|
|
|
|
/**
|
|
* 2026-11-07. One feature in a real browser: its protected route through the
|
|
* local demo sign-in, its list read through the production codec, mapper and
|
|
* query cache, its form, and its save through the production command path
|
|
* with the idempotency key. These ran on the template's reference sample
|
|
* until it was deleted; now they run on the feature `create:feature` writes
|
|
* (`--with-create --keyed`), built into a copy of the repository
|
|
* (scripts/lib/generated-feature.ts). The API answers are the paired backend's
|
|
* Envelope, written out as in the generated feature's own tests.
|
|
*/
|
|
const META = Object.freeze({ requestId: "req-e2e", traceId: "0af7651916cd43dd8448eb211c80319c" });
|
|
const ITEM = Object.freeze({ id: "browser-order", name: "Browser order" });
|
|
const WCAG_TAGS = [...WCAG_AXE_TAGS];
|
|
|
|
let builds: FixtureBuilds<"a"> | undefined;
|
|
let server: Awaited<ReturnType<typeof startBuildServer>> | undefined;
|
|
let feature: GeneratedFeature;
|
|
|
|
test.beforeAll(async () => {
|
|
test.setTimeout(300_000);
|
|
builds = await prepareFixtureBuilds("generated-feature", [
|
|
{ name: "a", edit: addGeneratedFeature },
|
|
]);
|
|
feature = generatedFeature(builds.root);
|
|
server = await startBuildServer({ a: builds.dist.a, b: builds.dist.a });
|
|
});
|
|
|
|
test.afterAll(async () => {
|
|
await server?.close();
|
|
await removeFixtureBuilds(builds);
|
|
});
|
|
|
|
const words = () => feature.messages["ko-KR"];
|
|
const word = (key: string) => {
|
|
const value = words()[key];
|
|
if (value === undefined) throw new Error(`the generated catalog has no ${key}`);
|
|
return value;
|
|
};
|
|
|
|
function envelope(data: unknown) {
|
|
return { success: true, data, meta: META };
|
|
}
|
|
|
|
function failure(code: string, retryable: boolean) {
|
|
return {
|
|
success: false,
|
|
error: { code, category: "SYSTEM", message: "backend message", retryable },
|
|
meta: META,
|
|
};
|
|
}
|
|
|
|
/** Answers the list read and, by id, the item read. */
|
|
async function answerReads(page: Page, list: readonly unknown[] = [ITEM]) {
|
|
const collection = new URL(feature.api).pathname;
|
|
await page.route(
|
|
(url) => url.origin === new URL(feature.api).origin && url.pathname.startsWith(collection),
|
|
async (route) => {
|
|
const request = route.request();
|
|
if (request.method() !== "GET") return route.fallback();
|
|
const { pathname } = new URL(request.url());
|
|
return pathname === collection
|
|
? route.fulfill({ json: envelope(list) })
|
|
: route.fulfill({ json: envelope({ ...ITEM, id: pathname.slice(collection.length + 1) }) });
|
|
},
|
|
);
|
|
}
|
|
|
|
type CreateCall = Readonly<{ name: unknown; idempotencyKey: string | null }>;
|
|
|
|
/** Answers each create with the next responder and records what was sent. */
|
|
async function answerCreates(
|
|
page: Page,
|
|
responders: readonly ((route: Route) => Promise<void>)[],
|
|
): Promise<CreateCall[]> {
|
|
const calls: CreateCall[] = [];
|
|
await page.route(feature.api, async (route) => {
|
|
const request = route.request();
|
|
if (request.method() !== "POST") return route.fallback();
|
|
calls.push({
|
|
name: (request.postDataJSON() as { name?: unknown }).name,
|
|
idempotencyKey: await request.headerValue("idempotency-key"),
|
|
});
|
|
const respond = responders[calls.length - 1];
|
|
if (!respond) throw new Error(`unexpected create call ${calls.length}`);
|
|
await respond(route);
|
|
});
|
|
return calls;
|
|
}
|
|
|
|
const created = (route: Route) =>
|
|
route.fulfill({
|
|
status: 201,
|
|
headers: { Location: `${feature.api}/${ITEM.id}` },
|
|
json: envelope(ITEM),
|
|
});
|
|
|
|
async function signInAt(page: Page, path: string, heading: string) {
|
|
if (!server) throw new Error("The generated feature's build is not served.");
|
|
await page.goto(`${server.origin}${path}`);
|
|
await expect(page.getByRole("heading", { level: 1 })).toHaveText(
|
|
KO_MESSAGES["route.auth.required.title"],
|
|
);
|
|
await page.getByRole("button", { name: KO_MESSAGES["action.signIn"] }).click();
|
|
await expect(page.getByRole("heading", { level: 1 })).toHaveText(heading);
|
|
}
|
|
|
|
const openForm = (page: Page) => signInAt(page, routePath(feature.create), word("order.form.title"));
|
|
const nameField = (page: Page) =>
|
|
page.getByRole("textbox", { name: new RegExp(word("order.form.name"), "u") });
|
|
const saveButton = (page: Page) => page.getByRole("button", { name: word("order.form.save") });
|
|
|
|
async function expectNoBlockingViolations(page: Page) {
|
|
const results = await new AxeBuilder({ page }).withTags(WCAG_TAGS).analyze();
|
|
expect(
|
|
results.violations.filter((violation) =>
|
|
["critical", "serious"].includes(violation.impact ?? ""),
|
|
),
|
|
).toEqual([]);
|
|
}
|
|
|
|
/**
|
|
* 1103/08-02. Saves from the keyboard and checks where focus lands: in the
|
|
* status above the form, one Tab away from its first action, not on the body
|
|
* after the page turned the save button busy.
|
|
*/
|
|
async function saveFromKeyboard(page: Page, firstAction: string) {
|
|
await nameField(page).fill(ITEM.name);
|
|
await saveButton(page).focus();
|
|
await page.keyboard.press("Enter");
|
|
|
|
await expect(page.locator(".page-template__feedback")).toBeFocused();
|
|
await page.keyboard.press("Tab");
|
|
await expect(page.getByRole("button", { name: firstAction })).toBeFocused();
|
|
}
|
|
|
|
test.describe("the route", () => {
|
|
test("opens the protected list through the local demo sign-in", async ({ page }) => {
|
|
await answerReads(page);
|
|
await signInAt(page, routePath(feature.list), word("order.list.title"));
|
|
|
|
// The closed menu drawer holds a second copy of the status (08-01).
|
|
await expect(
|
|
page.getByRole("banner").getByText(KO_MESSAGES["shell.session.authenticated"]),
|
|
).toBeVisible();
|
|
// The answered row went through the production codec, mapper and query cache.
|
|
await expect(page.getByRole("link", { name: ITEM.name })).toBeVisible();
|
|
});
|
|
|
|
// 08-04. Feature screens take their words from the catalog.
|
|
test("draws its screens without Korean copy in en-US", async ({ page }) => {
|
|
await answerReads(page);
|
|
await signInAt(page, routePath(feature.list), word("order.list.title"));
|
|
await page.getByRole("combobox", { name: "언어" }).first().selectOption("en-US");
|
|
|
|
const main = page.getByRole("main");
|
|
const english = feature.messages["en-US"];
|
|
await expect(main.getByRole("heading", { level: 1 })).toHaveText(english["order.list.title"]!);
|
|
await expect(main).not.toContainText(/[가-힣]/u);
|
|
|
|
await main.getByRole("link", { name: english["order.list.create"]! }).click();
|
|
await expect(main.getByRole("button", { name: english["order.form.save"]! })).toBeVisible();
|
|
await expect(main).not.toContainText(/[가-힣]/u);
|
|
});
|
|
});
|
|
|
|
test.describe("the form", () => {
|
|
test("focuses the first invalid field when a save fails validation", async ({ page }) => {
|
|
await openForm(page);
|
|
await saveButton(page).click();
|
|
|
|
await expect(nameField(page)).toBeFocused();
|
|
await expect(nameField(page)).toHaveAttribute("aria-invalid", "true");
|
|
await expect(page.getByRole("alert")).toContainText(KO_MESSAGES["form.errorSummary"]);
|
|
});
|
|
|
|
test("asks before leaving unsaved input and stays when writing continues", async ({ page }) => {
|
|
await openForm(page);
|
|
await nameField(page).fill("Unsaved order");
|
|
await page
|
|
.getByRole("navigation", { name: KO_MESSAGES["template.breadcrumb"] })
|
|
.getByRole("link", { name: word("order.list.title") })
|
|
.click();
|
|
|
|
const dialog = page.getByRole("dialog", { name: KO_MESSAGES["form.unsaved.title"] });
|
|
await expect(dialog).toBeVisible();
|
|
await dialog.getByRole("button", { name: KO_MESSAGES["action.continueEditing"] }).click();
|
|
await expect(dialog).toBeHidden();
|
|
await expect(nameField(page)).toHaveValue("Unsaved order");
|
|
expect(new URL(page.url()).pathname).toBe(routePath(feature.create));
|
|
});
|
|
|
|
test("keeps the form template within a 320px viewport", async ({ page }) => {
|
|
await page.setViewportSize({ width: 320, height: 720 });
|
|
await openForm(page);
|
|
const viewport = await page.evaluate(() => ({
|
|
clientWidth: document.documentElement.clientWidth,
|
|
scrollWidth: document.documentElement.scrollWidth,
|
|
}));
|
|
expect(viewport.scrollWidth).toBeLessThanOrEqual(viewport.clientWidth);
|
|
});
|
|
});
|
|
|
|
test.describe("the save", () => {
|
|
test("saves through the production command path with an idempotency key", async ({ page }) => {
|
|
await answerReads(page);
|
|
await openForm(page);
|
|
const calls = await answerCreates(page, [created]);
|
|
|
|
await nameField(page).fill(` ${ITEM.name} `);
|
|
await saveButton(page).click();
|
|
|
|
await expect(page.getByRole("heading", { level: 1 })).toHaveText(ITEM.name);
|
|
expect(calls).toEqual([{ name: ITEM.name, idempotencyKey: expect.any(String) }]);
|
|
});
|
|
|
|
test.describe("after a rate-limited save", () => {
|
|
// Chromium and WebKit log a 4xx fetch response to the console, and the
|
|
// client cancels the 429 body unread, which Chromium reports as aborted.
|
|
test.use({
|
|
allowedBrowserFailure:
|
|
/^console:error:.*status of 429|^requestfailed:POST:\/[^:]*:net::ERR_ABORTED$/u,
|
|
});
|
|
|
|
const rateLimited = (route: Route) =>
|
|
route.fulfill({
|
|
status: 429,
|
|
headers: { "retry-after": "1" },
|
|
json: failure("RATE_LIMITED", true),
|
|
});
|
|
|
|
test("keeps the input and saves on retry", async ({ page }) => {
|
|
await answerReads(page);
|
|
await openForm(page);
|
|
const calls = await answerCreates(page, [rateLimited, created]);
|
|
|
|
await nameField(page).fill(ITEM.name);
|
|
await saveButton(page).click();
|
|
|
|
await expect(page.getByText(KO_MESSAGES["error.rate_limited"])).toBeVisible();
|
|
await expect(nameField(page)).toHaveValue(ITEM.name);
|
|
await page.getByRole("button", { name: KO_MESSAGES["action.retry"] }).click();
|
|
|
|
await expect(page.getByRole("heading", { level: 1 })).toHaveText(ITEM.name);
|
|
expect(calls.map((call) => call.name)).toEqual([ITEM.name, ITEM.name]);
|
|
});
|
|
|
|
test("keeps keyboard focus in the failure status", async ({ page }) => {
|
|
await openForm(page);
|
|
await answerCreates(page, [rateLimited]);
|
|
|
|
await saveFromKeyboard(page, KO_MESSAGES["action.retry"]);
|
|
});
|
|
});
|
|
|
|
test.describe("after a save whose result is unknown", () => {
|
|
// The browsers log the 500 response to the console.
|
|
test.use({ allowedBrowserFailure: /^console:error:.*status of 500/u });
|
|
|
|
const lost = (route: Route) =>
|
|
route.fulfill({
|
|
status: 500,
|
|
headers: {
|
|
"x-correlation-id": "corr-save-500",
|
|
"access-control-expose-headers": "x-correlation-id",
|
|
},
|
|
json: failure("INTERNAL_ERROR", false),
|
|
});
|
|
|
|
// 0929/08-04. The case a user most wants to report shows the id support
|
|
// can find in the server logs.
|
|
test("shows the result as unknown with the request id support can find", async ({ page }) => {
|
|
await openForm(page);
|
|
await answerCreates(page, [lost]);
|
|
|
|
await nameField(page).fill(ITEM.name);
|
|
await saveButton(page).click();
|
|
|
|
await expect(page.getByText(KO_MESSAGES["async.mutationEffectUnknown"])).toBeVisible();
|
|
await expect(page.getByText(/^지원 참조: /u)).toBeVisible();
|
|
});
|
|
|
|
test("keeps keyboard focus in the unknown-result status", async ({ page }) => {
|
|
await openForm(page);
|
|
await answerCreates(page, [lost]);
|
|
|
|
await saveFromKeyboard(page, KO_MESSAGES["action.confirmMutationApplied"]);
|
|
});
|
|
|
|
test("resends with the same key from the keyboard and opens the item", async ({ page }) => {
|
|
await answerReads(page);
|
|
await openForm(page);
|
|
const calls = await answerCreates(page, [lost, created]);
|
|
await saveFromKeyboard(page, KO_MESSAGES["action.confirmMutationApplied"]);
|
|
await page.keyboard.press("Tab");
|
|
await expect(
|
|
page.getByRole("button", { name: KO_MESSAGES["action.resendMutation"] }),
|
|
).toBeFocused();
|
|
|
|
await page.keyboard.press("Enter");
|
|
|
|
await expect(page.getByRole("heading", { level: 1 })).toHaveText(ITEM.name);
|
|
expect(calls).toHaveLength(2);
|
|
expect(calls[1]?.idempotencyKey).toBe(calls[0]?.idempotencyKey);
|
|
});
|
|
|
|
// 1105/08-02. Confirming an unknown create opens the list, which shows
|
|
// whether the item was saved.
|
|
test("opens the list after the user confirms the save from the keyboard", async ({ page }) => {
|
|
await answerReads(page);
|
|
await openForm(page);
|
|
const calls = await answerCreates(page, [lost]);
|
|
await saveFromKeyboard(page, KO_MESSAGES["action.confirmMutationApplied"]);
|
|
|
|
await page.keyboard.press("Enter");
|
|
|
|
await expect(page.getByRole("heading", { level: 1 })).toHaveText(word("order.list.title"));
|
|
await expect(page.getByRole("link", { name: ITEM.name })).toBeVisible();
|
|
expect(calls).toHaveLength(1);
|
|
});
|
|
});
|
|
});
|
|
|
|
// 08-05. The protected screens are scanned signed in and in each state they
|
|
// can show. The state must be on screen before axe runs.
|
|
test.describe("accessibility", () => {
|
|
for (const [state, list, visible] of [
|
|
["success", [ITEM], ITEM.name],
|
|
["empty", [], KO_MESSAGES["async.empty"]],
|
|
// A 200 that breaks the response schema: a 5xx would also log a console
|
|
// error, which the strict fixture rejects on its own.
|
|
["error", [{ wrong: true }], KO_MESSAGES["error.schema_mismatch"]],
|
|
] as const) {
|
|
test(`@a11y list ${state} state has no blocking violations`, async ({ page }) => {
|
|
await answerReads(page, list);
|
|
await signInAt(page, routePath(feature.list), word("order.list.title"));
|
|
await expect(page.getByRole("main")).toContainText(visible);
|
|
await expectNoBlockingViolations(page);
|
|
});
|
|
}
|
|
|
|
test("@a11y detail has no blocking violations", async ({ page }) => {
|
|
await answerReads(page);
|
|
await signInAt(page, routePath(feature.detail, ITEM.id), ITEM.name);
|
|
await expectNoBlockingViolations(page);
|
|
});
|
|
|
|
test("@a11y form with submit errors has no blocking violations", async ({ page }) => {
|
|
await openForm(page);
|
|
await saveButton(page).click();
|
|
await expect(page.getByRole("alert")).toContainText(KO_MESSAGES["form.errorSummary"]);
|
|
await expectNoBlockingViolations(page);
|
|
});
|
|
});
|