@parallaxagency/retrogress
Make reference screenshots and check against them before comitting major changes to reduce chances of visual regression.
Last updated 2 years ago by parallaxagency .
ISC · Original npm · Tarball · package.json
$ cnpm install @parallaxagency/retrogress 
SYNC missed versions from official npm registry.

Introduction

Tested on node version v8.9.4.

Retrogress allows you to make reference screenshots and check against them before comitting major changes to see whats changed and hopefully catch bugs earlier.

Uses puppeteer for generating page screenshots and pixelmatch for visual diffing.

Installation

To install retrogress in a project:

yarn add @parallaxagency/retrogress

Then add retrogress in an npm script for some nicer aliases:

{
  "scripts": {
    "diffs:reference": "retrogress --reference",
    "diffs:latest": "retrogress",
    "diffs:compare": "retrogress --diff"
  }
}

And finally you need to add a config file for the routes and sizes you want to generate screenshots for. Retrogress will look for a .retrogress.js file in the project root but you can change where this is located with the --config flag.

Config

The bare minimum you need in your .retrogress.js config is a routes object.

module.exports = {
  routes: {
    'home': 'http://example.com'
  }
}

The following options are available with defaults shown.

module.exports = {
  rootDir: path.join(process.cwd(), '/.retrogress'), // Defaults (not required)
  referenceFolder: 'reference', // Defaults (not required)
  latestFolder: 'latest', // Defaults (not required)
  diffsFolder: 'diffs', // Defaults (not required)
  sizes: [
    {
      width: 1920,
      height: 1080
    },
    {
      width: 320,
      height: 568
    }
  ],
  loadDelay: 1000, // Defaults (not required)
  pixelDifferenceThreshold: 0.1, // Defaults (not required)
  routes: { // (required)
    'home': 'http://example.com/',
    'about': 'http://example.com/about',
    'services-index': 'http://example.com/services',
    'services-view': 'http://example.com/services/view'
  }
}

Usage

Usage is fairly simple, when your happy with how the site looks run: npm run diffs:reference to generate your reference screenshots.

Then after doing any major changes you can run npm run diffs:latest and npm run diffs:compare to view any changes you've made.

All files generated are stored in the .retrogress folder in the project root.

Development Setup

To compile JS with babel and watch for changes:

npm run dev

To make a release version:

npm run transpile

To run linters:

npm run lint

It's unlikely you will even have to run the last two commands as they are automatically run when publishing a new version or committing changes.

Current Tags

  • 1.0.6                                ...           latest (2 years ago)

6 Versions

  • 1.0.6                                ...           2 years ago
  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 3
Last Day 0
Last Week 1
Last Month 9
Dependencies (7)
Dev Dependencies (11)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |