GoodData Test Storybook
Visual regression testing for Storybook
Usage
Note: Run screenshots tests only on CI to ensure the same environment (platform, browser, display pixel density, etc.)
Preparing environment
- Ensure you have Chrome 62 or greater installed
Preparing repository where you want to test Storybook
Running tests
-
Don't forget to build your Storybook into dist-storybook/
folder before you will run next command
-
Run yarn test-storybook
from the root of your repository in which you want to test Storybook. You should specify some parameters:
-p [value]
when you want to run http-server with Storybook on specific (not random free) port, e.g. yarn test-storybook -- -p 9002
-r
when you want to generate reference screenshots first time, i.e. yarn test-storybook -- -r
-
To run tests via GitHub comment you should type extended test - storybook
into GitHub PR comment
-
The link to CI html report appears in GitHub PR comment
Replacement of reference screenshots
- Download new reference screenshot from CI html report
- Replace old reference screenshot in
test-storybook/references/
folder with new one - Commit changes
Release
git checkout master && git pull upstream master
npm version [major|minor|patch]
git commit -am "test-storybook - Release v[your_version]"
npm publish
git push upstream master
Tests
- Unit tests
yarn test
- Lint JavaScript
yarn validate