Test storybook pages with axe and puppeteer.
$ yarn add @shopify/storybook-a11y-test
Make sure you have built your storybook instance and there is an iframe.html
file that you can point the test towards.
const {testPages, getCurrentStoryIds} = require('./built-a11y-package');
(async () => {
const iframePath = `file://${__dirname}/../build/storybook/static/iframe.html`;
const timeout = 1000;
const storyIds = await getCurrentStoryIds({iframePath, skippedStoryIds: []});
const results = await testPages({iframePath, storyIds, timeout});
if (results.length) {
console.error(`‼️ Test failures found`);
console.log(results.join('\n'));
process.exit(1);
} else {
console.log('🧚♀️ Accessibility is all g');
}
})();
The location of the built storybook iframe.html
file.
An array of storybook id's to skip.
The location of the built storybook iframe.html
file.
An array of storybook id's to run. These can be retrieved via the getCurrentStoryIds()
function.
The number of tabs to open in chromium. The default option is based off the number of CPU cores available os.cpus().length
.
The goto timeout for the provided url. Defaults to 3000 (puppeteer default)