storybook/docs/snippets/common/storybook-test-runner-a11y-config.js.mdx
Norbert de Langen 36702ebe0c
I changed #root => #storybook-root
I changed #docs-root => #storybook-docs
2022-08-02 11:18:33 +02:00

23 lines
509 B
Plaintext

```js
// .storybook/test-runner.js
const { injectAxe, checkA11y } = require('axe-playwright');
/*
* See https://storybook.js.org/docs/7.0/react/writing-tests/test-runner#test-hook-api-experimental
* to learn more about the test-runner hooks API.
*/
module.exports = {
async preRender(page) {
await injectAxe(page);
},
async postRender(page) {
await checkA11y(page, '#storybook-root', {
detailedReport: true,
detailedReportOptions: {
html: true,
},
});
},
};
```