@applitools/eyes-storybook 3.62.2 → 3.63.1
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 +148 -0
- package/dist/getClientAPI.js +10 -3
- package/dist/getStories.js +10 -3
- package/dist/renderStoryWithClientAPI.js +10 -3
- package/dist/runRunAfterScript.js +10 -3
- package/dist/runRunBeforeScript.js +10 -3
- package/package.json +9 -9
- package/src/browser/getClientAPI.js +10 -3
- package/src/eyes-setup.js +36 -26
- package/src/eyesStorybook.js +19 -18
- package/src/storybookConnector.js +1 -1
- package/src/transformSettings.js +1 -0
- package/src/utils/config-validator.js +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,153 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.63.1](https://github.com/Applitools-Dev/sdk/compare/js/eyes-storybook@3.63.0...js/eyes-storybook@3.63.1) (2025-12-01)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* client detection ([#3390](https://github.com/Applitools-Dev/sdk/issues/3390)) ([b4c11d8](https://github.com/Applitools-Dev/sdk/commit/b4c11d822ea9d176093f539313ce54942343249c))
|
|
9
|
+
* setup script compatibility with ESM | AD-11756 ([#3363](https://github.com/Applitools-Dev/sdk/issues/3363)) ([d1222f4](https://github.com/Applitools-Dev/sdk/commit/d1222f40a74ab62782bebeeb0cf899aac3f3d3b6))
|
|
10
|
+
* stories detection | FLD-3856 ([#3382](https://github.com/Applitools-Dev/sdk/issues/3382)) ([5fdf25a](https://github.com/Applitools-Dev/sdk/commit/5fdf25ab738a3e852b290d2ae96614bb5c18f7c7))
|
|
11
|
+
* storybook started detection | AD-12069 ([#3387](https://github.com/Applitools-Dev/sdk/issues/3387)) ([8f06ab1](https://github.com/Applitools-Dev/sdk/commit/8f06ab10e191a7f0602db07b4cb6925f4b403607))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Dependencies
|
|
15
|
+
|
|
16
|
+
* @applitools/utils bumped to 1.14.1
|
|
17
|
+
#### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* setup script compatibility with ESM | AD-11756 ([#3363](https://github.com/Applitools-Dev/sdk/issues/3363)) ([d1222f4](https://github.com/Applitools-Dev/sdk/commit/d1222f40a74ab62782bebeeb0cf899aac3f3d3b6))
|
|
20
|
+
* @applitools/logger bumped to 2.2.7
|
|
21
|
+
|
|
22
|
+
* @applitools/dom-snapshot bumped to 4.15.2
|
|
23
|
+
#### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* handle CSS variables in Shadow DOM adopted stylesheets | FLD-3790 ([#3381](https://github.com/Applitools-Dev/sdk/issues/3381)) ([b2bfca3](https://github.com/Applitools-Dev/sdk/commit/b2bfca3cd706cd996d78d51c6242148fbb8ce741))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
* @applitools/socket bumped to 1.3.8
|
|
30
|
+
|
|
31
|
+
* @applitools/req bumped to 1.8.7
|
|
32
|
+
|
|
33
|
+
* @applitools/image bumped to 1.2.6
|
|
34
|
+
|
|
35
|
+
* @applitools/driver bumped to 1.24.3
|
|
36
|
+
|
|
37
|
+
* @applitools/spec-driver-webdriver bumped to 1.5.3
|
|
38
|
+
|
|
39
|
+
* @applitools/spec-driver-selenium bumped to 1.7.9
|
|
40
|
+
|
|
41
|
+
* @applitools/spec-driver-puppeteer bumped to 1.6.9
|
|
42
|
+
|
|
43
|
+
* @applitools/screenshoter bumped to 3.12.10
|
|
44
|
+
|
|
45
|
+
* @applitools/nml-client bumped to 1.11.12
|
|
46
|
+
|
|
47
|
+
* @applitools/tunnel-client bumped to 1.11.5
|
|
48
|
+
|
|
49
|
+
* @applitools/ufg-client bumped to 1.18.3
|
|
50
|
+
|
|
51
|
+
* @applitools/core-base bumped to 1.30.1
|
|
52
|
+
|
|
53
|
+
* @applitools/ec-client bumped to 1.12.14
|
|
54
|
+
|
|
55
|
+
* @applitools/core bumped to 4.53.1
|
|
56
|
+
#### Bug Fixes
|
|
57
|
+
|
|
58
|
+
* handle CSS variables in Shadow DOM adopted stylesheets | FLD-3790 ([#3381](https://github.com/Applitools-Dev/sdk/issues/3381)) ([b2bfca3](https://github.com/Applitools-Dev/sdk/commit/b2bfca3cd706cd996d78d51c6242148fbb8ce741))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## [3.63.0](https://github.com/Applitools-Dev/sdk/compare/js/eyes-storybook@3.62.3...js/eyes-storybook@3.63.0) (2025-11-24)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Features
|
|
67
|
+
|
|
68
|
+
* "Story" custom property | AD-10146 ([#3372](https://github.com/Applitools-Dev/sdk/issues/3372)) ([af2e5fe](https://github.com/Applitools-Dev/sdk/commit/af2e5fe8beb7beeb6bbf13e364138894ee27a866))
|
|
69
|
+
|
|
70
|
+
## [3.62.3](https://github.com/Applitools-Dev/sdk/compare/js/eyes-storybook@3.62.2...js/eyes-storybook@3.62.3) (2025-11-19)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
### Dependencies
|
|
74
|
+
|
|
75
|
+
* @applitools/utils bumped to 1.14.0
|
|
76
|
+
#### Features
|
|
77
|
+
|
|
78
|
+
* disable heartbeats whenever no tests are running ([#3344](https://github.com/Applitools-Dev/sdk/issues/3344)) ([b66d28a](https://github.com/Applitools-Dev/sdk/commit/b66d28a7a382f26b68de70c8633c027cb4bdf225))
|
|
79
|
+
* @applitools/core-base bumped to 1.30.0
|
|
80
|
+
#### Features
|
|
81
|
+
|
|
82
|
+
* disable heartbeats whenever no tests are running ([#3344](https://github.com/Applitools-Dev/sdk/issues/3344)) ([b66d28a](https://github.com/Applitools-Dev/sdk/commit/b66d28a7a382f26b68de70c8633c027cb4bdf225))
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
#### Bug Fixes
|
|
86
|
+
|
|
87
|
+
* fails to create test with coded dynamic region | AD-11074 ([#3361](https://github.com/Applitools-Dev/sdk/issues/3361)) ([7f8c8cd](https://github.com/Applitools-Dev/sdk/commit/7f8c8cd85c0cd2e5861cd33fbc29c465903258d5))
|
|
88
|
+
* resolved an issue with `matchTimeout` changing `retryTimeout` ([f656f59](https://github.com/Applitools-Dev/sdk/commit/f656f59dbfb7c41fdb569fbc56d2e9daecefb854))
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
* @applitools/eyes bumped to 1.36.16
|
|
93
|
+
#### Bug Fixes
|
|
94
|
+
|
|
95
|
+
* resolved an issue with `matchTimeout` changing `retryTimeout` ([f656f59](https://github.com/Applitools-Dev/sdk/commit/f656f59dbfb7c41fdb569fbc56d2e9daecefb854))
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
* @applitools/logger bumped to 2.2.6
|
|
100
|
+
|
|
101
|
+
* @applitools/dom-snapshot bumped to 4.15.1
|
|
102
|
+
|
|
103
|
+
* @applitools/socket bumped to 1.3.7
|
|
104
|
+
|
|
105
|
+
* @applitools/req bumped to 1.8.6
|
|
106
|
+
|
|
107
|
+
* @applitools/image bumped to 1.2.5
|
|
108
|
+
|
|
109
|
+
* @applitools/dom-capture bumped to 11.6.7
|
|
110
|
+
|
|
111
|
+
* @applitools/driver bumped to 1.24.2
|
|
112
|
+
|
|
113
|
+
* @applitools/spec-driver-webdriver bumped to 1.5.2
|
|
114
|
+
|
|
115
|
+
* @applitools/spec-driver-selenium bumped to 1.7.8
|
|
116
|
+
|
|
117
|
+
* @applitools/spec-driver-puppeteer bumped to 1.6.8
|
|
118
|
+
|
|
119
|
+
* @applitools/screenshoter bumped to 3.12.9
|
|
120
|
+
|
|
121
|
+
* @applitools/nml-client bumped to 1.11.11
|
|
122
|
+
#### Bug Fixes
|
|
123
|
+
|
|
124
|
+
* better nml error messages ([#3311](https://github.com/Applitools-Dev/sdk/issues/3311)) ([3deea01](https://github.com/Applitools-Dev/sdk/commit/3deea0130636c44573adc919b95c1c99e6d194f1))
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
* @applitools/tunnel-client bumped to 1.11.4
|
|
129
|
+
|
|
130
|
+
* @applitools/ufg-client bumped to 1.18.2
|
|
131
|
+
|
|
132
|
+
* @applitools/ec-client bumped to 1.12.13
|
|
133
|
+
|
|
134
|
+
* @applitools/core bumped to 4.53.0
|
|
135
|
+
#### Features
|
|
136
|
+
|
|
137
|
+
* disable heartbeats whenever no tests are running ([#3344](https://github.com/Applitools-Dev/sdk/issues/3344)) ([b66d28a](https://github.com/Applitools-Dev/sdk/commit/b66d28a7a382f26b68de70c8633c027cb4bdf225))
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
#### Bug Fixes
|
|
141
|
+
|
|
142
|
+
* better nml error messages ([#3311](https://github.com/Applitools-Dev/sdk/issues/3311)) ([3deea01](https://github.com/Applitools-Dev/sdk/commit/3deea0130636c44573adc919b95c1c99e6d194f1))
|
|
143
|
+
* fails to create test with coded dynamic region | AD-11074 ([#3361](https://github.com/Applitools-Dev/sdk/issues/3361)) ([7f8c8cd](https://github.com/Applitools-Dev/sdk/commit/7f8c8cd85c0cd2e5861cd33fbc29c465903258d5))
|
|
144
|
+
* resolved an issue with `matchTimeout` changing `retryTimeout` ([f656f59](https://github.com/Applitools-Dev/sdk/commit/f656f59dbfb7c41fdb569fbc56d2e9daecefb854))
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
* @applitools/test-server bumped to 1.3.5
|
|
149
|
+
|
|
150
|
+
|
|
3
151
|
## [3.62.2](https://github.com/Applitools-Dev/sdk/compare/js/eyes-storybook@3.62.1...js/eyes-storybook@3.62.2) (2025-11-09)
|
|
4
152
|
|
|
5
153
|
|
package/dist/getClientAPI.js
CHANGED
|
@@ -169,13 +169,19 @@ function __getClientAPI(...args) {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
function getFrameWindow() {
|
|
172
|
-
if (
|
|
172
|
+
if (
|
|
173
|
+
(/iframe/.test(window.location.href) && window.__STORYBOOK_PREVIEW__) ||
|
|
174
|
+
/iframe\.html/.test(window.location.href)
|
|
175
|
+
) {
|
|
173
176
|
return window;
|
|
174
177
|
}
|
|
175
178
|
|
|
176
179
|
const innerFrameWindow = Array.prototype.find.call(window.frames, frame => {
|
|
177
180
|
try {
|
|
178
|
-
return
|
|
181
|
+
return (
|
|
182
|
+
(/\/iframe/.test(frame.location.href) && frame.__STORYBOOK_PREVIEW__) ||
|
|
183
|
+
/\/iframe\.html/.test(frame.location.href)
|
|
184
|
+
);
|
|
179
185
|
} catch (e) {}
|
|
180
186
|
});
|
|
181
187
|
|
|
@@ -183,7 +189,8 @@ function __getClientAPI(...args) {
|
|
|
183
189
|
return innerFrameWindow;
|
|
184
190
|
}
|
|
185
191
|
|
|
186
|
-
|
|
192
|
+
// frame.location.href might not be 'iframe' but still be the correct one
|
|
193
|
+
if (window.__STORYBOOK_CLIENT_API__ || window.__STORYBOOK_PREVIEW__) {
|
|
187
194
|
return window;
|
|
188
195
|
}
|
|
189
196
|
|
package/dist/getStories.js
CHANGED
|
@@ -169,13 +169,19 @@ function __getStories(...args) {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
function getFrameWindow() {
|
|
172
|
-
if (
|
|
172
|
+
if (
|
|
173
|
+
(/iframe/.test(window.location.href) && window.__STORYBOOK_PREVIEW__) ||
|
|
174
|
+
/iframe\.html/.test(window.location.href)
|
|
175
|
+
) {
|
|
173
176
|
return window;
|
|
174
177
|
}
|
|
175
178
|
|
|
176
179
|
const innerFrameWindow = Array.prototype.find.call(window.frames, frame => {
|
|
177
180
|
try {
|
|
178
|
-
return
|
|
181
|
+
return (
|
|
182
|
+
(/\/iframe/.test(frame.location.href) && frame.__STORYBOOK_PREVIEW__) ||
|
|
183
|
+
/\/iframe\.html/.test(frame.location.href)
|
|
184
|
+
);
|
|
179
185
|
} catch (e) {}
|
|
180
186
|
});
|
|
181
187
|
|
|
@@ -183,7 +189,8 @@ function __getStories(...args) {
|
|
|
183
189
|
return innerFrameWindow;
|
|
184
190
|
}
|
|
185
191
|
|
|
186
|
-
|
|
192
|
+
// frame.location.href might not be 'iframe' but still be the correct one
|
|
193
|
+
if (window.__STORYBOOK_CLIENT_API__ || window.__STORYBOOK_PREVIEW__) {
|
|
187
194
|
return window;
|
|
188
195
|
}
|
|
189
196
|
|
|
@@ -169,13 +169,19 @@ function __renderStoryWithClientAPI(...args) {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
function getFrameWindow() {
|
|
172
|
-
if (
|
|
172
|
+
if (
|
|
173
|
+
(/iframe/.test(window.location.href) && window.__STORYBOOK_PREVIEW__) ||
|
|
174
|
+
/iframe\.html/.test(window.location.href)
|
|
175
|
+
) {
|
|
173
176
|
return window;
|
|
174
177
|
}
|
|
175
178
|
|
|
176
179
|
const innerFrameWindow = Array.prototype.find.call(window.frames, frame => {
|
|
177
180
|
try {
|
|
178
|
-
return
|
|
181
|
+
return (
|
|
182
|
+
(/\/iframe/.test(frame.location.href) && frame.__STORYBOOK_PREVIEW__) ||
|
|
183
|
+
/\/iframe\.html/.test(frame.location.href)
|
|
184
|
+
);
|
|
179
185
|
} catch (e) {}
|
|
180
186
|
});
|
|
181
187
|
|
|
@@ -183,7 +189,8 @@ function __renderStoryWithClientAPI(...args) {
|
|
|
183
189
|
return innerFrameWindow;
|
|
184
190
|
}
|
|
185
191
|
|
|
186
|
-
|
|
192
|
+
// frame.location.href might not be 'iframe' but still be the correct one
|
|
193
|
+
if (window.__STORYBOOK_CLIENT_API__ || window.__STORYBOOK_PREVIEW__) {
|
|
187
194
|
return window;
|
|
188
195
|
}
|
|
189
196
|
|
|
@@ -169,13 +169,19 @@ function __runRunAfterScript(...args) {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
function getFrameWindow() {
|
|
172
|
-
if (
|
|
172
|
+
if (
|
|
173
|
+
(/iframe/.test(window.location.href) && window.__STORYBOOK_PREVIEW__) ||
|
|
174
|
+
/iframe\.html/.test(window.location.href)
|
|
175
|
+
) {
|
|
173
176
|
return window;
|
|
174
177
|
}
|
|
175
178
|
|
|
176
179
|
const innerFrameWindow = Array.prototype.find.call(window.frames, frame => {
|
|
177
180
|
try {
|
|
178
|
-
return
|
|
181
|
+
return (
|
|
182
|
+
(/\/iframe/.test(frame.location.href) && frame.__STORYBOOK_PREVIEW__) ||
|
|
183
|
+
/\/iframe\.html/.test(frame.location.href)
|
|
184
|
+
);
|
|
179
185
|
} catch (e) {}
|
|
180
186
|
});
|
|
181
187
|
|
|
@@ -183,7 +189,8 @@ function __runRunAfterScript(...args) {
|
|
|
183
189
|
return innerFrameWindow;
|
|
184
190
|
}
|
|
185
191
|
|
|
186
|
-
|
|
192
|
+
// frame.location.href might not be 'iframe' but still be the correct one
|
|
193
|
+
if (window.__STORYBOOK_CLIENT_API__ || window.__STORYBOOK_PREVIEW__) {
|
|
187
194
|
return window;
|
|
188
195
|
}
|
|
189
196
|
|
|
@@ -169,13 +169,19 @@ function __runRunBeforeScript(...args) {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
function getFrameWindow() {
|
|
172
|
-
if (
|
|
172
|
+
if (
|
|
173
|
+
(/iframe/.test(window.location.href) && window.__STORYBOOK_PREVIEW__) ||
|
|
174
|
+
/iframe\.html/.test(window.location.href)
|
|
175
|
+
) {
|
|
173
176
|
return window;
|
|
174
177
|
}
|
|
175
178
|
|
|
176
179
|
const innerFrameWindow = Array.prototype.find.call(window.frames, frame => {
|
|
177
180
|
try {
|
|
178
|
-
return
|
|
181
|
+
return (
|
|
182
|
+
(/\/iframe/.test(frame.location.href) && frame.__STORYBOOK_PREVIEW__) ||
|
|
183
|
+
/\/iframe\.html/.test(frame.location.href)
|
|
184
|
+
);
|
|
179
185
|
} catch (e) {}
|
|
180
186
|
});
|
|
181
187
|
|
|
@@ -183,7 +189,8 @@ function __runRunBeforeScript(...args) {
|
|
|
183
189
|
return innerFrameWindow;
|
|
184
190
|
}
|
|
185
191
|
|
|
186
|
-
|
|
192
|
+
// frame.location.href might not be 'iframe' but still be the correct one
|
|
193
|
+
if (window.__STORYBOOK_CLIENT_API__ || window.__STORYBOOK_PREVIEW__) {
|
|
187
194
|
return window;
|
|
188
195
|
}
|
|
189
196
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/eyes-storybook",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.63.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -59,15 +59,15 @@
|
|
|
59
59
|
"up:framework": "cd test/fixtures/storybook-versions/${APPLITOOLS_FRAMEWORK_VERSION} && npm ci"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@applitools/core": "4.
|
|
63
|
-
"@applitools/driver": "1.24.
|
|
64
|
-
"@applitools/eyes": "1.36.
|
|
62
|
+
"@applitools/core": "4.53.1",
|
|
63
|
+
"@applitools/driver": "1.24.3",
|
|
64
|
+
"@applitools/eyes": "1.36.16",
|
|
65
65
|
"@applitools/functional-commons": "1.6.0",
|
|
66
|
-
"@applitools/logger": "2.2.
|
|
66
|
+
"@applitools/logger": "2.2.7",
|
|
67
67
|
"@applitools/monitoring-commons": "1.0.19",
|
|
68
|
-
"@applitools/spec-driver-puppeteer": "1.6.
|
|
69
|
-
"@applitools/ufg-client": "1.18.
|
|
70
|
-
"@applitools/utils": "1.
|
|
68
|
+
"@applitools/spec-driver-puppeteer": "1.6.9",
|
|
69
|
+
"@applitools/ufg-client": "1.18.3",
|
|
70
|
+
"@applitools/utils": "1.14.1",
|
|
71
71
|
"@inquirer/prompts": "7.0.1",
|
|
72
72
|
"boxen": "4.2.0",
|
|
73
73
|
"chalk": "3.0.0",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@applitools/bongo": "^5.10.0",
|
|
85
85
|
"@applitools/snaptdout": "^1.1.0",
|
|
86
|
-
"@applitools/test-server": "^1.3.
|
|
86
|
+
"@applitools/test-server": "^1.3.5",
|
|
87
87
|
"@applitools/test-utils": "^1.5.17",
|
|
88
88
|
"@storybook/addon-interactions": "^6.4.18",
|
|
89
89
|
"@storybook/react": "^6.5.16",
|
|
@@ -166,13 +166,19 @@ function getClientAPI() {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
function getFrameWindow() {
|
|
169
|
-
if (
|
|
169
|
+
if (
|
|
170
|
+
(/iframe/.test(window.location.href) && window.__STORYBOOK_PREVIEW__) ||
|
|
171
|
+
/iframe\.html/.test(window.location.href)
|
|
172
|
+
) {
|
|
170
173
|
return window;
|
|
171
174
|
}
|
|
172
175
|
|
|
173
176
|
const innerFrameWindow = Array.prototype.find.call(window.frames, frame => {
|
|
174
177
|
try {
|
|
175
|
-
return
|
|
178
|
+
return (
|
|
179
|
+
(/\/iframe/.test(frame.location.href) && frame.__STORYBOOK_PREVIEW__) ||
|
|
180
|
+
/\/iframe\.html/.test(frame.location.href)
|
|
181
|
+
);
|
|
176
182
|
} catch (e) {}
|
|
177
183
|
});
|
|
178
184
|
|
|
@@ -180,7 +186,8 @@ function getFrameWindow() {
|
|
|
180
186
|
return innerFrameWindow;
|
|
181
187
|
}
|
|
182
188
|
|
|
183
|
-
|
|
189
|
+
// frame.location.href might not be 'iframe' but still be the correct one
|
|
190
|
+
if (window.__STORYBOOK_CLIENT_API__ || window.__STORYBOOK_PREVIEW__) {
|
|
184
191
|
return window;
|
|
185
192
|
}
|
|
186
193
|
|
package/src/eyes-setup.js
CHANGED
|
@@ -42,7 +42,7 @@ function handleError(asyncFunc) {
|
|
|
42
42
|
async function init(args) {
|
|
43
43
|
log(chalk.yellow('Setting up Eyes-Storybook for your project:'));
|
|
44
44
|
|
|
45
|
-
let {config, fileName, isCorrupted} = await loadExistingConfig();
|
|
45
|
+
let {config, fileName, isCorrupted, isESM} = await loadExistingConfig();
|
|
46
46
|
|
|
47
47
|
if (isCorrupted) {
|
|
48
48
|
log(chalk.yellow(`\nWarning: Your configuration file '${fileName}' appears to be corrupted.`));
|
|
@@ -118,7 +118,7 @@ async function init(args) {
|
|
|
118
118
|
showLogs: false,
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
-
const fileContent = generateConfigContent();
|
|
121
|
+
const fileContent = generateConfigContent(isESM);
|
|
122
122
|
await fs.writeFile(fileName, fileContent, 'utf8');
|
|
123
123
|
}
|
|
124
124
|
|
|
@@ -138,24 +138,35 @@ async function init(args) {
|
|
|
138
138
|
try {
|
|
139
139
|
const fileUrl = pathToFileURL(file).href;
|
|
140
140
|
const module = await import(`${fileUrl}?t=${Date.now()}`); // Append timestamp to bypass cache
|
|
141
|
+
const isESM = file.endsWith('.mjs');
|
|
141
142
|
|
|
142
|
-
return {config: module.default || module, fileName: file, isCorrupted: false};
|
|
143
|
+
return {config: module.default || module, fileName: file, isCorrupted: false, isESM};
|
|
143
144
|
} catch (err) {
|
|
144
145
|
if (err.code === 'ERR_MODULE_NOT_FOUND') {
|
|
145
|
-
// This file doesn't exist, so we continue searching for the one that does.
|
|
146
146
|
continue;
|
|
147
147
|
}
|
|
148
|
-
|
|
149
148
|
return {config: null, fileName: file, isCorrupted: true};
|
|
150
149
|
}
|
|
151
150
|
}
|
|
152
151
|
|
|
153
152
|
// No file was found in any of the possible locations.
|
|
154
|
-
//
|
|
155
|
-
|
|
153
|
+
// Check if type: module is set in package.json in cwd
|
|
154
|
+
let fileName = 'applitools.config.js';
|
|
155
|
+
let isESM = false;
|
|
156
|
+
try {
|
|
157
|
+
const pkgRaw = await fs.readFile('./package.json', 'utf8');
|
|
158
|
+
const pkg = JSON.parse(pkgRaw);
|
|
159
|
+
if (pkg.type === 'module') {
|
|
160
|
+
isESM = true;
|
|
161
|
+
fileName = 'applitools.config.mjs';
|
|
162
|
+
}
|
|
163
|
+
} catch (e) {
|
|
164
|
+
// ignore if package.json not found or invalid
|
|
165
|
+
}
|
|
166
|
+
return {config: null, fileName, isCorrupted: false, isESM};
|
|
156
167
|
}
|
|
157
168
|
|
|
158
|
-
function generateConfigContent() {
|
|
169
|
+
function generateConfigContent(isESM) {
|
|
159
170
|
const envConfigMap = {
|
|
160
171
|
batchName: 'APPLITOOLS_BATCH_NAME',
|
|
161
172
|
batchId: 'APPLITOOLS_BATCH_ID',
|
|
@@ -169,7 +180,7 @@ async function init(args) {
|
|
|
169
180
|
|
|
170
181
|
const configLines = [];
|
|
171
182
|
|
|
172
|
-
//
|
|
183
|
+
// apiKey
|
|
173
184
|
if (apiKey === 'process.env.APPLITOOLS_API_KEY') {
|
|
174
185
|
configLines.push('apiKey: process.env.APPLITOOLS_API_KEY,');
|
|
175
186
|
} else if (apiKey) {
|
|
@@ -177,17 +188,17 @@ async function init(args) {
|
|
|
177
188
|
`apiKey: '${apiKey}', // Warning: 'apiKey' is not obscured, consider setting it via environment variable APPLITOOLS_API_KEY`,
|
|
178
189
|
);
|
|
179
190
|
} else {
|
|
180
|
-
configLines.push(
|
|
191
|
+
configLines.push("// apiKey: '',");
|
|
181
192
|
}
|
|
182
193
|
|
|
183
|
-
//
|
|
194
|
+
// serverUrl
|
|
184
195
|
if (serverUrl && serverUrl.startsWith('process.env.')) {
|
|
185
196
|
configLines.push(`serverUrl: ${serverUrl},`);
|
|
186
197
|
} else if (serverUrl) {
|
|
187
198
|
configLines.push(`serverUrl: '${serverUrl}',`);
|
|
188
199
|
}
|
|
189
200
|
|
|
190
|
-
//
|
|
201
|
+
// other config
|
|
191
202
|
const otherKeys = [
|
|
192
203
|
'appName',
|
|
193
204
|
'batchName',
|
|
@@ -200,35 +211,34 @@ async function init(args) {
|
|
|
200
211
|
'navigationWaitUntil',
|
|
201
212
|
'waitBeforeCapture',
|
|
202
213
|
];
|
|
203
|
-
|
|
204
214
|
for (const key of otherKeys) {
|
|
205
215
|
const envVar = envConfigMap[key];
|
|
206
|
-
// Check if an environment variable for this key is set
|
|
207
216
|
if (envVar && utils.general.getEnvValue(envVar.replace('APPLITOOLS_', ''))) {
|
|
208
217
|
configLines.push(`${key}: process.env.${envVar},`);
|
|
209
218
|
} else if (Object.prototype.hasOwnProperty.call(config, key)) {
|
|
210
|
-
// Otherwise, use the default value from the config object
|
|
211
219
|
const value = config[key];
|
|
212
220
|
if (value !== undefined) {
|
|
213
|
-
|
|
214
|
-
configLines.push(line);
|
|
221
|
+
configLines.push(typeof value === 'string' ? `${key}: '${value}',` : `${key}: ${value},`);
|
|
215
222
|
}
|
|
216
223
|
}
|
|
217
224
|
}
|
|
218
225
|
|
|
219
|
-
|
|
220
|
-
* @type {import('@applitools/eyes-storybook').ApplitoolsConfig}
|
|
221
|
-
**/
|
|
222
|
-
module.exports = {
|
|
223
|
-
${configLines.join('\n ')}
|
|
224
|
-
// browsersInfo: [
|
|
226
|
+
configLines.push(`// browsersInfo: [
|
|
225
227
|
// {width: 1024, height: 768, name: 'firefox'},
|
|
226
228
|
// {width: 1024, height: 768, name: 'chrome'},
|
|
227
229
|
// {iosDeviceInfo: {deviceName: 'iPhone 16'}},
|
|
228
230
|
// {chromeEmulationInfo: {deviceName: 'Galaxy S20'}},
|
|
229
|
-
// ]
|
|
230
|
-
|
|
231
|
-
|
|
231
|
+
// ]`);
|
|
232
|
+
|
|
233
|
+
const configObject = `{
|
|
234
|
+
${configLines.join('\n ')}
|
|
235
|
+
}`;
|
|
236
|
+
|
|
237
|
+
if (isESM) {
|
|
238
|
+
return `/**\n * @type {import('@applitools/eyes-storybook').ApplitoolsConfig}\n */\nconst config = ${configObject};\nexport default config;\n`;
|
|
239
|
+
} else {
|
|
240
|
+
return `/**\n * @type {import('@applitools/eyes-storybook').ApplitoolsConfig}\n **/\nmodule.exports = ${configObject};\n`;
|
|
241
|
+
}
|
|
232
242
|
}
|
|
233
243
|
|
|
234
244
|
function printPostlude() {
|
package/src/eyesStorybook.js
CHANGED
|
@@ -99,26 +99,27 @@ async function eyesStorybook({
|
|
|
99
99
|
});
|
|
100
100
|
const pagePool = createPagePool({initPage, logger});
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
try {
|
|
103
|
+
const {stories, page} = await getStoriesWithSpinner();
|
|
103
104
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
const doTakeDomSnapshots = async ({page, ...settings}) => {
|
|
106
|
+
const driver = await new Driver({spec, driver: page, logger});
|
|
107
|
+
return await core.takeSnapshots({
|
|
108
|
+
logger,
|
|
109
|
+
driver,
|
|
110
|
+
settings: mergeConfigs({config, settings}),
|
|
111
|
+
account,
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
logger.log('got script for processPage');
|
|
116
|
+
browserLog({
|
|
117
|
+
page,
|
|
118
|
+
onLog: text => {
|
|
119
|
+
logger.log(`master tab: ${text}`);
|
|
120
|
+
},
|
|
111
121
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
logger.log('got script for processPage');
|
|
115
|
-
browserLog({
|
|
116
|
-
page,
|
|
117
|
-
onLog: text => {
|
|
118
|
-
logger.log(`master tab: ${text}`);
|
|
119
|
-
},
|
|
120
|
-
});
|
|
121
|
-
try {
|
|
122
|
+
|
|
122
123
|
const filteredStories = filterStories({stories, config});
|
|
123
124
|
|
|
124
125
|
// Log filtering and sharding results
|
|
@@ -77,7 +77,7 @@ class StorybookConnector extends EventEmitter {
|
|
|
77
77
|
|
|
78
78
|
const successMessageListener = str => {
|
|
79
79
|
const isReady = stripAnsi(str).match(
|
|
80
|
-
/Storybook \d{1,2}\.\d{1,2}\.\d{1,2}(.+)? started|Storybook started on
|
|
80
|
+
/Storybook \d{1,2}\.\d{1,2}\.\d{1,2}(.+)? started|Storybook started on =>|Storybook ready/,
|
|
81
81
|
);
|
|
82
82
|
|
|
83
83
|
if (isReady) {
|
package/src/transformSettings.js
CHANGED
|
@@ -21,6 +21,7 @@ function storyToOpenSettings({story, appName, serverSettings, concurrency}) {
|
|
|
21
21
|
const storyProperties = [
|
|
22
22
|
{name: 'Component name', value: kind},
|
|
23
23
|
{name: 'State', value: name},
|
|
24
|
+
{name: 'Story', value: name},
|
|
24
25
|
...(properties || []),
|
|
25
26
|
];
|
|
26
27
|
if (hasPlayFunction) {
|
|
@@ -84,10 +84,14 @@ const storybookSpecificKeys = [
|
|
|
84
84
|
'packagePath',
|
|
85
85
|
];
|
|
86
86
|
|
|
87
|
+
// Keys that are automatically added by module systems for ES modules.
|
|
88
|
+
const esModuleSpecificKeys = ['__esModule', 'default'];
|
|
89
|
+
|
|
87
90
|
// Combine all known keys into a single Set for efficient O(1) lookups.
|
|
88
91
|
const knownKeys = new Set([
|
|
89
92
|
...storybookSpecificKeys,
|
|
90
93
|
...applitoolsBaseKeys,
|
|
94
|
+
...esModuleSpecificKeys,
|
|
91
95
|
...Object.keys(defaultConfig),
|
|
92
96
|
]);
|
|
93
97
|
|