Loki
👁 Visual Regression Testing for Storybook
Install / Use
/learn @oblador/LokiREADME
Visual Regression Testing for Storybook
<img src="https://user-images.githubusercontent.com/378279/28074070-f0052fac-6657-11e7-8a9d-398a12d2d6a8.png" width="672" height="494" alt="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 actually using. 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 the
chrome.dockertarget. - Chrome 59+ for the
chrome.apptarget,brew cask install google-chrome-canary.
Installation
yarn add loki --dev
yarn loki init
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
# Install dependencies
yarn
# Start example storybook
yarn workspace @loki/example-react run storybook
# Run example visual tests
yarn workspace @loki/example-react run test
# Run unit tests
yarn test
# Run cli integration tests
cd test/cli && yarn test
Maintainers
<table> <tbody> <tr> <td align="center"> <a href="https://github.com/oblador"> <img width="150" height="150" src="https://github.com/oblador.png?v=3&s=150"> <br /> <strong>Joel Arvidsson</strong> </a> <br /> Author </td> <td align="center"> <a href="https://github.com/techeverri"> <img width="150" height="150" src="https://github.com/techeverri.png?v=3&s=150"> <br /> <strong>Tomas Echeverri Valencia</strong> </a> <br /> Maintainer </td> </tr> <tbody> </table>License
MIT License. © Joel Arvidsson 2017-present
Related Skills
bluebubbles
341.2kUse when you need to send or manage iMessages via BlueBubbles (recommended iMessage integration). Calls go through the generic message tool with channel="bluebubbles".
gh-issues
341.2kFetch GitHub issues, spawn sub-agents to implement fixes and open PRs, then monitor and address PR review comments. Usage: /gh-issues [owner/repo] [--label bug] [--limit 5] [--milestone v1.0] [--assignee @me] [--fork user/repo] [--watch] [--interval 5] [--reviews-only] [--cron] [--dry-run] [--model glm-5] [--notify-channel -1002381931352]
node-connect
341.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
slack
341.2kUse when you need to control Slack from OpenClaw via the slack tool, including reacting to messages or pinning/unpinning items in Slack channels or DMs.
