webapp/.storybook/test-runner.ts

24 lines
628 B
TypeScript
Raw Permalink Normal View History

2024-09-24 06:48:39 +00:00
import type { Page } from '@playwright/test'
2024-09-03 07:06:39 +00:00
import type { TestRunnerConfig } from '@storybook/test-runner'
import { checkA11y, injectAxe } from 'axe-playwright'
/*
* See https://storybook.js.org/docs/react/writing-tests/test-runner#test-hook-api-experimental
* to learn more about the test-runner hooks API.
*/
2024-09-24 06:48:39 +00:00
const a11yConfig = {
async preRender(page: Page) {
2024-09-03 07:06:39 +00:00
await injectAxe(page)
},
2024-09-24 06:48:39 +00:00
async postRender(page: Page) {
2024-09-03 07:06:39 +00:00
await checkA11y(page, '#storybook-root', {
detailedReport: true,
detailedReportOptions: {
html: true
}
})
}
2024-09-24 06:48:39 +00:00
} as TestRunnerConfig
2024-09-03 07:06:39 +00:00
module.exports = a11yConfig