I got the idea of using a visual diff as part of manual or automated check before pushing to production from Brett Slatkin and https://github.com/bslatkin/dpxdt
This example uses PhantomJs and PixelMatch to generate an image of the running locally and compares it to a baseline image that gives a visual difference so that we can easily spot differences.
PixelMatch is a devDependency while PhantomJs is expected to be installed globally.
- npm run viz:baseline - creates a new baseline image that uses the public Kitchen Sink page
- npm run viz:new - creates a new image based on the the local running at http://127.0.0.1:8888
- npm run viz:check - creates a diff image that highlights the areas where the baseline and new images are different
Typical use after making changes locally:
//example start your local environment
npm run start
//run the visual diff against the existing baseline image
npm run viz:check