|
1 |
| -const { Helper } = require('codeceptjs'); |
| 1 | +const { Helper } = require("codeceptjs"); |
2 | 2 | const resemble = require("resemblejs");
|
3 | 3 | const fs = require("fs");
|
4 | 4 | const assert = require("assert");
|
@@ -30,7 +30,7 @@ interface Options {
|
30 | 30 | needsSameDimension?: boolean;
|
31 | 31 | outputSettings?: any;
|
32 | 32 | prepareBaseImage?: boolean;
|
33 |
| - compareWithImage?: any |
| 33 | + compareWithImage?: any; |
34 | 34 | }
|
35 | 35 |
|
36 | 36 | interface Endpoint {
|
@@ -69,7 +69,7 @@ class ResembleHelper extends Helper {
|
69 | 69 | outputDir = require("codeceptjs").config.get().output || "output";
|
70 | 70 | this.baseFolder = this.resolvePath(config.baseFolder);
|
71 | 71 | this.diffFolder = this.resolvePath(config.diffFolder);
|
72 |
| - this.screenshotFolder = this.resolvePath(config.screenshotFolder || 'output'); |
| 72 | + this.screenshotFolder = this.resolvePath(config.screenshotFolder || "output"); |
73 | 73 | this.prepareBaseImage = config.prepareBaseImage;
|
74 | 74 | }
|
75 | 75 |
|
@@ -230,15 +230,15 @@ class ResembleHelper extends Helper {
|
230 | 230 | */
|
231 | 231 |
|
232 | 232 | async _addAttachment(baseImage: any, misMatch: any, options: Options) {
|
233 |
| - const allure: any = require('codeceptjs').container.plugins("allure"); |
| 233 | + const allure: any = require("codeceptjs").container.plugins("allure"); |
234 | 234 |
|
235 | 235 | if (allure !== undefined && misMatch >= options.tolerance) {
|
236 | 236 | allure.addScreenDiff(
|
237 |
| - 'Screen Diff', |
238 |
| - fs.readFileSync(this._getBaseImagePath(baseImage, options), { encoding: 'base64' }), |
239 |
| - fs.readFileSync(this._getActualImagePath(baseImage), { encoding: 'base64' }), |
240 |
| - fs.readFileSync(this._getDiffImagePath(baseImage), { encoding: 'base64' }) |
241 |
| - ) |
| 237 | + "Screen Diff", |
| 238 | + fs.readFileSync(this._getBaseImagePath(baseImage, options), { encoding: "base64" }), |
| 239 | + fs.readFileSync(this._getActualImagePath(baseImage), { encoding: "base64" }), |
| 240 | + fs.readFileSync(this._getDiffImagePath(baseImage), { encoding: "base64" }), |
| 241 | + ); |
242 | 242 | }
|
243 | 243 | }
|
244 | 244 |
|
@@ -562,25 +562,25 @@ class ResembleHelper extends Helper {
|
562 | 562 | }
|
563 | 563 |
|
564 | 564 | _getHelper() {
|
565 |
| - if (this.helpers['Puppeteer']) { |
566 |
| - return this.helpers['Puppeteer']; |
| 565 | + if (this.helpers["Puppeteer"]) { |
| 566 | + return this.helpers["Puppeteer"]; |
567 | 567 | }
|
568 | 568 |
|
569 |
| - if (this.helpers['WebDriver']) { |
570 |
| - return this.helpers['WebDriver']; |
| 569 | + if (this.helpers["WebDriver"]) { |
| 570 | + return this.helpers["WebDriver"]; |
571 | 571 | }
|
572 |
| - if (this.helpers['Appium']) { |
573 |
| - return this.helpers['Appium']; |
| 572 | + if (this.helpers["Appium"]) { |
| 573 | + return this.helpers["Appium"]; |
574 | 574 | }
|
575 |
| - if (this.helpers['WebDriverIO']) { |
576 |
| - return this.helpers['WebDriverIO']; |
| 575 | + if (this.helpers["WebDriverIO"]) { |
| 576 | + return this.helpers["WebDriverIO"]; |
577 | 577 | }
|
578 |
| - if (this.helpers['TestCafe']) { |
579 |
| - return this.helpers['TestCafe']; |
| 578 | + if (this.helpers["TestCafe"]) { |
| 579 | + return this.helpers["TestCafe"]; |
580 | 580 | }
|
581 | 581 |
|
582 |
| - if (this.helpers['Playwright']) { |
583 |
| - return this.helpers['Playwright']; |
| 582 | + if (this.helpers["Playwright"]) { |
| 583 | + return this.helpers["Playwright"]; |
584 | 584 | }
|
585 | 585 |
|
586 | 586 | throw Error(`No matching helper found. Supported helpers: ${supportedHelper.join("/")}`);
|
|
0 commit comments