This gist documents the setup I originally used to run visual diffs on the MDC Web demo pages for testing material-components/material-components-web#1285, but I have used it since then on other projects.
- Create a directory containing the js and txt files from this gist
npm i
- In your code checkout, switch to the branch you want to compare against, e.g. main, and run the dev server
- If you've run these scripts before, run
rm -r ss-*
in the directory to clean out files from the previous run - In the folder with these files, run
node puppeteer
which will produce ass
subdirectory mv ss ss-old
- In your code checkout, switch to the branch with the changes to test. Depending on whether there are significant changes e.g. added files, you may want to shut down the dev server before switching branch and restart it after.
- In the folder with these files, run
node puppeteer
which will again produce ass
subdirectory mv ss ss-new
- Run
node blinkdiff
, which will produce ass-diff
subdirectory and output results to stdout
The blinkdiff.js
script will output any notable results (any pages with any changes, regardless of whether
they're over or under threshold) first, followed by a list of the files that had no observed changes.
For any files with noted changes, you can look at ss-diff/<filename>.png
to see a visual diff
(left = old, right = new, middle highlights what changed).
You can see an example of what a diff looks like in material-components/material-components-web#1286.