Skip to content

created config parameter consoleOutput #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ class ResembleHelper extends Helper {
async _compareImages (image1, image2, diffImage, options) {
image1 = this.config.baseFolder + image1;
image2 = this.config.screenshotFolder + image2;

if(typeof this.config.consoleOutput == 'undefined')
{
this.config.consoleOutput = true
}
return new Promise((resolve, reject) => {
if (options.boundingBox !== undefined)
{
Expand All @@ -40,13 +43,15 @@ class ResembleHelper extends Helper {

if (options.tolerance !== undefined)
{
console.log("Tolerance Level Provided " + options.tolerance);
if(this.config.consoleOutput){
console.log("Tolerance Level Provided " + options.tolerance);
}
var tolerance = options.tolerance;
}
resemble.compare(image1, image2, options, (err, data) => {
resemble.compare(image1, image2, options, (err, data) => {
if (err) {
reject(err);
} else {
} else {
resolve(data);
if (data.misMatchPercentage >= tolerance) {
mkdirp(getDirName(this.config.diffFolder + diffImage), function (err) {
Expand Down Expand Up @@ -98,7 +103,9 @@ class ResembleHelper extends Helper {
}

var misMatch = await this._fetchMisMatchPercentage(baseImage, options);
console.log("MisMatch Percentage Calculated is " + misMatch);
if(this.config.consoleOutput){
console.log("MisMatch Percentage Calculated is " + misMatch);
}
assert(misMatch <= options.tolerance, "MissMatch Percentage " + misMatch);
}

Expand Down Expand Up @@ -127,7 +134,10 @@ class ResembleHelper extends Helper {

options.boundingBox = await this._getBoundingBox(selector);
var misMatch = await this._fetchMisMatchPercentage(baseImage, options);
console.log("MisMatch Percentage Calculated is " + misMatch);
if(this.config.consoleOutput)
{
console.log("MisMatch Percentage Calculated is " + misMatch);
}
assert(misMatch <= options.tolerance, "MissMatch Percentage " + misMatch);
}
else {
Expand Down