@applitools/eyes-storybook 3.53.1 → 3.53.2
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 +60 -0
- package/dist/getClientAPI.js +14 -1
- package/dist/getStories.js +14 -1
- package/dist/renderStoryWithClientAPI.js +15 -2
- package/dist/runRunAfterScript.js +15 -2
- package/dist/runRunBeforeScript.js +15 -2
- package/package.json +5 -5
- package/src/browser/getClientAPI.js +14 -1
- package/src/browser/getStoryByIndex.js +1 -1
- package/src/browser/renderStoryWithClientAPI.js +1 -1
- package/src/defaultConfig.js +1 -0
- package/src/eyesStorybook.js +11 -4
- package/src/getStoryData.js +4 -2
- package/src/initPage.js +6 -1
- package/src/yargsOptions.js +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.53.2](https://github.com/Applitools-Dev/sdk/compare/js/eyes-storybook@3.53.1...js/eyes-storybook@3.53.2) (2025-01-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* remove side-eyes and fix code scanning issues ([#2712](https://github.com/Applitools-Dev/sdk/issues/2712)) ([cda98e4](https://github.com/Applitools-Dev/sdk/commit/cda98e4748c73cd97c11f646a2b5e26ff9416892))
|
|
9
|
+
* storybook navigation timeouts ([#2701](https://github.com/Applitools-Dev/sdk/issues/2701)) ([64e3a40](https://github.com/Applitools-Dev/sdk/commit/64e3a40a524ae76ec457ae9c2d1170fbaea5e982))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Dependencies
|
|
13
|
+
|
|
14
|
+
* @applitools/dom-snapshot bumped to 4.11.14
|
|
15
|
+
#### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* remove side-eyes and fix code scanning issues ([#2712](https://github.com/Applitools-Dev/sdk/issues/2712)) ([cda98e4](https://github.com/Applitools-Dev/sdk/commit/cda98e4748c73cd97c11f646a2b5e26ff9416892))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
* @applitools/snippets bumped to 2.6.4
|
|
22
|
+
#### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* remove side-eyes and fix code scanning issues ([#2712](https://github.com/Applitools-Dev/sdk/issues/2712)) ([cda98e4](https://github.com/Applitools-Dev/sdk/commit/cda98e4748c73cd97c11f646a2b5e26ff9416892))
|
|
25
|
+
* @applitools/dom-capture bumped to 11.5.4
|
|
26
|
+
#### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* remove side-eyes and fix code scanning issues ([#2712](https://github.com/Applitools-Dev/sdk/issues/2712)) ([cda98e4](https://github.com/Applitools-Dev/sdk/commit/cda98e4748c73cd97c11f646a2b5e26ff9416892))
|
|
29
|
+
* @applitools/eyes bumped to 1.31.0
|
|
30
|
+
#### Features
|
|
31
|
+
|
|
32
|
+
* jsonFilePath in offline mode ([#2734](https://github.com/Applitools-Dev/sdk/issues/2734)) ([2f9fbe8](https://github.com/Applitools-Dev/sdk/commit/2f9fbe8fc3c5212db6b7cc58a98b041c3ffd5572))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
* @applitools/driver bumped to 1.20.3
|
|
37
|
+
|
|
38
|
+
* @applitools/spec-driver-webdriver bumped to 1.1.23
|
|
39
|
+
|
|
40
|
+
* @applitools/spec-driver-selenium bumped to 1.5.94
|
|
41
|
+
|
|
42
|
+
* @applitools/spec-driver-puppeteer bumped to 1.4.23
|
|
43
|
+
|
|
44
|
+
* @applitools/screenshoter bumped to 3.10.3
|
|
45
|
+
|
|
46
|
+
* @applitools/nml-client bumped to 1.8.22
|
|
47
|
+
|
|
48
|
+
* @applitools/ec-client bumped to 1.10.1
|
|
49
|
+
|
|
50
|
+
* @applitools/core bumped to 4.29.0
|
|
51
|
+
#### Features
|
|
52
|
+
|
|
53
|
+
* jsonFilePath in offline mode ([#2734](https://github.com/Applitools-Dev/sdk/issues/2734)) ([2f9fbe8](https://github.com/Applitools-Dev/sdk/commit/2f9fbe8fc3c5212db6b7cc58a98b041c3ffd5572))
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
#### Bug Fixes
|
|
57
|
+
|
|
58
|
+
* support batching tests in distributed env - close batch only when required ([#2733](https://github.com/Applitools-Dev/sdk/issues/2733)) ([2e59e4a](https://github.com/Applitools-Dev/sdk/commit/2e59e4a76edcc02b8888dfc78a42749bae76f79c))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
3
63
|
## [3.53.1](https://github.com/Applitools-Dev/sdk/compare/js/eyes-storybook@3.53.0...js/eyes-storybook@3.53.1) (2024-12-31)
|
|
4
64
|
|
|
5
65
|
|
package/dist/getClientAPI.js
CHANGED
|
@@ -181,7 +181,20 @@ function __getClientAPI(...args) {
|
|
|
181
181
|
throw new Error('Cannot get client API: no frameWindow');
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
async function getClientAPIWithRetries() {
|
|
185
|
+
let error = 'Unknown error';
|
|
186
|
+
for (let attempt = 1; attempt <= 100; attempt++) {
|
|
187
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
188
|
+
try {
|
|
189
|
+
return getClientAPI();
|
|
190
|
+
} catch (e) {
|
|
191
|
+
error = e;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
throw error;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
var getClientAPI_1 = getClientAPIWithRetries;
|
|
185
198
|
|
|
186
199
|
return getClientAPI_1;
|
|
187
200
|
|
package/dist/getStories.js
CHANGED
|
@@ -181,7 +181,20 @@ function __getStories(...args) {
|
|
|
181
181
|
throw new Error('Cannot get client API: no frameWindow');
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
async function getClientAPIWithRetries() {
|
|
185
|
+
let error = 'Unknown error';
|
|
186
|
+
for (let attempt = 1; attempt <= 100; attempt++) {
|
|
187
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
188
|
+
try {
|
|
189
|
+
return getClientAPI();
|
|
190
|
+
} catch (e) {
|
|
191
|
+
error = e;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
throw error;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
var getClientAPI_1 = getClientAPIWithRetries;
|
|
185
198
|
|
|
186
199
|
const DEFAULT_TIMEOUT = 60000;
|
|
187
200
|
|
|
@@ -181,13 +181,26 @@ function __renderStoryWithClientAPI(...args) {
|
|
|
181
181
|
throw new Error('Cannot get client API: no frameWindow');
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
async function getClientAPIWithRetries() {
|
|
185
|
+
let error = 'Unknown error';
|
|
186
|
+
for (let attempt = 1; attempt <= 100; attempt++) {
|
|
187
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
188
|
+
try {
|
|
189
|
+
return getClientAPI();
|
|
190
|
+
} catch (e) {
|
|
191
|
+
error = e;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
throw error;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
var getClientAPI_1 = getClientAPIWithRetries;
|
|
185
198
|
|
|
186
199
|
function renderStoryWithClientAPI(index, id) {
|
|
187
200
|
return new Promise(async resolve => {
|
|
188
201
|
let api;
|
|
189
202
|
try {
|
|
190
|
-
api = getClientAPI_1();
|
|
203
|
+
api = await getClientAPI_1();
|
|
191
204
|
await api.selectStory(index, id);
|
|
192
205
|
api.onStoryRendered(resolve);
|
|
193
206
|
} catch (ex) {
|
|
@@ -181,12 +181,25 @@ function __runRunAfterScript(...args) {
|
|
|
181
181
|
throw new Error('Cannot get client API: no frameWindow');
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
async function getClientAPIWithRetries() {
|
|
185
|
+
let error = 'Unknown error';
|
|
186
|
+
for (let attempt = 1; attempt <= 100; attempt++) {
|
|
187
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
188
|
+
try {
|
|
189
|
+
return getClientAPI();
|
|
190
|
+
} catch (e) {
|
|
191
|
+
error = e;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
throw error;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
var getClientAPI_1 = getClientAPIWithRetries;
|
|
185
198
|
|
|
186
199
|
async function getStoryByIndex(index) {
|
|
187
200
|
let api;
|
|
188
201
|
try {
|
|
189
|
-
api = getClientAPI_1();
|
|
202
|
+
api = await getClientAPI_1();
|
|
190
203
|
const stories = await api.getStories();
|
|
191
204
|
if (!stories[index]) {
|
|
192
205
|
console.log('error cannot get story', index);
|
|
@@ -181,12 +181,25 @@ function __runRunBeforeScript(...args) {
|
|
|
181
181
|
throw new Error('Cannot get client API: no frameWindow');
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
async function getClientAPIWithRetries() {
|
|
185
|
+
let error = 'Unknown error';
|
|
186
|
+
for (let attempt = 1; attempt <= 100; attempt++) {
|
|
187
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
188
|
+
try {
|
|
189
|
+
return getClientAPI();
|
|
190
|
+
} catch (e) {
|
|
191
|
+
error = e;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
throw error;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
var getClientAPI_1 = getClientAPIWithRetries;
|
|
185
198
|
|
|
186
199
|
async function getStoryByIndex(index) {
|
|
187
200
|
let api;
|
|
188
201
|
try {
|
|
189
|
-
api = getClientAPI_1();
|
|
202
|
+
api = await getClientAPI_1();
|
|
190
203
|
const stories = await api.getStories();
|
|
191
204
|
if (!stories[index]) {
|
|
192
205
|
console.log('error cannot get story', index);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/eyes-storybook",
|
|
3
|
-
"version": "3.53.
|
|
3
|
+
"version": "3.53.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
"up:framework": "cd test/fixtures/storybook-versions/${APPLITOOLS_FRAMEWORK_VERSION} && npm ci"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@applitools/core": "4.
|
|
58
|
-
"@applitools/driver": "1.20.
|
|
59
|
-
"@applitools/eyes": "1.
|
|
57
|
+
"@applitools/core": "4.29.0",
|
|
58
|
+
"@applitools/driver": "1.20.3",
|
|
59
|
+
"@applitools/eyes": "1.31.0",
|
|
60
60
|
"@applitools/functional-commons": "1.6.0",
|
|
61
61
|
"@applitools/logger": "2.1.0",
|
|
62
62
|
"@applitools/monitoring-commons": "1.0.19",
|
|
63
|
-
"@applitools/spec-driver-puppeteer": "1.4.
|
|
63
|
+
"@applitools/spec-driver-puppeteer": "1.4.23",
|
|
64
64
|
"@applitools/ufg-client": "1.16.0",
|
|
65
65
|
"@applitools/utils": "1.7.7",
|
|
66
66
|
"boxen": "4.2.0",
|
|
@@ -178,4 +178,17 @@ function getFrameWindow() {
|
|
|
178
178
|
throw new Error('Cannot get client API: no frameWindow');
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
async function getClientAPIWithRetries() {
|
|
182
|
+
let error = 'Unknown error';
|
|
183
|
+
for (let attempt = 1; attempt <= 100; attempt++) {
|
|
184
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
185
|
+
try {
|
|
186
|
+
return getClientAPI();
|
|
187
|
+
} catch (e) {
|
|
188
|
+
error = e;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
throw error;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
module.exports = getClientAPIWithRetries;
|
|
@@ -3,7 +3,7 @@ const getClientAPI = require('./getClientAPI');
|
|
|
3
3
|
async function getStoryByIndex(index) {
|
|
4
4
|
let api;
|
|
5
5
|
try {
|
|
6
|
-
api = getClientAPI();
|
|
6
|
+
api = await getClientAPI();
|
|
7
7
|
const stories = await api.getStories();
|
|
8
8
|
if (!stories[index]) {
|
|
9
9
|
console.log('error cannot get story', index);
|
package/src/defaultConfig.js
CHANGED
package/src/eyesStorybook.js
CHANGED
|
@@ -42,7 +42,7 @@ async function eyesStorybook({
|
|
|
42
42
|
: Number(process.env.APPLITOOLS_CONCURRENT_TABS);
|
|
43
43
|
logger.log(`Running with ${CONCURRENT_TABS} concurrent tabs`);
|
|
44
44
|
|
|
45
|
-
const {storybookUrl, readStoriesTimeout, reloadPagePerStory} = config;
|
|
45
|
+
const {storybookUrl, readStoriesTimeout, reloadPagePerStory, navigationWaitUntil} = config;
|
|
46
46
|
|
|
47
47
|
let iframeUrl;
|
|
48
48
|
try {
|
|
@@ -150,6 +150,7 @@ async function eyesStorybook({
|
|
|
150
150
|
logger,
|
|
151
151
|
takeDomSnapshots: doTakeDomSnapshots,
|
|
152
152
|
reloadPagePerStory,
|
|
153
|
+
navigationWaitUntil,
|
|
153
154
|
});
|
|
154
155
|
const renderStory = makeRenderStory({
|
|
155
156
|
logger: logger.extend({label: 'renderStory'}),
|
|
@@ -220,7 +221,9 @@ async function eyesStorybook({
|
|
|
220
221
|
const spinner = ora({text: 'Reading stories', stream: outputStream});
|
|
221
222
|
spinner.start();
|
|
222
223
|
logger.log('navigating to storybook url:', storybookUrl);
|
|
223
|
-
const [navigateErr] = await presult(
|
|
224
|
+
const [navigateErr] = await presult(
|
|
225
|
+
page.goto(storybookUrl, {timeout: readStoriesTimeout, waitUntil: navigationWaitUntil}),
|
|
226
|
+
);
|
|
224
227
|
if (navigateErr) {
|
|
225
228
|
logger.log('Error when loading storybook', navigateErr);
|
|
226
229
|
const failMsg = refineErrorMessage({
|
|
@@ -284,10 +287,14 @@ async function eyesStorybook({
|
|
|
284
287
|
const [getStoriesErr, stories] = await presult(
|
|
285
288
|
page.evaluate(getStories, {timeout: readStoriesTimeout}),
|
|
286
289
|
);
|
|
287
|
-
if (
|
|
290
|
+
if (stories?.length > 0 || remainingRetries == 0) {
|
|
288
291
|
return [getStoriesErr, stories];
|
|
289
292
|
} else {
|
|
290
|
-
|
|
293
|
+
if (getStoriesErr) {
|
|
294
|
+
logger.log('Error in getStories:', getStoriesErr);
|
|
295
|
+
} else {
|
|
296
|
+
logger.log(`Got 0 stories, retrying to read stories... ${remainingRetries - 1} are left`);
|
|
297
|
+
}
|
|
291
298
|
await delay(RETRY_INTERVAL);
|
|
292
299
|
return await readStoriesWithRetry(remainingRetries - 1);
|
|
293
300
|
}
|
package/src/getStoryData.js
CHANGED
|
@@ -12,7 +12,7 @@ const PAGE_EVALUATE_TIMEOUT = process.env.APPLITOOLS_PAGE_EVALUATE_TIMEOUT || 12
|
|
|
12
12
|
const DOM_SNAPSHOTS_TIMEOUT = 5 * 60 * 1000;
|
|
13
13
|
const utils = require('@applitools/utils');
|
|
14
14
|
|
|
15
|
-
function makeGetStoryData({logger, takeDomSnapshots, reloadPagePerStory}) {
|
|
15
|
+
function makeGetStoryData({logger, takeDomSnapshots, reloadPagePerStory, navigationWaitUntil}) {
|
|
16
16
|
return async function getStoryData({story, storyUrl, page}) {
|
|
17
17
|
const title = getStoryBaselineName(story);
|
|
18
18
|
logger.log(`getting data from story`, title);
|
|
@@ -88,7 +88,9 @@ function makeGetStoryData({logger, takeDomSnapshots, reloadPagePerStory}) {
|
|
|
88
88
|
|
|
89
89
|
async function renderStoryLegacy() {
|
|
90
90
|
logger.log(`getting data from story ${storyUrl}`);
|
|
91
|
-
const [err] = await presult(
|
|
91
|
+
const [err] = await presult(
|
|
92
|
+
page.goto(storyUrl, {timeout: PAGE_EVALUATE_TIMEOUT, waitUntil: navigationWaitUntil}),
|
|
93
|
+
);
|
|
92
94
|
if (err) {
|
|
93
95
|
logger.log(`error navigating to story ${storyUrl}`, err);
|
|
94
96
|
throw err;
|
package/src/initPage.js
CHANGED
|
@@ -46,7 +46,12 @@ function makeInitPage({iframeUrl, config, browser, logger, getTransitiongIntoIE,
|
|
|
46
46
|
await fakeIE({logger, page, pageId});
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const [err] = await presult(
|
|
49
|
+
const [err] = await presult(
|
|
50
|
+
page.goto(iframeUrl, {
|
|
51
|
+
timeout: config.readStoriesTimeout,
|
|
52
|
+
waitUntil: config.navigationWaitUntil,
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
50
55
|
if (err) {
|
|
51
56
|
logger.log(`error navigating to iframe.html`, err);
|
|
52
57
|
if (pagePool.isInPool(pageId)) {
|
package/src/yargsOptions.js
CHANGED
|
@@ -62,6 +62,13 @@ module.exports = {
|
|
|
62
62
|
},
|
|
63
63
|
},
|
|
64
64
|
|
|
65
|
+
navigationWaitUntil: {
|
|
66
|
+
alias: ['navigation-wait-until'],
|
|
67
|
+
description: 'When to consider navigation to be finished',
|
|
68
|
+
requiresArg: false,
|
|
69
|
+
choices: ['load', 'domcontentloaded', 'networkidle0', 'networkidle2'], // PuppeteerLifeCycleEvent values - https://pptr.dev/api/puppeteer.puppeteerlifecycleevent
|
|
70
|
+
},
|
|
71
|
+
|
|
65
72
|
// general
|
|
66
73
|
exitcode: {
|
|
67
74
|
alias: 'e',
|