From 06859e3a27f2e0381752d102994bb491bef89c1f Mon Sep 17 00:00:00 2001 From: Matheus Date: Fri, 18 Jan 2019 11:19:13 -0200 Subject: [PATCH 1/3] created config parameter consoleOutput --- index.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index eececac..388a1a5 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) { @@ -38,15 +41,15 @@ class ResembleHelper extends Helper { }); } - if (options.tolerance !== undefined) + if (options.tolerance !== undefined && 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 +101,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); } From 529ef76d210b6686f8fb07db9935351706945c7a Mon Sep 17 00:00:00 2001 From: Matheus Date: Fri, 18 Jan 2019 12:42:00 -0200 Subject: [PATCH 2/3] added conditional console output for seeVisualDiffElement --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 388a1a5..f46a85e 100644 --- a/index.js +++ b/index.js @@ -132,7 +132,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 { From b9335101e4d66647c0e3aa099cc33738cd1439ab Mon Sep 17 00:00:00 2001 From: Matheus Date: Mon, 21 Jan 2019 09:16:32 -0200 Subject: [PATCH 3/3] fix not declaring tolerance in output conditinal --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index f46a85e..2f02a31 100644 --- a/index.js +++ b/index.js @@ -41,9 +41,11 @@ class ResembleHelper extends Helper { }); } - if (options.tolerance !== undefined && this.config.consoleOutput) + 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) => {