-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes UXD-1229
- Loading branch information
Showing
6 changed files
with
582 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import type { TestRunnerConfig } from '@storybook/test-runner'; | ||
import { getStoryContext } from '@storybook/test-runner'; | ||
import { injectAxe, checkA11y, configureAxe } from 'axe-playwright'; | ||
|
||
const config: TestRunnerConfig = { | ||
async preVisit(page) { | ||
await injectAxe(page); | ||
}, | ||
async postVisit(page, context) { | ||
const storyContext = await getStoryContext(page, context); | ||
const a11yParams = storyContext.parameters?.a11y | ||
|
||
if (a11yParams?.disable) { | ||
return; | ||
} | ||
await configureAxe(page, { | ||
rules: a11yParams?.config?.rules, | ||
}); | ||
|
||
await checkA11y(page, '#storybook-root', { | ||
detailedReport: true, | ||
detailedReportOptions: { | ||
html: true, | ||
}, | ||
verbose: false, | ||
axeOptions: { | ||
runOnly: ['wcag21aa','wcag22aa','best-practice','EN-301-549'] | ||
}, | ||
}, true, 'v2'); | ||
}, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.