Files
tech-log-frontend/tests/e2e/tech-log-accessibility.spec.ts
T
DongHyeonka 500dbc6217 test(e2e): Studio 화면 시험은 데모 세션으로 로그인한 뒤 본다
5e2b1a5(08-20)부터 로그인하지 않은 방문자는 Studio 경로에서 로그인
화면만 받는다. e2e 빌드는 local profile(AUTH_MODE demo)이고, 데모
세션은 로그아웃 상태로 시작해 메모리에만 있다. 그런데 Studio 시험은
로그인하지 않고 들어간다. 그래서
- 편집기·접근성 시험은 로그인 화면에서 「저장」 버튼이나 「요약」 칸을
  기다리다 떨어지고,
- 경로별 axe 검사(accessibility.spec)와 visual 시험은 Studio 경로 12개에서
  Studio 화면 대신 로그인 화면을 검사하고 있었다.

tech-log-fixtures.ts에 gotoTechLogStudio를 둔다. gotoTechLog 뒤에
작성자가 쓰는 「로그인 시작」 버튼을 누르고, 로그인한 세션만 받는
Studio 머리말이 뜰 때까지 기다린다. Studio 경로를 여는 e2e·접근성·visual
시험이 이것을 쓴다.

버린 대안: 앱의 세션을 시험에서 직접 authenticated로 바꾸기. 로그인
버튼과 관문 동작을 건너뛰게 되고, 앱 내부에 시험용 구멍이 필요하다.

위험: 이 변경으로 Studio 화면을 실제로 검사하게 되면서, 로그인 화면에
가려져 있던 결함이 드러난다. MOCK Studio에서도 관리 기능(주제·프로젝트·
릴리즈)이 실제 HTTP(/api/v1/studio/session)로 나가 연결이 거부된다
(create-tech-log-feature-input.ts의 createManagementGateway에 MOCK 분기가
없다). 그 결함은 이 PR 밖이다. 그동안 Studio 편집기·대시보드 시험은
그 이유로 실패한다.

검증: Studio 경로에서 로그인 뒤 Studio 머리말과 주 탐색이 뜨는 것을
error-context 스냅숏으로 확인했다. 남은 실패는 모두 위 HTTP 요청이다.
2026-11-12 15:03:16 +09:00

81 lines
3.0 KiB
TypeScript

import AxeBuilder from "@axe-core/playwright";
import { expect, test } from "../support/browser/strict-browser-test.ts";
import {
gotoTechLog,
gotoTechLogStudio,
} from "../support/browser/tech-log-fixtures.ts";
function blockingViolations(results: Awaited<ReturnType<AxeBuilder["analyze"]>>) {
return results.violations.filter((violation) =>
["critical", "serious"].includes(violation.impact ?? ""),
);
}
test("Public shell exposes one main landmark, one h1, labelled navigation, and current link", async ({
page,
}) => {
await gotoTechLog(page, "/projects");
await expect(page.getByRole("main")).toHaveCount(1);
await expect(page.getByRole("heading", { level: 1 })).toHaveCount(1);
await expect(page.getByRole("navigation", { name: "주요 탐색" })).toBeVisible();
await expect(page.getByRole("link", { name: "프로젝트", exact: true })).toHaveAttribute(
"aria-current",
"page",
);
});
test("Studio mobile navigation is keyboard reachable and exposes its expanded state", async ({
page,
}) => {
await page.setViewportSize({ width: 390, height: 844 });
await gotoTechLogStudio(page, "/studio");
const trigger = page.locator(".studio-menu-trigger");
await trigger.focus();
await page.keyboard.press("Enter");
await expect(trigger).toHaveAttribute("aria-expanded", "true");
await expect(page.getByRole("navigation", { name: "Studio 모바일 탐색" })).toBeVisible();
});
test("dirty-leave dialog is labelled, traps focus, and restores the invoking link", async ({
page,
}) => {
await gotoTechLogStudio(
page,
"/studio/documents/11111111-1111-4111-8111-111111111111/edit",
);
await page.getByLabel("요약").fill("저장하지 않은 접근성 검증 변경");
const trigger = page.getByRole("link", { name: "게시 기록", exact: true }).first();
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("open Public search and Studio leave dialogs have no blocking Axe findings", async ({
page,
}) => {
await gotoTechLog(page, "/");
await page.getByRole("button", { name: "검색 열기" }).click();
let results = await new AxeBuilder({ page })
.include("dialog")
.withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"])
.analyze();
expect(blockingViolations(results)).toEqual([]);
await gotoTechLogStudio(
page,
"/studio/documents/11111111-1111-4111-8111-111111111111/edit",
);
await page.getByLabel("요약").fill("dialog axe state");
await page.getByRole("link", { name: "게시 기록", exact: true }).first().click();
results = await new AxeBuilder({ page })
.include("dialog")
.withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"])
.analyze();
expect(blockingViolations(results)).toEqual([]);
});