@applitools/eyes-storybook 3.25.2 → 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 +3 -0
- package/package.json +3 -1
- package/src/eyesStorybook.js +19 -4
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/eyes-storybook",
|
|
3
|
-
"version": "3.25.
|
|
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",
|
package/src/eyesStorybook.js
CHANGED
|
@@ -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,
|
|
@@ -203,9 +205,9 @@ async function eyesStorybook({
|
|
|
203
205
|
spinner.fail(failMsg);
|
|
204
206
|
throw new Error();
|
|
205
207
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
|
|
209
|
+
const [getStoriesErr, stories] = await readStoriesWithRetry(MAX_RETRIES);
|
|
210
|
+
|
|
209
211
|
if (getStoriesErr) {
|
|
210
212
|
logger.log('Error in getStories:', getStoriesErr);
|
|
211
213
|
const failMsg = refineErrorMessage({
|
|
@@ -257,6 +259,19 @@ async function eyesStorybook({
|
|
|
257
259
|
function getTransitiongIntoIE() {
|
|
258
260
|
return transitioning;
|
|
259
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
|
+
}
|
|
260
275
|
}
|
|
261
276
|
|
|
262
277
|
module.exports = eyesStorybook;
|