npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

protractor-image-comparison-test-latest-suchi

v1.5.5

Published

npm-module to compare images with protractor

Downloads

26

Readme

protractor-image-comparison

Join the chat at https://gitter.im/wswebcreation/protractor-image-comparison dependencies Status Build Status Sauce Test Status

NPM

Sauce Test Status

What can it do?

protractor-image-comparison is a lightweight protractor plugin for browsers / mobile browsers / hybrid apps to do image comparison on screens or elements.

You can:

  • save or compare screens / elements against a baseline
  • NEW: save or compare a fullpage screenshot against a baseline (desktop AND mobile are now supported)
  • NEW automatically create a baseline when no baseline is there
  • disable css animations by default
  • ignore anti-aliasing differences
  • compare images by ignoring their colors (do a grayscale comparison)
  • blockout custom regions during comparison (all)
  • NEW ignore regions by making them transparent in the base image (all) thanks to tharders
  • NEW parameter to hide / show scrollbars pnad
  • increase the element dimenisions screenshots (all)
  • provide custom iOS and Android offsets for status-/address-/toolbar (mobile only)
  • automatically exclude a statusbar during screencomparison (mobile only)

Comparison is based on ResembleJS.

Installation

Install this module locally with the following command:

npm install protractor-image-comparison

Save to dependencies or dev-dependencies:

npm install --save protractor-image-comparison
npm install --save-dev protractor-image-comparison

Usage

protractor-image-comparison can be used for:

  • desktop browsers (Chrome / Firefox / Safari / Internet Explorer 11 / Microsoft Edge)
  • mobile / tablet browsers (Chrome / Safari on emulators / real devices) via Appium
  • Hybrid apps via Appium

For more information about mobile testing see the Appium documentation.

If you run for the first time without having a baseline the check-methods will reject the promise with the following warning:

`Image not found, saving current image as new baseline.`

This means that the current screenshot is saved and you manually need to copy it to your baseline. If you instantiate protractor-image-comparsion with autoSaveBaseline: true, see docs, the image will automatically be saved into the baselinefolder.

protractor-image-comparison provides:

  • two comparison methods checkScreen and checkElement.
  • two helper methods saveScreen and saveElement for saving images.
  • NEW a helper saveFullPageScreens and a comparison method checkFullPageScreen for saving and comparing a fullpage screenshot.

The comparison methods return a result in percentages like 0 or 3.94. protractor-image-comparison can work with Jasmine and Cucumber.js. See Examples for or a protractor-config setup, or a Jasmine or a CucumberJS implementation.

More information about the methods can be found here.

Conventions

See conventions.md.

Contribution

See CONTRIBUTING.md.

FAQ

Width and height cannot be negative

It could be that the error Width and height cannot be negative is thrown. 9 out of 10 times this is related to creating an image of an element that is not in the view. Please be sure you always make sure the element in is in the view before you try to make an image of the element.

Changing the color on an element is not detected by protractor-image-comparison

When using Chrome and using the chromeOptions.args:['--disable-gpu'] it could be possible that the images can't be compared in the correct way. If you remove this argument all will work again. See here

Credits

TODO

  • Update documentation for Mobile
  • New (mobile friendly) testpage