Skip to content

Instantly share code, notes, and snippets.

View umarmw's full-sized avatar

Umar Waliyullah umarmw

View GitHub Profile
@umarmw
umarmw / assertions-compareScreenshot.js
Last active May 20, 2019 11:29 — forked from richard-flosi/assertions-compareScreenshot.js
Nightwatch with Visual Regression testing
// location: ./assertions/compareScreenshot.js
var resemblejs = require('node-resemble-js'),
fs = require('fs');
exports.assertion = function(filename, expected) {
var screenshotPath = 'test/screenshots/',
baselinePath = screenshotPath + 'baseline/' + filename,
resultPath = screenshotPath + 'results/' + filename,
diffPath = screenshotPath + 'diffs/' + filename;