Files
clean-architecture-frontend…/tests/storybook/workshop.spec.ts
T
DongHyeonka f92cfd9a98 test(storybook): workshop spec이 a11y 애드온 자동 검사와 겹치지 않는다
문제
깨끗한 clone의 FE-GATE-008에서 test:storybook이 "Axe is already running"으로
떨어졌고, 이 worktree에서도 두 번에 한 번 떨어진다. @storybook/addon-a11y
10.6.5(13-03이 올린 판)는 story를 그린 뒤 afterEach에서 axe를 스스로 돌린다
(globals.a11y.manual이 true가 아니면). spec의 AxeBuilder.analyze()는 그 페이지의
같은 axe 인스턴스를 쓰므로, 두 실행이 겹치면 두 번째가 거절된다.

고른 방법
- spec이 story를 `globals=a11y.manual:!true`로 연다. 애드온은 자동 검사를
  건너뛰고, 접근성 판정은 지금처럼 spec의 AxeBuilder가 한다.
- 버린 대안: 애드온 실행이 끝나길 axe 내부 상태로 기다리기. 공개 API가
  아니고, 애드온 실행이 시작되기 전에 확인하면 여전히 겹친다.
- 버린 대안: preview 전체에서 애드온 자동 검사 끄기. workshop에서 쓰는
  사람이 패널 결과를 잃는다.

위험·한계
- 이 spec만 바꿨다. 다른 storybook spec이 생기면 같은 URL을 쓴다.

검증
- test:storybook 5회 연속 통과(heavy lock). 수정 전 2회 중 1회 실패.

Refs: docs/reviews/2026-11-03-maturity-review/README.md 14.5
2026-11-05 00:50:44 +09:00

29 lines
1.0 KiB
TypeScript

import AxeBuilder from "@axe-core/playwright";
import {
expect,
test,
} from "../support/browser/strict-browser-test.ts";
test("runs the isolated overlay interaction with blocking accessibility", async ({
page,
}) => {
// The a11y addon runs axe on its own after the story renders unless the
// a11y global is manual. Its run and AxeBuilder's below share the page's axe
// instance, so the second one failed with "Axe is already running" whenever
// they overlapped. This test owns the accessibility check.
await page.goto(
"/iframe.html?id=platform-design-system--overlay-interaction&viewMode=story&globals=a11y.manual:!true",
);
const trigger = page.getByRole("button", { name: "Open dialog" });
await expect(trigger).toBeVisible();
await trigger.click();
await expect(
page.getByRole("dialog", { name: "Confirm platform action" }),
).toBeVisible();
const results = await new AxeBuilder({ page }).analyze();
expect(results.violations).toEqual([]);
await page.keyboard.press("Escape");
await expect(trigger).toBeFocused();
});