Loki for Storybook

Visual Regression Testing for Storybook

README

Loki

Visual Regression Testing for Storybook


GitHub license Tests npm version npm downloads

Loki

Rationale


There are a few visual regression tools for the web, but most either cannot be run headless or use phantomjs which is deprecated and a browser nobody is actuallyusing. They usually also require you to maintain fixtures. With react-native it's now possible to target multiple platforms with a single code base, but there's no single tool to test all to my knowledge.

Loki aims to have easy setup, no to low maintenance cost, reproducible tests independent of which OS they are run on, runnable on CI and support all platforms storybook does.

Supported platforms


Chrome in docker (recommended)
Chrome in AWS Lambda
Local Chrome application
iOS simulator
Android emulator

Prerequisites



Optional dependencies


GraphicsMagick for gm diffing engine,brew install graphicsmagick
Docker for thechrome.dockertarget.
Chrome 59+ for thechrome.apptarget, brew cask install google-chrome-canary.

Installation


  1. ``` null
  2. yarn add loki --dev
  3. yarn loki init

  4. ```

Workflow


Loki will not start any servers for you, so ensure storybook and any simulator/emulator is up and running before running tests.

Start storybook server yarn storybook
Add first set of reference files yarn loki update
Do some changes to your components
Test against references yarn loki test
Review changes in diff folder
Approve changes and update references yarn loki approve

Documentation



Examples



Development


  1. ``` shell
  2. # Install dependencies
  3. yarn
  4. # Start example storybook
  5. yarn workspace @loki/example-react run storybook
  6. # Run example visual tests
  7. yarn workspace @loki/example-react run test
  8. # Run unit tests
  9. yarn test
  10. # Run cli integration tests
  11. cd test/cli && yarn test
  12. ```

Maintainers


|   |   |
| :--- | :--- |
| undefined Joel Arvidsson Author  | undefined Tomas Echeverri Valencia Maintainer |

License


MIT License . © Joel Arvidsson 2017-present