https://github.com/katat/chromediff
A node.js visual regression test library, compare images by using headless Chrome and resemble.js
https://github.com/katat/chromediff
headless-chrome image-comparison nodejs test visual-regression
Last synced: 8 months ago
JSON representation
A node.js visual regression test library, compare images by using headless Chrome and resemble.js
- Host: GitHub
- URL: https://github.com/katat/chromediff
- Owner: katat
- Created: 2017-05-25T03:54:26.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-05T08:03:12.000Z (about 9 years ago)
- Last Synced: 2025-09-27T07:51:36.593Z (8 months ago)
- Topics: headless-chrome, image-comparison, nodejs, test, visual-regression
- Language: JavaScript
- Homepage:
- Size: 575 KB
- Stars: 12
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## ChromeDiff
A node.js visual regression test library, compare images by using headless Chrome and resemble.js
### Install
```bash
npm install chromediff
```
### Usages
Please see tests
### Example
```javascript
let chromeDiff = new ChromeDiff()
let result = await chromeDiff.compare({baseFilePath, newFilePath})
var bitmap = fs.readFileSync(__dirname + '/fixtures/diff.png');
let base64 = new Buffer(bitmap).toString('base64');
assert.equal(false, result.data.isSameDimensions)
assert.equal(13.515779092702171, result.data.rawMisMatchPercentage)
assert.equal(13.52, result.data.misMatchPercentage)
assert.deepEqual({"width": 1, "height": 1}, result.data.dimensionDifference)
assert.deepEqual({"top":0,"left":0,"bottom":259,"right":389}, result.data.diffBounds)
assert(result.data.analysisTime)
assert(!result.diffImgFilePath)
assert.equal(base64, result.imgurl.replace('data:image/png;base64,', ''))
```
#### License
MIT