Skip to content
Permalink
Browse files

Enable non-inlined screenshots (#166)

Apologies for the delay! It looks good
  • Loading branch information...
tiborv authored and gkushang committed Feb 21, 2019
1 parent 389e7ff commit 0d29c4aac86158a220fb42572f06e10dc4529d1d
Showing with 10 additions and 1 deletion.
  1. +8 −0 README.md
  2. +2 −1 lib/reporter.js
@@ -201,6 +201,14 @@ Applicable if `storeScreenshots=true`. Relative path for directory where screens
}
```

#### `noInlineScreenshots`
Type: `Boolean`
Default: `undefined`

`true`: Applicable if `storeScreenshots=true`. Avoids inlining screenshots, uses relative path to screenshots instead (i.e. enables lazy loading of images).

`false` or `undefined`: Keeps screenshots inlined.

#### `metadata`
Type: `JSON` (optional)
Default: `undefined`
@@ -269,13 +269,14 @@ var generateReport = function (options) {
if ((options.storeScreenshots && options.storeScreenshots === true) ||
(options.storeScreenShots && options.storeScreenShots === true)) {

var name = sanitize(step.name || step.keyword);
var name = sanitize(step.name || step.keyword, /[^a-zA-Z0-9/-]+/g); // Only allow URL-friendly file names
if (!fs.existsSync(screenshotsDirectory)) {
fs.mkdirSync(screenshotsDirectory);
}
name = name + '_' + Math.round(Math.random() * 10000) + '.png'; //randomize the file name
var filename = path.join(screenshotsDirectory, name);
fs.writeFileSync(filename, embedding.data, 'base64');
if (options.noInlineScreenshots) step.image = path.relative(path.join(options.output, '..'), filename);
}
} else {
var file = 'data:application/octet-stream;base64,' + embedding.data;

0 comments on commit 0d29c4a

Please sign in to comment.
You can’t perform that action at this time.