storybook-addon-storypa11y0.0.9 • Public • Published
To use StoryPa11y, you must use your existing Storybook stories as the input for Jest Testing.
Add the following module into your app.
npm install --save-dev storybook-addon-storypa11y
Create a file matching your jests test regex and add the following code:
This will create a test suite which tests all of your stories for accessibility.
You can pass an options object to the
initStorypa11y function which takes several keys:
configPath: path.join(__dirname, '..', '.storybook'),
You can specify which storybook framework to use. Note that
angular is currently not supported. Defaults to
Here you can specify the path to your storybook config file. This is required in order to initialize storybook correctly.
You can pass a regex to only include matching story kinds in accessibility testing.
You can pass a regex to only include matching stories in accessibility testing.
Relative path from the project root to the folder you build your storybook in. Defaults to
It is also possible to pass your own test function. See stories/failing.test.js for an example.