Skip to content

screenshotFolder paramter #39

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 2 commits into from
Sep 2, 2019
Merged
Show file tree
Hide file tree
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
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,14 @@ Example:
"helpers": {
"ResembleHelper" : {
"require": "codeceptjs-resemblehelper",
"screenshotFolder" : "./tests/output/",
"baseFolder": "./tests/screenshots/base/",
"diffFolder": "./tests/screenshots/diff/"
}
}
}
```

To use the Helper, users must provide the three parameters:

`screenshotFolder`: This will always have the same value as `output` in CodeceptJS configuration, this is the folder where WebdriverIO saves a screenshot when using `I.saveScreenshot` method.
To use the Helper, users must provide the two parameters:

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

Expand Down Expand Up @@ -139,7 +136,6 @@ It can be used by adding the *aws* code inside `"ResembleHelper"` in the `"helpe
"helpers": {
"ResembleHelper" : {
"require": "codeceptjs-resemblehelper",
"screenshotFolder" : "<location of output folder>",
"baseFolder": "<location of base folder>",
"diffFolder": "<location of diff folder>",
"aws": {
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,13 @@ class ResembleHelper extends Helper {
async screenshotElement(selector, name) {
const helper = this._getHelper();
if(this.helpers['Puppeteer']){
const configuration = this.config;

await helper.waitForVisible(selector);
const els = await helper._locate(selector);
if (!els.length) throw new Error(`Element ${selector} couldn't be located`);
const el = els[0];

await el.screenshot({
path: configuration.screenshotFolder + name + '.png'
path: global.output_dir + "/" + name + '.png'
});
} else if (this.helpers['WebDriver']) {
const configuration = this.config;
Expand Down Expand Up @@ -252,6 +250,7 @@ class ResembleHelper extends Helper {
}

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

if (awsC !== undefined && options.prepareBaseImage === false) {
await this._download(awsC.accessKeyId, awsC.secretAccessKey, awsC.region, awsC.bucketName, baseImage);
Expand Down Expand Up @@ -290,6 +289,7 @@ class ResembleHelper extends Helper {
}

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

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