diff --git a/index.js b/index.js index eececac..2f02a31 100644 --- a/index.js +++ b/index.js @@ -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) { @@ -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) { @@ -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); } @@ -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 {