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: {