Skip to content

Commit 7bb0c3b

Browse files
committed
screenshotFolder paramter
Removed the dependence of the screenshotFolder parameter in the cofig file
1 parent c043b88 commit 7bb0c3b

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,17 @@ Example:
2020
"helpers": {
2121
"ResembleHelper" : {
2222
"require": "codeceptjs-resemblehelper",
23-
"screenshotFolder" : "./tests/output/",
2423
"baseFolder": "./tests/screenshots/base/",
2524
"diffFolder": "./tests/screenshots/diff/"
2625
}
2726
}
2827
}
2928
```
30-
To use the Helper, users must provide the three parameters:
31-
32-
`screenshotFolder` : This will always have the same value as `output` in Codecept configuration, this is the folder where webdriverIO
33-
saves a screenshot when using `I.saveScreenshot` method
29+
To use the Helper, users must provide the two parameters:
3430

3531
`baseFolder`: This is the folder for base images, which will be used with screenshot for comparison
3632

37-
`diffFolder`: This will the folder where resemble would try to store the difference image, which can be viewed later,
33+
`diffFolder`: This will the folder where resemble would try to store the difference image, which can be viewed later.
3834

3935
Usage, these are major functions that help in visual testing
4036

@@ -138,7 +134,6 @@ It can be used by adding the *aws* code inside `"ResembleHelper"` in the `"helpe
138134
"helpers": {
139135
"ResembleHelper" : {
140136
"require": "codeceptjs-resemblehelper",
141-
"screenshotFolder" : "<location of output folder>",
142137
"baseFolder": "<location of base folder>",
143138
"diffFolder": "<location of diff folder>",
144139
"aws": {

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,13 @@ class ResembleHelper extends Helper {
8484
async screenshotElement(selector, name) {
8585
const helper = this._getHelper();
8686
if(this.helpers['Puppeteer']){
87-
const configuration = this.config;
88-
8987
await helper.waitForVisible(selector);
9088
const els = await helper._locate(selector);
9189
if (!els.length) throw new Error(`Element ${selector} couldn't be located`);
9290
const el = els[0];
9391

9492
await el.screenshot({
95-
path: configuration.screenshotFolder + name + '.png'
93+
path: global.output_dir + "/" + name + '.png'
9694
});
9795
}
9896
else throw new Error("Method only works with Puppeteer");
@@ -230,6 +228,7 @@ class ResembleHelper extends Helper {
230228
}
231229

232230
const awsC = this.config.aws;
231+
this.config.screenshotFolder = global.output_dir + "/";
233232

234233
if (awsC !== undefined && options.prepareBaseImage === false) {
235234
await this._download(awsC.accessKeyId, awsC.secretAccessKey, awsC.region, awsC.bucketName, baseImage);
@@ -268,6 +267,7 @@ class ResembleHelper extends Helper {
268267
}
269268

270269
const awsC = this.config.aws;
270+
this.config.screenshotFolder = global.output_dir + "/";
271271

272272
if (awsC !== undefined && options.prepareBaseImage === false) {
273273
await this._download(awsC.accessKeyId, awsC.secretAccessKey, awsC.region, awsC.bucketName, baseImage);

0 commit comments

Comments
 (0)