Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pix-diff

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pix-diff - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

4

CHANGELOG.md
Changelog
=========
v1.0.2 - Added image save methods (17/12/2014)
v1.0.1 - Add missing percentage sign and documentation (12/12/2014)
v1.0.0 - Initial release (11/12/14)
v1.0.0 - Initial release (11/12/2014)
var BlinkDiff = require('blink-diff'),
PNGImage = require('png-image'),
assert = require('assert'),

@@ -68,2 +69,61 @@ path = require('path'),

/**
* Saves an image of the screen
*
* @method saveScreen
* @example
* browser.pixdiff.saveScreen('imageA');
*
* @param {string} tag
* @public
*/
saveScreen: function (tag) {
return this._flow.execute(function () {
return browser.takeScreenshot()
.then(function (image) {
tag = util.format('%s-%s-%sx%s.png', tag, this._capabilities.browserName, this._width, this._height);
return new PNGImage({
imagePath: new Buffer(image, 'base64'),
imageOutputPath: path.join(this._basePath, tag)
}).runWithPromise();
}.bind(this));
}.bind(this));
},
/**
* Saves an image of the screen region
*
* @method saveRegion
* @example
* browser.pixdiff.saveRegion(element(By.id('elementId')), 'imageA');
*
* @param {promise} element
* @param {string} tag
* @public
*/
saveRegion: function (element, tag) {
var size,
rect;
return this._flow.execute(function () {
return element.getSize()
.then(function (elementSize) {
size = elementSize;
return element.getLocation();
})
.then(function (point) {
rect = {height: size.height, width: size.width, x: point.x, y: point.y};
return browser.takeScreenshot();
})
.then(function (image) {
tag = util.format('%s-%s-%sx%s.png', tag, this._capabilities.browserName, this._width, this._height);
return new PNGImage({
imagePath: new Buffer(image, 'base64'),
imageOutputPath: path.join(this._basePath, tag),
cropImage: rect
}).runWithPromise();
}.bind(this));
}.bind(this));
},
/**
* Runs the comparison against the screen

@@ -73,3 +133,3 @@ *

* @example
* browser.pixImage.checkScreen('imageA', {debug: true});
* browser.pixdiff.checkScreen('imageA', {debug: true});
*

@@ -107,3 +167,3 @@ * @param {string} tag

* @example
* browser.pixImage.checkScreen(element(By.id('elementId')), 'imageA', {debug: true});
* browser.pixdiff.checkRegion(element(By.id('elementId')), 'imageA', {debug: true});
*

@@ -110,0 +170,0 @@ * @param {promise} element

{
"name": "pix-diff",
"version": "1.0.1",
"version": "1.0.2",
"description": "Protractor plugin for image comparison",
"main": "index.js",
"dependencies": {
"blink-diff": "^1.0.7",
"png-image": "^1.0.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/koola/pix-diff.git"
},
"keywords": [
"image-diff",
"pix",
"blink",
"image",
"diff",
"difference",
"compare"
],
"author": "Koola",
"license": "MIT",
"main": "index.js",
"bugs": {
"url": "https://github.com/yahoo/blink-diff/issues"
},
"homepage": "https://github.com/yahoo/blink-diff",
"author": {
"name": "koola",
"email": "koola.uk@gmail.com"
},
"repository": {
"type": "git",
"url": "https://github.com/koola/pix-diff.git"
},
"keywords": [
"image-diff",
"pix",
"blink",
"image",
"diff",
"difference",
"compare"
],
"dependencies": {
"blink-diff": ">=1.0.7"
},
"devDependencies": {
"protractor": "^1.4.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"maintainers": [
{
"name": "koola",
"email": "koola.uk@gmail.com"
}
]
"bugs": {
"url": "https://github.com/koola/pix-diff/issues"
},
"homepage": "https://github.com/koola/pix-diff"
}

@@ -43,3 +43,3 @@ Pix-Diff

PixDiff provides two comparison methods ```checkScreen``` and ```checkRegion``` along with two jasmine matchers ```toMatch``` and ```toNotMatch```.
PixDiff provides two comparison methods ```checkScreen``` and ```checkRegion``` along with two jasmine matchers ```toMatch``` and ```toNotMatch```. Two helper methods ```saveScreen``` and ```saveRegion``` are provided for saving images.

@@ -127,2 +127,3 @@ **Example:**

* [blink-diff](https://github.com/yahoo/blink-diff)
* [png-image](https://github.com/koola/png-image)

@@ -129,0 +130,0 @@ ###Dev-Dependencies

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc