Giter VIP home page Giter VIP logo

whoopsie's Introduction

Whoopsie

Build Status Coverage Status

Whoopsie is a visual regression tool for testing responsive web sites.

Installation

$ npm install -g whoopsie

Configuration

By default Whoopsie will read configuration from .whoopsie-config.yml in the current directory. See config/sample.yml for a sample configuration file.

Configuration can be loaded from another path with the --config or -c flag:

$ whoopsie test -c path/to/config.yml

Usage

Commands

gallery

Run visual regression tests and generate an HTML gallery containing the results. This command is an alias for whoopsie test --reporter gallery.

$ whoopsie gallery

test

Run visual regression tests. Uses the json reporter by default.

$ whoopsie test

generate-gallery

Generate a gallery from the JSON output of whoopsie test. Useful if you generate JSON results in CI and want to view the results in a gallery locally.

$ whoopsie generate-gallery

validate-config

Check that the configuration file is valid.

$ whoopsie validate-config

Options

Name Default value Description
--reporter or r json Test result reporter(s) to use
--concurrency or -C 4 Number of tests to run concurrently
--verbose or -v <Off> Print extra information while running
--debug or -vv <Off> Print extra information and debug messages while running
--quiet or -q <Off> Only print errors while running

Reporters

Reporters can be specified when running whoopsie test by passing the --reporter flag. More than one reporter can be specified. The default reporter is json.

gallery

Outputs test results as an HTML gallery.

json

Outputs test results as JSON.

{
    "summary": {
        "total": 2,
        "failures": 0,
        "passes": 2
    },
    "results": [
        {
            "base": {
                "type": "selector",
                "selector": ".nw-c-top-stories",
                "id": "capture$ad367858",
                "page": {
                    "path": "/news",
                    "selectors": [
                        ".nw-c-top-stories",
                        ".nw-c-must-see"
                    ],
                    "url": "http://www.bbc.com/news"
                },
                "imagePath": "/tmp/whoopsie-capture$ad367858-0.png"
            },
            "test": {
                "type": "selector",
                "selector": ".nw-c-top-stories",
                "id": "capture$c1dbebb0",
                "page": {
                    "path": "/news",
                    "selectors": [
                        ".nw-c-top-stories",
                        ".nw-c-must-see"
                    ],
                    "url": "http://www.test.bbc.com/news"
                },
                "imagePath": "/tmp/whoopsie-capture$c1dbebb0-0.png"
            },
            "diff": {
                "total": 0,
                "percentage": 0,
                "id": "compare$520b7196",
                "imagePath": "/tmp/whoopsie-compare$520b7196.png"
            },
            "viewport": {
                "width": 640,
                "isMobile": true
            }
        },
        {
            "base": { ... },
            "test": { ... },
            "diff": { ... },
            "viewport": { ... }
        }
    ]
}

Docker

If you prefer to run Whoopsie in a container, you can use the official Docker image:

$ docker pull wildlyinaccurate/whoopsie
$ docker run --rm --volume $PWD:/whoopsie --workdir /whoopsie \
    wildlyinaccurate/whoopsie \
    whoopsie gallery

License

ISC

whoopsie's People

Contributors

greenkeeperio-bot avatar snyk-bot avatar wildlyinaccurate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

whoopsie's Issues

Error: spawn convert ENOENT

What am I doing wrong?

whoopsie gallery test/whoopsie.yaml --verbose

Capturing http://www.bbc.co.uk/news/ at 320px
Capturing http://www.test.bbc.co.uk/news/ at 320px
Capturing http://www.bbc.co.uk/news/ at 600px
Capturing http://www.test.bbc.co.uk/news/ at 600px
Capturing http://www.bbc.co.uk/news/ at 1020px
Capturing http://www.test.bbc.co.uk/news/ at 1020px
Capturing http://www.bbc.co.uk/news/technology at 320px
Capturing http://www.test.bbc.co.uk/news/technology at 320px
Capturing http://www.bbc.co.uk/news/technology at 600px
Capturing http://www.test.bbc.co.uk/news/technology at 600px
Capturing http://www.bbc.co.uk/news/technology at 1020px
Capturing http://www.test.bbc.co.uk/news/technology at 1020px
Capturing http://www.bbc.co.uk/news/technology-36387563 at 320px
Capturing http://www.test.bbc.co.uk/news/technology-36387563 at 320px
Capturing http://www.bbc.co.uk/news/technology-36387563 at 600px
Capturing http://www.test.bbc.co.uk/news/technology-36387563 at 600px
Comparing captures of http://www.bbc.co.uk/news/technology-36387563 and http://www.test.bbc.co.uk/news/technology-36387563 at 320px
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: spawn convert ENOENT
    at exports._errnoException (util.js:1012:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:182:32)
    at onErrorNT (internal/child_process.js:348:16)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Tool  Version
node v6.3.1
npm 3.10.6
Whoopsie  v0.5.0
OSX  10.11.4

Add --verbose flag

Show messages like:

  • Taking capture of http://... at Npx
  • Comparing captures of http://... and http:// at Npx
  • Generating gallery for N results
  • Gallery generated to /path/to/index.html

v1.0

This is a meta issue for tracking v1.0 issues.

  • Add reporter option rather than having separate test and gallery commands
  • Add selectors option that takes screenshots of individual elements instead of the whole page
  • Improve gallery output (#15)
  • Exit with code >0 on failure (#18)
  • Improve error messages (#27)

Improve gallery output

  • Summary table at the top (matrix of all tests)
  • Clip (overflow: hidden; max-height: Npx) images, with an "expand" button to show the full images for each test.
  • Filters
    • Width
    • Difference

Improve error messages

There are a few cases where Whoopsie blows up and gives some unhelpful error messages:

  • PhantomJS errors when loading the page or taking the screenshot
  • ImageMagick errors while running compare
  • ImageMagick not installed

Most of these should be caught and shown as warnings rather than being fatal errors.

Docker: Unhandled rejection convert

docker run --rm --volume $PWD:/whoopsie --workdir /whoopsie \
    wildlyinaccurate/whoopsie \
    whoopsie gallery test/whoopsie.yaml
Unhandled rejection convert: geometry does not contain image `/tmp/magick-58CCthXesYFPZh' @ warning/attribute.c/GetImageBoundingBox/247.

Unhandled rejection convert: geometry does not contain image `/tmp/magick-65yh8Dj8DT72Fm' @ warning/attribute.c/GetImageBoundingBox/247.

Unhandled rejection convert: geometry does not contain image `/tmp/magick-73Ct-8akHJW5qu' @ warning/attribute.c/GetImageBoundingBox/247.

My gallery is empty :-(

Trim whitespace from bottom of images

This can be done with something like:

  convert in.png \
          -background white -splice 0x1 -background black -splice 0x1 \
          -trim +repage -chop 0x1 out.png

Assuming that -gravity defaults to North-West

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.