@applitools/eyes-storybook 3.24.0 → 3.25.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,33 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 3.25.3 - 2021/11/1
6
+
7
+ - add a retry machanisem for cases we get 0 stories
8
+
9
+ ## 3.25.2 - 2021/10/30
10
+
11
+ - replace legacy logger construction with new
12
+ - deprecate `waitBeforeScreenshot` and introduce `waitBeforeCapture` instead
13
+ - updated to @applitools/driver@1.2.7 (from 1.2.6)
14
+ - updated to @applitools/eyes-puppeteer@1.8.5 (from 1.8.4)
15
+ - updated to @applitools/eyes-sdk-core@12.23.24 (from 12.23.18)
16
+ - updated to @applitools/test-server@1.0.6 (from 1.0.5)
17
+ - updated to @applitools/visual-grid-client@15.8.43 (from 15.8.37)
18
+
19
+ ## 3.25.1 - 2021/10/20
20
+
21
+ - updated to @applitools/eyes-puppeteer@1.8.4 (from 1.8.3)
22
+ - updated to @applitools/eyes-sdk-core@12.23.18 (from 12.23.17)
23
+ - updated to @applitools/visual-grid-client@15.8.37 (from 15.8.36)
24
+
25
+ ## 3.25.0 - 2021/10/18
26
+
27
+ - updated to @applitools/driver@1.2.6 (from 1.1.3)
28
+ - updated to @applitools/eyes-puppeteer@1.8.3 (from 1.8.2)
29
+ - updated to @applitools/eyes-sdk-core@12.23.17 (from 12.23.0)
30
+ - updated to @applitools/test-server@1.0.5 (from 1.0.4)
31
+ - updated to @applitools/visual-grid-client@15.8.36 (from 15.8.21)
5
32
 
6
33
  ## 3.24.0 - 2021/8/23
7
34
 
package/README.md CHANGED
@@ -4,43 +4,51 @@ Applitools Eyes SDK for [Storybook](http://storybook.js.org).
4
4
 
5
5
  ### Table of contents
6
6
 
7
- - [Installation](#installation)
8
- * [Install npm package](#install-npm-package)
9
- * [Applitools API key](#applitools-api-key)
10
- - [Usage](#usage)
11
- * [Configuring local storybook server](#configuring-local-storybook-server)
12
- * [Standalone server](#standalone-server)
13
- * [Command line arguments](#command-line-arguments)
14
- - [Concurrency](#concurrency)
15
- - [Advanced configuration](#advanced-configuration)
16
- * [Method 1: Environment variables](#method-1--environment-variables)
17
- * [Method 2: The `applitools.config.js` file](#method-2--the--applitoolsconfigjs--file)
18
- - [Configuring the browser](#configuring-the-browser)
19
- * [Previous browser versions](#previous-browser-versions)
20
- * [Getting a screenshot of multiple browsers in parallel](#getting-a-screenshot-of-multiple-browsers-in-parallel)
21
- * [Device emulation](#device-emulation)
22
- * [Faking IE Browser](#faking-ie-browser)
23
- - [Per component configuration](#per-component-configuration)
24
- * [`include`](#include)
25
- * [`variations`](#variations)
26
- * [`waitBeforeScreenshot`](#waitbeforescreenshot)
27
- * [`properties`](#properties)
28
- * [`ignoreRegions`](#ignoreregions)
29
- * [`floatingRegions`](#floatingregions)
30
- * [`layoutRegions`](#layoutregions)
31
- * [`contentRegions`](#contentregions)
32
- * [`strictRegions`](#strictregions)
33
- * [`accessibilityRegions`](#accessibilityregions)
34
- * [`accessibilityValidation`](#accessibilityvalidation)
35
- * [Parameters that cannot be set as an Advanced configuration](#parameters-that-cannot-be-set-as-an-advanced-configuration)
36
- * [`runBefore`](#runbefore)
37
- * [`runAfter`](#runafter)
38
- * [`scriptHooks`](#scripthooks)
39
- + [beforeCaptureScreenshot](#beforecapturescreenshot)
40
- * [`layoutBreakpoints`](#layoutBreakpoints)
41
- - [Running Eyes-Storybook in Docker](#running-eyes-storybook-in-docker)
42
- - [Dealing with dynamic data](#dealing-with-dynamic-data)
43
- - [Troubleshooting](#troubleshooting)
7
+ - [Eyes-Storybook](#eyes-storybook)
8
+ - [Table of contents](#table-of-contents)
9
+ - [Installation](#installation)
10
+ - [Install npm package](#install-npm-package)
11
+ - [Applitools API key](#applitools-api-key)
12
+ - [Usage](#usage)
13
+ - [Configuring local storybook server](#configuring-local-storybook-server)
14
+ - [Standalone server](#standalone-server)
15
+ - [Command line arguments](#command-line-arguments)
16
+ - [Concurrency](#concurrency)
17
+ - [Advanced configuration](#advanced-configuration)
18
+ - [Method 1: Environment variables](#method-1-environment-variables)
19
+ - [Method 2: The `applitools.config.js` file](#method-2-the-applitoolsconfigjs-file)
20
+ - [Configuring the browser](#configuring-the-browser)
21
+ - [Previous browser versions](#previous-browser-versions)
22
+ - [Getting a screenshot of multiple browsers in parallel](#getting-a-screenshot-of-multiple-browsers-in-parallel)
23
+ - [Device emulation](#device-emulation)
24
+ - [iOS device](#ios-device)
25
+ - [Faking IE Browser](#faking-ie-browser)
26
+ - [Per component configuration](#per-component-configuration)
27
+ - [`include`](#include)
28
+ - [global](#global)
29
+ - [component](#component)
30
+ - [`variations`](#variations)
31
+ - [`waitBeforeCapture`](#waitbeforecapture)
32
+ - [`properties`](#properties)
33
+ - [`ignoreRegions`](#ignoreregions)
34
+ - [`floatingRegions`](#floatingregions)
35
+ - [`layoutRegions`](#layoutregions)
36
+ - [`contentRegions`](#contentregions)
37
+ - [`strictRegions`](#strictregions)
38
+ - [`accessibilityRegions`](#accessibilityregions)
39
+ - [`accessibilityValidation`](#accessibilityvalidation)
40
+ - [`ignoreDisplacements`](#ignoredisplacements)
41
+ - [`sendDom`](#senddom)
42
+ - [`visualGridOptions`](#visualgridoptions)
43
+ - [`scriptHooks`](#scripthooks)
44
+ - [beforeCaptureScreenshot](#beforecapturescreenshot)
45
+ - [Parameters that cannot be set as an advanced configuration](#parameters-that-cannot-be-set-as-an-advanced-configuration)
46
+ - [`runBefore` and `runAfter` functions](#runbefore-and-runafter-functions)
47
+ - [`runBefore`](#runbefore)
48
+ - [`runAfter`](#runafter)
49
+ - [`layoutBreakpoints`](#layoutbreakpoints)
50
+ - [Running Eyes-Storybook in Docker](#running-eyes-storybook-in-docker)
51
+ - [Dealing with dynamic data](#dealing-with-dynamic-data)
44
52
 
45
53
  ## Installation
46
54
 
@@ -169,7 +177,7 @@ In addition to command-line arguments, it's possible to define the following con
169
177
  | `jsonFilePath` | undefined | Directory path of a results file. If set, then a [JSON](https://www.json.org/json-en.html) file is created in this directory, the file is created with the name eyes.json and contains the Eyes test results. |
170
178
  | `tapFilePath` | undefined | Directory path of a results file. If set, then a [TAP](https://en.wikipedia.org/wiki/Test_Anything_Protocol#Specification) file is created in this directory, the file is created with the name eyes.tap and contains the Eyes test results. |
171
179
  | `xmlFilePath` | undefined | Directory path of a results file. If set, then a [XUnit XML](https://google.github.io/rich-test-results/xunitxml) file is created in this directory, the file is created with the name eyes.xml and contains the Eyes test results. |
172
- | `waitBeforeScreenshot` | undefined | Selector, function or timeout.<br/>If ```number``` then the argument is treated as time in milliseconds to wait before all screenshots.<br/>If ```string``` then the argument is treated as a selector for elements to wait for before all screenshots.<br/>If ```function```, then the argument is treated as a predicate to wait for before all screenshots.<br/><hr/>For per component configuration see [waitBeforeScreenshot.](#waitBeforeScreenshot)<br/>Note that we use Puppeteer's [page.waitForTimeout()](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagewaitfortimeoutmilliseconds), [page.waitForSelector()](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagewaitforselectorselector-options), [page.waitForXPath()](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagewaitforxpathxpath-options) and [page.waitForFunction()](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagewaitforfunctionpagefunction-options-args), checkout it's API for more details. |
180
+ | `waitBeforeCapture` | undefined | Selector, function or timeout.<br/>If ```number``` then the argument is treated as time in milliseconds to wait before all screenshots.<br/>If ```string``` then the argument is treated as a selector for elements to wait for before all screenshots.<br/>If ```function```, then the argument is treated as a predicate to wait for before all screenshots.<br/><hr/>For per component configuration see [waitBeforeCapture.](#waitBeforeCapture)<br/>Note that we use Puppeteer's [page.waitForTimeout()](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagewaitfortimeoutmilliseconds), [page.waitForSelector()](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagewaitforselectorselector-options), [page.waitForXPath()](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagewaitforxpathxpath-options) and [page.waitForFunction()](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagewaitforfunctionpagefunction-options-args), checkout it's API for more details. |
173
181
  | `include` | true | A predicate function, a string or a regular expression specifying which stories should be visually tested.<br/>Visual baselines will be created only for the components specified.<br/>The function receives an object with ```name```, ```kind```, ```storyTitle``` and ```parameters``` properties.<br/>For example (exclude all stories with a name that start with [SKIP]):<br/>```({name, kind, storyTitle, parameters}) => !/^\[SKIP\]/.test(name)```<br/>For more information, see [per component configuration - include](#include). |
174
182
  | `variations` | undefined | Specifies additional variations for all or some of the stories. For example, RTL. For more information, see [per component configuration - variations](#variations).|
175
183
  | `notifyOnCompletion` | false | If `true` batch completion notifications are sent. |
@@ -439,20 +447,20 @@ storiesOf('Components that support RTL', module)
439
447
  )
440
448
  ```
441
449
 
442
- ### `waitBeforeScreenshot`
450
+ ### `waitBeforeCapture`
443
451
 
444
452
  Selector or timeout, see [advanced configuration](#advanced-configuration) for more details.
445
453
 
446
454
  ```js
447
- storiesOf('Components with a waitBeforeScreenshot', module)
455
+ storiesOf('Components with a waitBeforeCapture', module)
448
456
  .add(
449
457
  'Some story',
450
458
  () => <span id="container" class="loading"></span>,
451
- {eyes: { waitBeforeScreenshot: '#container.ready' }}
459
+ {eyes: { waitBeforeCapture: '#container.ready' }}
452
460
  );
453
461
  ```
454
462
 
455
- _Note that the predicate option for `waitBeforeScreenshot` is currently not available in the per component configuration._
463
+ _Note that the predicate option for `waitBeforeCapture` is currently not available in the per component configuration._
456
464
 
457
465
  ### `properties`
458
466
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/eyes-storybook",
3
- "version": "3.24.0",
3
+ "version": "3.25.3",
4
4
  "description": "",
5
5
  "engines": {
6
6
  "node": ">=8.6.0"
@@ -25,10 +25,12 @@
25
25
  "storybook": "start-storybook -c test/fixtures/appWithStorybook -p 9001 -s test/fixtures",
26
26
  "storybook:jslayout": "start-storybook -c test/fixtures/jsLayoutStorybookLocal -p 9001 -s test/fixtures",
27
27
  "storybook:heavy": "start-storybook -c test/fixtures/heavyStorybook -p 9002 -s test/fixtures",
28
+ "storybook:zeroStories": "start-storybook -c test/fixtures/zeroStoriesRetry -p 9003 -s test/fixtures",
28
29
  "eyes-storybook": "node bin/eyes-storybook.js -f test/fixtures/applitools.config.js",
29
30
  "eyes-storybook:jslayout": "node bin/eyes-storybook.js -f test/e2e/happy-config/layout-breakpoints-local.config.js",
30
31
  "eyes-storybook:heavy": "node bin/eyes-storybook.js -f test/fixtures/heavyStorybook/applitools.config.js",
31
32
  "eyes-storybook:configured": "node bin/eyes-storybook.js -f scripts/preconfigured.config.js",
33
+ "eyes-storybook:zeroStories": "node bin/eyes-storybook.js -f test/fixtures/zeroStoriesRetry/applitools.config.js",
32
34
  "changelog": "git changelog -x -p -f v$npm_package_version > History.md && git add ./History.md && git commit -am 'changelog'",
33
35
  "changelog:init": "git config changelog.format \"* %s [[%h]($(echo $npm_package_repository_url|cut -d+ -f2|cut -d. -f1-2)/commit/%H)]\"",
34
36
  "changelog:install": "sudo apt-get install git-extras",
@@ -52,16 +54,18 @@
52
54
  "license": "SEE LICENSE IN LICENSE",
53
55
  "repository": {
54
56
  "type": "git",
55
- "url": "git://github.com/applitools/eyes.sdk.javascript1.git"
57
+ "url": "git://github.com/applitools/eyes.sdk.javascript1.git",
58
+ "directory": "packages/eyes-storybook"
56
59
  },
57
60
  "dependencies": {
58
- "@applitools/driver": "1.1.3",
59
- "@applitools/eyes-puppeteer": "1.8.2",
60
- "@applitools/eyes-sdk-core": "12.23.0",
61
+ "@applitools/driver": "1.2.7",
62
+ "@applitools/eyes-puppeteer": "1.8.5",
63
+ "@applitools/eyes-sdk-core": "12.23.24",
61
64
  "@applitools/functional-commons": "1.6.0",
65
+ "@applitools/logger": "1.0.5",
62
66
  "@applitools/monitoring-commons": "1.0.19",
63
- "@applitools/test-server": "1.0.4",
64
- "@applitools/visual-grid-client": "15.8.21",
67
+ "@applitools/test-server": "1.0.6",
68
+ "@applitools/visual-grid-client": "15.8.43",
65
69
  "boxen": "4.2.0",
66
70
  "chalk": "3.0.0",
67
71
  "detect-port": "1.3.0",
@@ -74,10 +78,10 @@
74
78
  },
75
79
  "devDependencies": {
76
80
  "@applitools/scripts": "^1.0.1",
77
- "@applitools/sdk-release-kit": "0.13.0",
78
- "@applitools/sdk-shared": "0.9.5",
81
+ "@applitools/sdk-release-kit": "0.13.4",
82
+ "@applitools/sdk-shared": "0.9.7",
79
83
  "@applitools/snaptdout": "^1.0.1",
80
- "@applitools/utils": "1.2.2",
84
+ "@applitools/utils": "1.2.4",
81
85
  "@storybook/addon-options": "^5.2.8",
82
86
  "@storybook/react": "^5.2.8",
83
87
  "@testing-library/dom": "^5.6.1",
package/src/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  const yargs = require('yargs');
3
- const {Logger} = require('@applitools/eyes-sdk-core');
3
+ const {makeLogger} = require('@applitools/logger');
4
4
  const {configParams: externalConfigParams} = require('@applitools/visual-grid-client');
5
5
  const VERSION = require('../package.json').version;
6
6
  const eyesStorybook = require('./eyesStorybook');
@@ -32,8 +32,7 @@ const {performance, timeItAsync} = makeTiming();
32
32
  console.log(`Using @applitools/eyes-storybook version ${VERSION}.\n`);
33
33
 
34
34
  const config = generateConfig({argv, defaultConfig, externalConfigParams});
35
- const logger = new Logger(config.showLogs, 'eyes');
36
- logger.setIncludeTime(true);
35
+ const logger = makeLogger({level: config.showLogs ? 'info' : 'silent', label: 'eyes'});
37
36
  await validateAndPopulateConfig({config, logger, packagePath: process.cwd()});
38
37
  logger.log(`Running with the following config:\n${configDigest(config)}`);
39
38
  const [err, results] = await presult(
@@ -7,8 +7,9 @@ module.exports = {
7
7
  storybookUrl: undefined,
8
8
  storybookStaticDir: undefined,
9
9
  showStorybookOutput: false,
10
- waitBeforeScreenshot: 50,
10
+ waitBeforeScreenshot: 50, // backward compatibility
11
11
  waitBeforeScreenshots: 50, // backward compatibility
12
+ waitBeforeCapture: 50,
12
13
  viewportSize: {width: 1024, height: 768},
13
14
  tapFilePath: undefined,
14
15
  xmlFilePath: undefined,
@@ -2,7 +2,7 @@
2
2
  const puppeteer = require('puppeteer');
3
3
  const getStories = require('../dist/getStories');
4
4
  const {makeVisualGridClient} = require('@applitools/visual-grid-client');
5
- const {presult} = require('@applitools/functional-commons');
5
+ const {presult, delay} = require('@applitools/functional-commons');
6
6
  const chalk = require('./chalkify');
7
7
  const makeInitPage = require('./initPage');
8
8
  const makeRenderStory = require('./renderStory');
@@ -24,6 +24,8 @@ const {splitConfigsByBrowser} = require('./shouldRenderIE');
24
24
  const executeRenders = require('./executeRenders');
25
25
 
26
26
  const CONCURRENT_PAGES = 3;
27
+ const MAX_RETRIES = 10;
28
+ const RETRY_INTERVAL = 1000;
27
29
 
28
30
  async function eyesStorybook({
29
31
  config,
@@ -37,7 +39,7 @@ async function eyesStorybook({
37
39
  let transitioning = false;
38
40
  takeMemLoop();
39
41
  logger.log('eyesStorybook started');
40
- const {storybookUrl, waitBeforeScreenshot, readStoriesTimeout, reloadPagePerStory} = config;
42
+ const {storybookUrl, waitBeforeCapture, readStoriesTimeout, reloadPagePerStory} = config;
41
43
 
42
44
  let iframeUrl;
43
45
  try {
@@ -76,8 +78,8 @@ async function eyesStorybook({
76
78
  });
77
79
  const pagePool = createPagePool({initPage, logger});
78
80
 
79
- const doTakeDomSnapshots = async ({page, layoutBreakpoints}) => {
80
- const driver = new Driver({spec, driver: page, logger: logger._getNewLogger()});
81
+ const doTakeDomSnapshots = async ({page, layoutBreakpoints, waitBeforeCapture}) => {
82
+ const driver = new Driver({spec, driver: page, logger});
81
83
  const skipResources = getResourceUrlsInCache();
82
84
  const result = await takeDomSnapshots({
83
85
  logger,
@@ -90,6 +92,7 @@ async function eyesStorybook({
90
92
  getViewportSize: () => config.viewportSize,
91
93
  getIosDevicesSizes,
92
94
  getEmulatedDevicesSizes,
95
+ waitBeforeCapture,
93
96
  });
94
97
  return result;
95
98
  };
@@ -120,7 +123,7 @@ async function eyesStorybook({
120
123
  const getStoryData = makeGetStoryData({
121
124
  logger,
122
125
  takeDomSnapshots: doTakeDomSnapshots,
123
- waitBeforeScreenshot,
126
+ waitBeforeCapture,
124
127
  });
125
128
 
126
129
  const renderStory = makeRenderStory({
@@ -202,9 +205,9 @@ async function eyesStorybook({
202
205
  spinner.fail(failMsg);
203
206
  throw new Error();
204
207
  }
205
- const [getStoriesErr, stories] = await presult(
206
- page.evaluate(getStories, {timeout: readStoriesTimeout}),
207
- );
208
+
209
+ const [getStoriesErr, stories] = await readStoriesWithRetry(MAX_RETRIES);
210
+
208
211
  if (getStoriesErr) {
209
212
  logger.log('Error in getStories:', getStoriesErr);
210
213
  const failMsg = refineErrorMessage({
@@ -256,6 +259,19 @@ async function eyesStorybook({
256
259
  function getTransitiongIntoIE() {
257
260
  return transitioning;
258
261
  }
262
+
263
+ async function readStoriesWithRetry(remainingRetries) {
264
+ const [getStoriesErr, stories] = await presult(
265
+ page.evaluate(getStories, {timeout: readStoriesTimeout}),
266
+ );
267
+ if (getStoriesErr || stories.length > 0 || remainingRetries == 0) {
268
+ return [getStoriesErr, stories];
269
+ } else {
270
+ logger.log(`Got 0 stories, retrying to read stories... ${remainingRetries - 1} are left`);
271
+ await delay(RETRY_INTERVAL);
272
+ return await readStoriesWithRetry(remainingRetries - 1);
273
+ }
274
+ }
259
275
  }
260
276
 
261
277
  module.exports = eyesStorybook;
@@ -14,24 +14,29 @@ function generateConfig({argv = {}, defaultConfig = {}, externalConfigParams = [
14
14
  const result = Object.assign({}, defaultConfig, config, argvConfig);
15
15
 
16
16
  // backward compatibility
17
- if (
18
- result.waitBeforeScreenshots !== defaultConfig.waitBeforeScreenshots &&
19
- result.waitBeforeScreenshot === defaultConfig.waitBeforeScreenshot
20
- ) {
21
- console.log(
22
- deprecationWarning({
23
- deprecatedThing: "'waitBeforeScreenshots'",
24
- newThing: "'waitBeforeScreenshot' (no 's')",
25
- }),
26
- );
27
- result.waitBeforeScreenshot = result.waitBeforeScreenshots;
17
+ if (result.waitBeforeCapture === defaultConfig.waitBeforeCapture) {
18
+ if (result.waitBeforeScreenshots !== defaultConfig.waitBeforeScreenshots) {
19
+ console.log(
20
+ deprecationWarning({
21
+ deprecatedThing: "'waitBeforeScreenshots'",
22
+ newThing: "'waitBeforeCapture'",
23
+ }),
24
+ );
25
+ result.waitBeforeCapture = result.waitBeforeScreenshots;
26
+ }
27
+ if (result.waitBeforeScreenshot !== defaultConfig.waitBeforeScreenshot) {
28
+ console.log(
29
+ deprecationWarning({
30
+ deprecatedThing: "'waitBeforeScreenshot'",
31
+ newThing: "'waitBeforeCapture'",
32
+ }),
33
+ );
34
+ result.waitBeforeCapture = result.waitBeforeScreenshot;
35
+ }
28
36
  }
29
37
 
30
- if (
31
- typeof result.waitBeforeScreenshot === 'string' &&
32
- !isNaN(parseInt(result.waitBeforeScreenshot))
33
- ) {
34
- result.waitBeforeScreenshot = Number(result.waitBeforeScreenshot);
38
+ if (typeof result.waitBeforeCapture === 'string' && !isNaN(parseInt(result.waitBeforeCapture))) {
39
+ result.waitBeforeCapture = Number(result.waitBeforeCapture);
35
40
  }
36
41
 
37
42
  if (result.showLogs === '1') {
@@ -8,7 +8,7 @@ const {URL} = require('url');
8
8
  const runRunAfterScript = require('../dist/runRunAfterScript');
9
9
  const waitFor = require('./waitFor');
10
10
 
11
- function makeGetStoryData({logger, takeDomSnapshots, waitBeforeScreenshot, reloadPagePerStory}) {
11
+ function makeGetStoryData({logger, takeDomSnapshots, waitBeforeCapture, reloadPagePerStory}) {
12
12
  return async function getStoryData({story, storyUrl, page, waitBeforeStory}) {
13
13
  const title = getStoryTitle(story);
14
14
  logger.log(`getting data from story`, title);
@@ -32,9 +32,9 @@ function makeGetStoryData({logger, takeDomSnapshots, waitBeforeScreenshot, reloa
32
32
  await renderStoryLegacy();
33
33
  }
34
34
 
35
- const wait = waitBeforeStory || waitBeforeScreenshot;
35
+ const wait = waitBeforeStory || waitBeforeCapture;
36
36
  if (typeof wait === 'number') {
37
- ArgumentGuard.greaterThanOrEqualToZero(wait, 'waitBeforeScreenshot', true);
37
+ ArgumentGuard.greaterThanOrEqualToZero(wait, 'waitBeforeCapture', true);
38
38
  }
39
39
  if (wait) {
40
40
  logger.log(`waiting before screenshot of ${title} ${wait}`);
@@ -52,6 +52,12 @@ function makeGetStoryData({logger, takeDomSnapshots, waitBeforeScreenshot, reloa
52
52
  const snapshots = await takeDomSnapshots({
53
53
  page,
54
54
  layoutBreakpoints: eyesParameters ? eyesParameters.layoutBreakpoints : undefined,
55
+ waitBeforeCapture: wait
56
+ ? async () => {
57
+ logger.log(`waiting before screenshot of ${title} ${wait}`);
58
+ await waitFor(page, wait);
59
+ }
60
+ : undefined,
55
61
  });
56
62
 
57
63
  if (eyesParameters && eyesParameters.runAfter) {
@@ -62,7 +62,7 @@ function makeRenderStories({
62
62
  const story = stories[currIndex++];
63
63
  const storyUrl = getStoryUrl(story, storybookUrl);
64
64
  const title = getStoryTitle(story);
65
- const {waitBeforeScreenshot} = (story.parameters && story.parameters.eyes) || {};
65
+ const {waitBeforeCapture} = (story.parameters && story.parameters.eyes) || {};
66
66
 
67
67
  try {
68
68
  let [error, storyData] = await presult(
@@ -70,7 +70,7 @@ function makeRenderStories({
70
70
  story,
71
71
  storyUrl,
72
72
  page,
73
- waitBeforeStory: waitBeforeScreenshot,
73
+ waitBeforeStory: waitBeforeCapture,
74
74
  }),
75
75
  );
76
76
 
@@ -90,7 +90,7 @@ function makeRenderStories({
90
90
  story,
91
91
  storyUrl,
92
92
  page: newPageObj.page,
93
- waitBeforeStory: waitBeforeScreenshot,
93
+ waitBeforeStory: waitBeforeCapture,
94
94
  }),
95
95
  );
96
96
  error = newError;