From 58834630d06c7fb1082e38fb805f2e2eeb9106bc Mon Sep 17 00:00:00 2001 From: Eugene Kim Date: Sat, 8 Jun 2024 01:34:59 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20test-runner=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/wow-ui/.storybook/test-runner.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/wow-ui/.storybook/test-runner.ts b/packages/wow-ui/.storybook/test-runner.ts index fc12dcc4..7c8c95b8 100644 --- a/packages/wow-ui/.storybook/test-runner.ts +++ b/packages/wow-ui/.storybook/test-runner.ts @@ -1,5 +1,5 @@ -import type { TestRunnerConfig } from "@storybook/test-runner"; -import { injectAxe, checkA11y } from "axe-playwright"; +import { getStoryContext, type TestRunnerConfig } from "@storybook/test-runner"; +import { injectAxe, checkA11y, configureAxe } from "axe-playwright"; /* * See https://storybook.js.org/docs/writing-tests/test-runner#test-hook-api @@ -9,7 +9,13 @@ const config: TestRunnerConfig = { async preVisit(page) { await injectAxe(page); }, - async postVisit(page) { + async postVisit(page, context) { + const storyContext = await getStoryContext(page, context); + + await configureAxe(page, { + rules: storyContext.parameters?.a11y?.config?.rules, + }); + await checkA11y(page, "#storybook-root", { detailedReport: true, detailedReportOptions: {