@applitools/eyes-storybook 3.63.8 → 3.63.9-debug-20260126

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
@@ -1,5 +1,38 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.63.9](https://github.com/Applitools-Dev/sdk/compare/js/eyes-storybook@3.63.8...js/eyes-storybook@3.63.9) (2026-01-21)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * handle page expiration with ad-hoc creation in renderStories | AD-12491 ([#3485](https://github.com/Applitools-Dev/sdk/issues/3485)) ([d10664b](https://github.com/Applitools-Dev/sdk/commit/d10664b16f5d518ffe2578c6b3547161f6d69581))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * @applitools/dom-snapshot bumped to 4.15.7
14
+ #### Bug Fixes
15
+
16
+ * add fetchConcurrency to dom-snapshot | FLD-4062 ([#3486](https://github.com/Applitools-Dev/sdk/issues/3486)) ([f523791](https://github.com/Applitools-Dev/sdk/commit/f523791b9bc60029ec0b4b6914bc54e0110bd4a2))
17
+ * @applitools/ufg-client bumped to 1.19.0
18
+ #### Features
19
+
20
+ * add `fetchConcurrency` parameter to `makeAutonomousCore` FLD-4063 ([#3480](https://github.com/Applitools-Dev/sdk/issues/3480)) ([df0c60d](https://github.com/Applitools-Dev/sdk/commit/df0c60d5e74703550dba036299db7360065524f6))
21
+ * @applitools/core bumped to 4.56.0
22
+ #### Features
23
+
24
+ * add `fetchConcurrency` parameter to `makeAutonomousCore` FLD-4063 ([#3480](https://github.com/Applitools-Dev/sdk/issues/3480)) ([df0c60d](https://github.com/Applitools-Dev/sdk/commit/df0c60d5e74703550dba036299db7360065524f6))
25
+
26
+
27
+ #### Bug Fixes
28
+
29
+ * add fetchConcurrency to dom-snapshot | FLD-4062 ([#3486](https://github.com/Applitools-Dev/sdk/issues/3486)) ([f523791](https://github.com/Applitools-Dev/sdk/commit/f523791b9bc60029ec0b4b6914bc54e0110bd4a2))
30
+
31
+
32
+
33
+ * @applitools/eyes bumped to 1.38.1
34
+
35
+
3
36
  ## [3.63.8](https://github.com/Applitools-Dev/sdk/compare/js/eyes-storybook@3.63.7...js/eyes-storybook@3.63.8) (2026-01-19)
4
37
 
5
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/eyes-storybook",
3
- "version": "3.63.8",
3
+ "version": "3.63.9-debug-20260126",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "applitools",
@@ -59,14 +59,14 @@
59
59
  "up:framework": "cd test/fixtures/storybook-versions/${APPLITOOLS_FRAMEWORK_VERSION} && npm ci"
60
60
  },
61
61
  "dependencies": {
62
- "@applitools/core": "4.55.0",
62
+ "@applitools/core": "4.56.0",
63
63
  "@applitools/driver": "1.25.0",
64
- "@applitools/eyes": "1.38.0",
64
+ "@applitools/eyes": "1.38.1",
65
65
  "@applitools/functional-commons": "1.6.0",
66
66
  "@applitools/logger": "2.2.7",
67
67
  "@applitools/monitoring-commons": "1.0.19",
68
68
  "@applitools/spec-driver-puppeteer": "1.7.0",
69
- "@applitools/ufg-client": "1.18.3",
69
+ "@applitools/ufg-client": "1.19.0",
70
70
  "@applitools/utils": "1.14.1",
71
71
  "@inquirer/prompts": "7.0.1",
72
72
  "boxen": "4.2.0",
@@ -106,5 +106,15 @@
106
106
  },
107
107
  "publishConfig": {
108
108
  "access": "public"
109
+ },
110
+ "lavamoat": {
111
+ "allowScripts": {
112
+ "@applitools/core>ws>bufferutil": false,
113
+ "@applitools/core>ws>utf-8-validate": false,
114
+ "@storybook/react>@pmmmwh/react-refresh-webpack-plugin>core-js-pure": false,
115
+ "core-js": false,
116
+ "puppeteer": true,
117
+ "@storybook/react>core-js": false
118
+ }
109
119
  }
110
120
  }
@@ -3,7 +3,6 @@ const {URL} = require('url');
3
3
 
4
4
  function getIframeUrl(baseUrl) {
5
5
  const {origin, pathname, search} = new URL(baseUrl);
6
- const searchParam = search && search.replace(/^\?/, '&');
7
6
 
8
7
  let baseUrlFixed = `${origin}${pathname.replace(/\/[^\/]+\.html/, '')}`;
9
8
 
@@ -11,10 +10,15 @@ function getIframeUrl(baseUrl) {
11
10
  baseUrlFixed += '/';
12
11
  }
13
12
 
14
- const url = new URL(
15
- `iframe.html?eyes-storybook=true${searchParam ? searchParam : ''}`,
16
- baseUrlFixed,
17
- );
13
+ const url = new URL('iframe.html', baseUrlFixed);
14
+ url.searchParams.set('eyes-storybook', 'true');
15
+ if (search) {
16
+ const origParams = new URLSearchParams(search);
17
+ for (const [k, v] of origParams) {
18
+ if (k === 'path') continue; // skip story selection on initial load
19
+ url.searchParams.set(k, v);
20
+ }
21
+ }
18
22
  return url.href;
19
23
  }
20
24
 
@@ -18,7 +18,67 @@ function makeRenderStories({
18
18
  eventEmitter = new EventEmitter(),
19
19
  signal = new AbortController().signal,
20
20
  }) {
21
- let newPageIdToAdd;
21
+ const sparePages = {
22
+ queue: [],
23
+ isPreparing: false,
24
+ add(pageId) {
25
+ this.queue.push(pageId);
26
+ },
27
+ async getOrCreatAdHoc() {
28
+ const pageId = this.queue.shift();
29
+ if (pageId) {
30
+ this.replenish();
31
+ return pageId;
32
+ }
33
+
34
+ logger.log(`[sparePages] queue empty, creating ad-hoc page`);
35
+ try {
36
+ const pageObj = await pagePool.createPage();
37
+ await sanityCheckForPage({page: pageObj.page, pageId: pageObj.pageId});
38
+ return pageObj.pageId;
39
+ } catch (e) {
40
+ logger.log(`[sparePages] failed to create ad-hoc page: ${e}`);
41
+ return null;
42
+ }
43
+ },
44
+ async replenish() {
45
+ if (this.queue.length > 0 || this.isPreparing) {
46
+ return;
47
+ }
48
+ this.isPreparing = true;
49
+ logger.log('[sparePages] preparing...');
50
+ try {
51
+ const [errorInCreate, pageObj] = await presult(pagePool.createPage());
52
+ if (errorInCreate) {
53
+ logger.log(
54
+ `[sparePages] error preparing new page. This is probably a fatal problem. ${errorInCreate}`,
55
+ );
56
+ return;
57
+ }
58
+
59
+ const {pageId, page} = pageObj;
60
+ logger.log(`[sparePages] new page is ready: ${pageId}`);
61
+ try {
62
+ await sanityCheckForPage({page, pageId});
63
+ logger.log(`[sparePages] adding page to queue: ${pageId}`);
64
+ this.add(pageId);
65
+ } catch (errorInSanity) {
66
+ logger.log(
67
+ `[sparePages] new page ${pageId} is corrupted. preparing new page.`,
68
+ errorInSanity,
69
+ );
70
+ // If the page is corrupted, we close it and try again immediately (in the finally block)
71
+ page.close().catch(() => {});
72
+ }
73
+ } finally {
74
+ this.isPreparing = false;
75
+ // If we are still empty, try again
76
+ if (this.queue.length === 0) {
77
+ this.replenish();
78
+ }
79
+ }
80
+ },
81
+ };
22
82
 
23
83
  return async function renderStories(stories, isIE) {
24
84
  let doneStories = 0;
@@ -33,7 +93,7 @@ function makeRenderStories({
33
93
  });
34
94
  eventEmitter.emit('progress', {doneStories, totalStories});
35
95
  spinner.start();
36
- prepareNewPage();
96
+ sparePages.replenish();
37
97
 
38
98
  await processStoryLoop();
39
99
  await allStoriesPromise;
@@ -57,13 +117,17 @@ function makeRenderStories({
57
117
  const {page, pageId, markPageAsFree, removePage, getCreatedAt} = await pagePool.getFreePage();
58
118
  const livedTime = Date.now() - getCreatedAt();
59
119
  logger.log(`[prepareNewPage] got free page: ${pageId}, lived time: ${livedTime}`);
60
- if (newPageIdToAdd && livedTime > maxPageTTL) {
61
- logger.log(`[prepareNewPage] replacing page ${pageId} with page ${newPageIdToAdd}`);
62
- removePage();
63
- page.close();
64
- pagePool.addToPool(newPageIdToAdd);
65
- prepareNewPage();
66
- return processStoryLoop();
120
+ if (livedTime > maxPageTTL) {
121
+ const replacementPageId = await sparePages.getOrCreatAdHoc();
122
+ if (replacementPageId) {
123
+ logger.log(`[prepareNewPage] replacing page ${pageId} with page ${replacementPageId}`);
124
+ removePage();
125
+ page.close();
126
+ pagePool.addToPool(replacementPageId);
127
+ return processStoryLoop();
128
+ } else {
129
+ logger.log(`[prepareNewPage] failed to replace expired page ${pageId}. Reusing it.`);
130
+ }
67
131
  }
68
132
  logger.log(`[page ${pageId}] waiting for queued renders`);
69
133
  // await waitForQueuedRenders(storyDataGap);
@@ -88,7 +152,7 @@ function makeRenderStories({
88
152
 
89
153
  if (
90
154
  error &&
91
- /(Runtime.callFunctionOn timed out|Protocol error|Execution context was destroyed|timeout reached when trying to take DOM for story)/.test(
155
+ /(Runtime.callFunctionOn timed out|Protocol error|Execution context was destroyed|timeout reached when trying to take DOM for story|page evaluate timed out)/.test(
92
156
  error.message,
93
157
  )
94
158
  ) {
@@ -165,32 +229,6 @@ function makeRenderStories({
165
229
 
166
230
  return result;
167
231
  }
168
-
169
- async function prepareNewPage() {
170
- newPageIdToAdd = null;
171
- logger.log('[prepareNewPage] preparing...');
172
- const [errorInCreate, pageObj] = await presult(pagePool.createPage());
173
- if (errorInCreate) {
174
- logger.log(
175
- `[prepareNewPage] error preparing new page. This is probably a fatal problem. ${errorInCreate}`,
176
- );
177
- return;
178
- }
179
-
180
- const {pageId, page} = pageObj;
181
- logger.log(`[prepareNewPage] new page is ready: ${pageId}`);
182
- try {
183
- await sanityCheckForPage({page, pageId});
184
- logger.log(`[prepareNewPage] setting new page for replacement: ${pageId}`);
185
- newPageIdToAdd = pageId;
186
- } catch (errorInSanity) {
187
- logger.log(
188
- `[prepareNewPage] new page ${pageId} is corrupted. preparing new page.`,
189
- errorInSanity,
190
- );
191
- prepareNewPage();
192
- }
193
- }
194
232
  };
195
233
  }
196
234