@applitools/eyes-storybook 3.31.0 → 3.31.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 +13 -0
- package/dist/getClientAPI.js +24 -10
- package/dist/getStories.js +24 -10
- package/dist/renderStoryWithClientAPI.js +24 -10
- package/dist/runRunAfterScript.js +24 -10
- package/dist/runRunBeforeScript.js +24 -10
- package/package.json +13 -14
- package/src/browser/getClientAPI.js +24 -10
- package/src/eyesStorybook.js +5 -0
- package/src/renderStories.js +1 -2
- package/src/startStorybookServer.js +10 -1
- package/src/storybookConnector.js +13 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
## 3.31.2 - 2023/3/9
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
- Add support for storybook 7
|
|
10
|
+
### Bug fixes
|
|
11
|
+
- Support running Storybook dev server in Node.js v18
|
|
12
|
+
|
|
13
|
+
## 3.31.1 - 2023/2/21
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
### Bug fixes
|
|
17
|
+
- Make sure to send http headers in the main storybook tab
|
|
18
|
+
|
|
6
19
|
## 3.31.0 - 2023/2/15
|
|
7
20
|
|
|
8
21
|
### Features
|
package/dist/getClientAPI.js
CHANGED
|
@@ -13,12 +13,12 @@ function __getClientAPI(...args) {
|
|
|
13
13
|
function getClientAPI() {
|
|
14
14
|
const frameWindow = getFrameWindow();
|
|
15
15
|
const clientAPI = frameWindow.__STORYBOOK_CLIENT_API__;
|
|
16
|
-
const addons = frameWindow.__STORYBOOK_ADDONS;
|
|
16
|
+
const addons = frameWindow.__STORYBOOK_ADDONS || frameWindow.__STORYBOOK_ADDONS_PREVIEW;
|
|
17
17
|
|
|
18
18
|
return getAPI(getStorybookVersion());
|
|
19
19
|
|
|
20
20
|
function getStorybookVersion() {
|
|
21
|
-
const
|
|
21
|
+
const addonsForV4 = frameWindow.__STORYBOOK_ADDONS;
|
|
22
22
|
|
|
23
23
|
if (frameWindow.__STORYBOOK_PREVIEW__) {
|
|
24
24
|
return API_VERSIONS.v6_4;
|
|
@@ -27,11 +27,11 @@ function __getClientAPI(...args) {
|
|
|
27
27
|
} else if (frameWindow.__STORYBOOK_CLIENT_API__ && frameWindow.__STORYBOOK_CLIENT_API__.raw) {
|
|
28
28
|
return API_VERSIONS.v5;
|
|
29
29
|
} else if (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
addonsForV4 &&
|
|
31
|
+
addonsForV4.channel &&
|
|
32
|
+
addonsForV4.channel._listeners &&
|
|
33
|
+
addonsForV4.channel._listeners.setCurrentStory &&
|
|
34
|
+
addonsForV4.channel._listeners.setCurrentStory[0]
|
|
35
35
|
) {
|
|
36
36
|
return API_VERSIONS.v4;
|
|
37
37
|
} else {
|
|
@@ -43,6 +43,15 @@ function __getClientAPI(...args) {
|
|
|
43
43
|
addons.channel.once('storyRendered', () => {
|
|
44
44
|
setTimeout(callback, 0);
|
|
45
45
|
});
|
|
46
|
+
addons.channel.once('playFunctionThrewException', () => {
|
|
47
|
+
setTimeout(callback, 0);
|
|
48
|
+
});
|
|
49
|
+
addons.channel.once('storyErrored', () => {
|
|
50
|
+
setTimeout(callback, 0);
|
|
51
|
+
});
|
|
52
|
+
addons.channel.once('storyThrewException', () => {
|
|
53
|
+
setTimeout(callback, 0);
|
|
54
|
+
});
|
|
46
55
|
} else {
|
|
47
56
|
callback();
|
|
48
57
|
}
|
|
@@ -110,9 +119,14 @@ function __getClientAPI(...args) {
|
|
|
110
119
|
await clientAPI.storyStore.cacheAllCSFFiles();
|
|
111
120
|
storyId = clientAPI.raw()[i].id;
|
|
112
121
|
}
|
|
113
|
-
frameWindow.__STORYBOOK_PREVIEW__.urlStore
|
|
114
|
-
|
|
115
|
-
|
|
122
|
+
if (frameWindow.__STORYBOOK_PREVIEW__.urlStore) {
|
|
123
|
+
frameWindow.__STORYBOOK_PREVIEW__.urlStore.setSelection({
|
|
124
|
+
storyId,
|
|
125
|
+
});
|
|
126
|
+
} else {
|
|
127
|
+
// storybook v7
|
|
128
|
+
frameWindow.__STORYBOOK_PREVIEW__.selectionStore.setSelection({storyId});
|
|
129
|
+
}
|
|
116
130
|
await frameWindow.__STORYBOOK_PREVIEW__.renderSelection();
|
|
117
131
|
},
|
|
118
132
|
onStoryRendered,
|
package/dist/getStories.js
CHANGED
|
@@ -13,12 +13,12 @@ function __getStories(...args) {
|
|
|
13
13
|
function getClientAPI() {
|
|
14
14
|
const frameWindow = getFrameWindow();
|
|
15
15
|
const clientAPI = frameWindow.__STORYBOOK_CLIENT_API__;
|
|
16
|
-
const addons = frameWindow.__STORYBOOK_ADDONS;
|
|
16
|
+
const addons = frameWindow.__STORYBOOK_ADDONS || frameWindow.__STORYBOOK_ADDONS_PREVIEW;
|
|
17
17
|
|
|
18
18
|
return getAPI(getStorybookVersion());
|
|
19
19
|
|
|
20
20
|
function getStorybookVersion() {
|
|
21
|
-
const
|
|
21
|
+
const addonsForV4 = frameWindow.__STORYBOOK_ADDONS;
|
|
22
22
|
|
|
23
23
|
if (frameWindow.__STORYBOOK_PREVIEW__) {
|
|
24
24
|
return API_VERSIONS.v6_4;
|
|
@@ -27,11 +27,11 @@ function __getStories(...args) {
|
|
|
27
27
|
} else if (frameWindow.__STORYBOOK_CLIENT_API__ && frameWindow.__STORYBOOK_CLIENT_API__.raw) {
|
|
28
28
|
return API_VERSIONS.v5;
|
|
29
29
|
} else if (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
addonsForV4 &&
|
|
31
|
+
addonsForV4.channel &&
|
|
32
|
+
addonsForV4.channel._listeners &&
|
|
33
|
+
addonsForV4.channel._listeners.setCurrentStory &&
|
|
34
|
+
addonsForV4.channel._listeners.setCurrentStory[0]
|
|
35
35
|
) {
|
|
36
36
|
return API_VERSIONS.v4;
|
|
37
37
|
} else {
|
|
@@ -43,6 +43,15 @@ function __getStories(...args) {
|
|
|
43
43
|
addons.channel.once('storyRendered', () => {
|
|
44
44
|
setTimeout(callback, 0);
|
|
45
45
|
});
|
|
46
|
+
addons.channel.once('playFunctionThrewException', () => {
|
|
47
|
+
setTimeout(callback, 0);
|
|
48
|
+
});
|
|
49
|
+
addons.channel.once('storyErrored', () => {
|
|
50
|
+
setTimeout(callback, 0);
|
|
51
|
+
});
|
|
52
|
+
addons.channel.once('storyThrewException', () => {
|
|
53
|
+
setTimeout(callback, 0);
|
|
54
|
+
});
|
|
46
55
|
} else {
|
|
47
56
|
callback();
|
|
48
57
|
}
|
|
@@ -110,9 +119,14 @@ function __getStories(...args) {
|
|
|
110
119
|
await clientAPI.storyStore.cacheAllCSFFiles();
|
|
111
120
|
storyId = clientAPI.raw()[i].id;
|
|
112
121
|
}
|
|
113
|
-
frameWindow.__STORYBOOK_PREVIEW__.urlStore
|
|
114
|
-
|
|
115
|
-
|
|
122
|
+
if (frameWindow.__STORYBOOK_PREVIEW__.urlStore) {
|
|
123
|
+
frameWindow.__STORYBOOK_PREVIEW__.urlStore.setSelection({
|
|
124
|
+
storyId,
|
|
125
|
+
});
|
|
126
|
+
} else {
|
|
127
|
+
// storybook v7
|
|
128
|
+
frameWindow.__STORYBOOK_PREVIEW__.selectionStore.setSelection({storyId});
|
|
129
|
+
}
|
|
116
130
|
await frameWindow.__STORYBOOK_PREVIEW__.renderSelection();
|
|
117
131
|
},
|
|
118
132
|
onStoryRendered,
|
|
@@ -13,12 +13,12 @@ function __renderStoryWithClientAPI(...args) {
|
|
|
13
13
|
function getClientAPI() {
|
|
14
14
|
const frameWindow = getFrameWindow();
|
|
15
15
|
const clientAPI = frameWindow.__STORYBOOK_CLIENT_API__;
|
|
16
|
-
const addons = frameWindow.__STORYBOOK_ADDONS;
|
|
16
|
+
const addons = frameWindow.__STORYBOOK_ADDONS || frameWindow.__STORYBOOK_ADDONS_PREVIEW;
|
|
17
17
|
|
|
18
18
|
return getAPI(getStorybookVersion());
|
|
19
19
|
|
|
20
20
|
function getStorybookVersion() {
|
|
21
|
-
const
|
|
21
|
+
const addonsForV4 = frameWindow.__STORYBOOK_ADDONS;
|
|
22
22
|
|
|
23
23
|
if (frameWindow.__STORYBOOK_PREVIEW__) {
|
|
24
24
|
return API_VERSIONS.v6_4;
|
|
@@ -27,11 +27,11 @@ function __renderStoryWithClientAPI(...args) {
|
|
|
27
27
|
} else if (frameWindow.__STORYBOOK_CLIENT_API__ && frameWindow.__STORYBOOK_CLIENT_API__.raw) {
|
|
28
28
|
return API_VERSIONS.v5;
|
|
29
29
|
} else if (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
addonsForV4 &&
|
|
31
|
+
addonsForV4.channel &&
|
|
32
|
+
addonsForV4.channel._listeners &&
|
|
33
|
+
addonsForV4.channel._listeners.setCurrentStory &&
|
|
34
|
+
addonsForV4.channel._listeners.setCurrentStory[0]
|
|
35
35
|
) {
|
|
36
36
|
return API_VERSIONS.v4;
|
|
37
37
|
} else {
|
|
@@ -43,6 +43,15 @@ function __renderStoryWithClientAPI(...args) {
|
|
|
43
43
|
addons.channel.once('storyRendered', () => {
|
|
44
44
|
setTimeout(callback, 0);
|
|
45
45
|
});
|
|
46
|
+
addons.channel.once('playFunctionThrewException', () => {
|
|
47
|
+
setTimeout(callback, 0);
|
|
48
|
+
});
|
|
49
|
+
addons.channel.once('storyErrored', () => {
|
|
50
|
+
setTimeout(callback, 0);
|
|
51
|
+
});
|
|
52
|
+
addons.channel.once('storyThrewException', () => {
|
|
53
|
+
setTimeout(callback, 0);
|
|
54
|
+
});
|
|
46
55
|
} else {
|
|
47
56
|
callback();
|
|
48
57
|
}
|
|
@@ -110,9 +119,14 @@ function __renderStoryWithClientAPI(...args) {
|
|
|
110
119
|
await clientAPI.storyStore.cacheAllCSFFiles();
|
|
111
120
|
storyId = clientAPI.raw()[i].id;
|
|
112
121
|
}
|
|
113
|
-
frameWindow.__STORYBOOK_PREVIEW__.urlStore
|
|
114
|
-
|
|
115
|
-
|
|
122
|
+
if (frameWindow.__STORYBOOK_PREVIEW__.urlStore) {
|
|
123
|
+
frameWindow.__STORYBOOK_PREVIEW__.urlStore.setSelection({
|
|
124
|
+
storyId,
|
|
125
|
+
});
|
|
126
|
+
} else {
|
|
127
|
+
// storybook v7
|
|
128
|
+
frameWindow.__STORYBOOK_PREVIEW__.selectionStore.setSelection({storyId});
|
|
129
|
+
}
|
|
116
130
|
await frameWindow.__STORYBOOK_PREVIEW__.renderSelection();
|
|
117
131
|
},
|
|
118
132
|
onStoryRendered,
|
|
@@ -13,12 +13,12 @@ function __runRunAfterScript(...args) {
|
|
|
13
13
|
function getClientAPI() {
|
|
14
14
|
const frameWindow = getFrameWindow();
|
|
15
15
|
const clientAPI = frameWindow.__STORYBOOK_CLIENT_API__;
|
|
16
|
-
const addons = frameWindow.__STORYBOOK_ADDONS;
|
|
16
|
+
const addons = frameWindow.__STORYBOOK_ADDONS || frameWindow.__STORYBOOK_ADDONS_PREVIEW;
|
|
17
17
|
|
|
18
18
|
return getAPI(getStorybookVersion());
|
|
19
19
|
|
|
20
20
|
function getStorybookVersion() {
|
|
21
|
-
const
|
|
21
|
+
const addonsForV4 = frameWindow.__STORYBOOK_ADDONS;
|
|
22
22
|
|
|
23
23
|
if (frameWindow.__STORYBOOK_PREVIEW__) {
|
|
24
24
|
return API_VERSIONS.v6_4;
|
|
@@ -27,11 +27,11 @@ function __runRunAfterScript(...args) {
|
|
|
27
27
|
} else if (frameWindow.__STORYBOOK_CLIENT_API__ && frameWindow.__STORYBOOK_CLIENT_API__.raw) {
|
|
28
28
|
return API_VERSIONS.v5;
|
|
29
29
|
} else if (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
addonsForV4 &&
|
|
31
|
+
addonsForV4.channel &&
|
|
32
|
+
addonsForV4.channel._listeners &&
|
|
33
|
+
addonsForV4.channel._listeners.setCurrentStory &&
|
|
34
|
+
addonsForV4.channel._listeners.setCurrentStory[0]
|
|
35
35
|
) {
|
|
36
36
|
return API_VERSIONS.v4;
|
|
37
37
|
} else {
|
|
@@ -43,6 +43,15 @@ function __runRunAfterScript(...args) {
|
|
|
43
43
|
addons.channel.once('storyRendered', () => {
|
|
44
44
|
setTimeout(callback, 0);
|
|
45
45
|
});
|
|
46
|
+
addons.channel.once('playFunctionThrewException', () => {
|
|
47
|
+
setTimeout(callback, 0);
|
|
48
|
+
});
|
|
49
|
+
addons.channel.once('storyErrored', () => {
|
|
50
|
+
setTimeout(callback, 0);
|
|
51
|
+
});
|
|
52
|
+
addons.channel.once('storyThrewException', () => {
|
|
53
|
+
setTimeout(callback, 0);
|
|
54
|
+
});
|
|
46
55
|
} else {
|
|
47
56
|
callback();
|
|
48
57
|
}
|
|
@@ -110,9 +119,14 @@ function __runRunAfterScript(...args) {
|
|
|
110
119
|
await clientAPI.storyStore.cacheAllCSFFiles();
|
|
111
120
|
storyId = clientAPI.raw()[i].id;
|
|
112
121
|
}
|
|
113
|
-
frameWindow.__STORYBOOK_PREVIEW__.urlStore
|
|
114
|
-
|
|
115
|
-
|
|
122
|
+
if (frameWindow.__STORYBOOK_PREVIEW__.urlStore) {
|
|
123
|
+
frameWindow.__STORYBOOK_PREVIEW__.urlStore.setSelection({
|
|
124
|
+
storyId,
|
|
125
|
+
});
|
|
126
|
+
} else {
|
|
127
|
+
// storybook v7
|
|
128
|
+
frameWindow.__STORYBOOK_PREVIEW__.selectionStore.setSelection({storyId});
|
|
129
|
+
}
|
|
116
130
|
await frameWindow.__STORYBOOK_PREVIEW__.renderSelection();
|
|
117
131
|
},
|
|
118
132
|
onStoryRendered,
|
|
@@ -13,12 +13,12 @@ function __runRunBeforeScript(...args) {
|
|
|
13
13
|
function getClientAPI() {
|
|
14
14
|
const frameWindow = getFrameWindow();
|
|
15
15
|
const clientAPI = frameWindow.__STORYBOOK_CLIENT_API__;
|
|
16
|
-
const addons = frameWindow.__STORYBOOK_ADDONS;
|
|
16
|
+
const addons = frameWindow.__STORYBOOK_ADDONS || frameWindow.__STORYBOOK_ADDONS_PREVIEW;
|
|
17
17
|
|
|
18
18
|
return getAPI(getStorybookVersion());
|
|
19
19
|
|
|
20
20
|
function getStorybookVersion() {
|
|
21
|
-
const
|
|
21
|
+
const addonsForV4 = frameWindow.__STORYBOOK_ADDONS;
|
|
22
22
|
|
|
23
23
|
if (frameWindow.__STORYBOOK_PREVIEW__) {
|
|
24
24
|
return API_VERSIONS.v6_4;
|
|
@@ -27,11 +27,11 @@ function __runRunBeforeScript(...args) {
|
|
|
27
27
|
} else if (frameWindow.__STORYBOOK_CLIENT_API__ && frameWindow.__STORYBOOK_CLIENT_API__.raw) {
|
|
28
28
|
return API_VERSIONS.v5;
|
|
29
29
|
} else if (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
addonsForV4 &&
|
|
31
|
+
addonsForV4.channel &&
|
|
32
|
+
addonsForV4.channel._listeners &&
|
|
33
|
+
addonsForV4.channel._listeners.setCurrentStory &&
|
|
34
|
+
addonsForV4.channel._listeners.setCurrentStory[0]
|
|
35
35
|
) {
|
|
36
36
|
return API_VERSIONS.v4;
|
|
37
37
|
} else {
|
|
@@ -43,6 +43,15 @@ function __runRunBeforeScript(...args) {
|
|
|
43
43
|
addons.channel.once('storyRendered', () => {
|
|
44
44
|
setTimeout(callback, 0);
|
|
45
45
|
});
|
|
46
|
+
addons.channel.once('playFunctionThrewException', () => {
|
|
47
|
+
setTimeout(callback, 0);
|
|
48
|
+
});
|
|
49
|
+
addons.channel.once('storyErrored', () => {
|
|
50
|
+
setTimeout(callback, 0);
|
|
51
|
+
});
|
|
52
|
+
addons.channel.once('storyThrewException', () => {
|
|
53
|
+
setTimeout(callback, 0);
|
|
54
|
+
});
|
|
46
55
|
} else {
|
|
47
56
|
callback();
|
|
48
57
|
}
|
|
@@ -110,9 +119,14 @@ function __runRunBeforeScript(...args) {
|
|
|
110
119
|
await clientAPI.storyStore.cacheAllCSFFiles();
|
|
111
120
|
storyId = clientAPI.raw()[i].id;
|
|
112
121
|
}
|
|
113
|
-
frameWindow.__STORYBOOK_PREVIEW__.urlStore
|
|
114
|
-
|
|
115
|
-
|
|
122
|
+
if (frameWindow.__STORYBOOK_PREVIEW__.urlStore) {
|
|
123
|
+
frameWindow.__STORYBOOK_PREVIEW__.urlStore.setSelection({
|
|
124
|
+
storyId,
|
|
125
|
+
});
|
|
126
|
+
} else {
|
|
127
|
+
// storybook v7
|
|
128
|
+
frameWindow.__STORYBOOK_PREVIEW__.selectionStore.setSelection({storyId});
|
|
129
|
+
}
|
|
116
130
|
await frameWindow.__STORYBOOK_PREVIEW__.renderSelection();
|
|
117
131
|
},
|
|
118
132
|
onStoryRendered,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/eyes-storybook",
|
|
3
|
-
"version": "3.31.
|
|
3
|
+
"version": "3.31.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -35,28 +35,27 @@
|
|
|
35
35
|
"build:heavy": "node scripts/bitmap.js",
|
|
36
36
|
"test": "yarn build && yarn test:mocha && yarn lint",
|
|
37
37
|
"test:sanity": "yarn test:unit && yarn test:it",
|
|
38
|
-
"test:mocha": "
|
|
38
|
+
"test:mocha": "mocha --no-timeouts --trace-warnings 'test/{unit,it,e2e}/*.test.js'",
|
|
39
39
|
"test:unit": "mocha --no-timeouts --trace-warnings 'test/unit/*.test.js'",
|
|
40
40
|
"test:it": "mocha --no-timeouts --trace-warnings 'test/it/*.test.js'",
|
|
41
41
|
"test:versions": "yarn build && yarn test:e2e:versions && yarn lint",
|
|
42
42
|
"test:e2e": "mocha --no-timeouts --trace-warnings 'test/e2e/*.e2e.test.js'",
|
|
43
|
-
"test:e2e:versions": "npx mocha --no-timeouts --trace-warnings --require test/fixtures/storybook-versions/mochaHooks.js test/
|
|
44
|
-
"test:e2e:versions_local": "STORYBOOK_VERSION=latest npx mocha --no-timeouts --trace-warnings --require test/fixtures/storybook-versions/mochaHooks.js test/
|
|
43
|
+
"test:e2e:versions": "npx mocha --no-timeouts --trace-warnings --require test/fixtures/storybook-versions/mochaHooks.js test/versions/*.e2e.versions.test.js",
|
|
44
|
+
"test:e2e:versions_local": "STORYBOOK_VERSION=latest npx mocha --no-timeouts --trace-warnings --require test/fixtures/storybook-versions/mochaHooks.js test/versions/*.e2e.versions.test.js",
|
|
45
45
|
"storybook": "start-storybook -c test/fixtures/appWithStorybook -p 9001 -s test/fixtures",
|
|
46
46
|
"storybook:httpHeaders": "start-storybook -c test/fixtures/appWithCustomHttpHeaders -p 9007",
|
|
47
47
|
"storybook:jslayout": "start-storybook -c test/fixtures/jsLayoutStorybookLocal -p 9001 -s test/fixtures",
|
|
48
|
-
"storybook:csf": "
|
|
49
|
-
"storybook:csf-service": "cp -r test/fixtures/storybookCSF/.storybook/. test/fixtures/storybookCSF/.storybook-temp && rm test/fixtures/storybookCSF/.storybook-temp/config.js",
|
|
48
|
+
"storybook:csf": "start-storybook -c test/fixtures/storybook-versions/latest/.storybook -p 9001",
|
|
50
49
|
"storybook:heavy": "start-storybook -c test/fixtures/heavyStorybook -p 9002 -s test/fixtures",
|
|
51
50
|
"storybook:zeroStories": "start-storybook -c test/fixtures/zeroStoriesRetry -p 9003 -s test/fixtures",
|
|
52
|
-
"storybook:csf-
|
|
51
|
+
"storybook:csf-storyStore7": "start-storybook -c test/fixtures/storybook-storyStore7/.storybook/ -p 9004 -s test/fixtures/",
|
|
53
52
|
"eyes-storybook": "node bin/eyes-storybook.js -f test/fixtures/applitools.config.js",
|
|
54
53
|
"eyes-storybook:jslayout": "node bin/eyes-storybook.js -f test/e2e/happy-config/layout-breakpoints-local.config.js",
|
|
55
54
|
"eyes-storybook:heavy": "node bin/eyes-storybook.js -f test/fixtures/heavyStorybook/applitools.config.js",
|
|
56
55
|
"eyes-storybook:configured": "node bin/eyes-storybook.js -f scripts/preconfigured.config.js",
|
|
57
56
|
"eyes-storybook:zeroStories": "node bin/eyes-storybook.js -f test/fixtures/zeroStoriesRetry/applitools.config.js",
|
|
58
57
|
"eyes-storybook:httpHeaders": "node bin/eyes-storybook.js -f test/fixtures/appWithCustomHttpHeaders/applitools.config.js",
|
|
59
|
-
"eyes-storybook:csf-
|
|
58
|
+
"eyes-storybook:csf-storyStore7": "node bin/eyes-storybook.js -f test/fixtures/storybook-storyStore7/applitools.config.js",
|
|
60
59
|
"changelog": "git changelog -x -p -f v$npm_package_version > History.md && git add ./History.md && git commit -am 'changelog'",
|
|
61
60
|
"changelog:init": "git config changelog.format \"* %s [[%h]($(echo $npm_package_repository_url|cut -d+ -f2|cut -d. -f1-2)/commit/%H)]\"",
|
|
62
61
|
"changelog:install": "sudo apt-get install git-extras",
|
|
@@ -74,14 +73,14 @@
|
|
|
74
73
|
}
|
|
75
74
|
},
|
|
76
75
|
"dependencies": {
|
|
77
|
-
"@applitools/core": "2.3.
|
|
78
|
-
"@applitools/driver": "1.11.
|
|
76
|
+
"@applitools/core": "2.3.14",
|
|
77
|
+
"@applitools/driver": "1.11.35",
|
|
79
78
|
"@applitools/functional-commons": "1.6.0",
|
|
80
|
-
"@applitools/logger": "1.1.
|
|
79
|
+
"@applitools/logger": "1.1.46",
|
|
81
80
|
"@applitools/monitoring-commons": "1.0.19",
|
|
82
|
-
"@applitools/spec-driver-puppeteer": "1.1.
|
|
83
|
-
"@applitools/test-server": "1.1.
|
|
84
|
-
"@applitools/ufg-client": "1.1
|
|
81
|
+
"@applitools/spec-driver-puppeteer": "1.1.47",
|
|
82
|
+
"@applitools/test-server": "1.1.26",
|
|
83
|
+
"@applitools/ufg-client": "1.2.1",
|
|
85
84
|
"@applitools/utils": "1.3.30",
|
|
86
85
|
"boxen": "4.2.0",
|
|
87
86
|
"chalk": "3.0.0",
|
|
@@ -10,12 +10,12 @@ const API_VERSIONS = {
|
|
|
10
10
|
function getClientAPI() {
|
|
11
11
|
const frameWindow = getFrameWindow();
|
|
12
12
|
const clientAPI = frameWindow.__STORYBOOK_CLIENT_API__;
|
|
13
|
-
const addons = frameWindow.__STORYBOOK_ADDONS;
|
|
13
|
+
const addons = frameWindow.__STORYBOOK_ADDONS || frameWindow.__STORYBOOK_ADDONS_PREVIEW;
|
|
14
14
|
|
|
15
15
|
return getAPI(getStorybookVersion());
|
|
16
16
|
|
|
17
17
|
function getStorybookVersion() {
|
|
18
|
-
const
|
|
18
|
+
const addonsForV4 = frameWindow.__STORYBOOK_ADDONS;
|
|
19
19
|
|
|
20
20
|
if (frameWindow.__STORYBOOK_PREVIEW__) {
|
|
21
21
|
return API_VERSIONS.v6_4;
|
|
@@ -24,11 +24,11 @@ function getClientAPI() {
|
|
|
24
24
|
} else if (frameWindow.__STORYBOOK_CLIENT_API__ && frameWindow.__STORYBOOK_CLIENT_API__.raw) {
|
|
25
25
|
return API_VERSIONS.v5;
|
|
26
26
|
} else if (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
addonsForV4 &&
|
|
28
|
+
addonsForV4.channel &&
|
|
29
|
+
addonsForV4.channel._listeners &&
|
|
30
|
+
addonsForV4.channel._listeners.setCurrentStory &&
|
|
31
|
+
addonsForV4.channel._listeners.setCurrentStory[0]
|
|
32
32
|
) {
|
|
33
33
|
return API_VERSIONS.v4;
|
|
34
34
|
} else {
|
|
@@ -40,6 +40,15 @@ function getClientAPI() {
|
|
|
40
40
|
addons.channel.once('storyRendered', () => {
|
|
41
41
|
setTimeout(callback, 0);
|
|
42
42
|
});
|
|
43
|
+
addons.channel.once('playFunctionThrewException', () => {
|
|
44
|
+
setTimeout(callback, 0);
|
|
45
|
+
});
|
|
46
|
+
addons.channel.once('storyErrored', () => {
|
|
47
|
+
setTimeout(callback, 0);
|
|
48
|
+
});
|
|
49
|
+
addons.channel.once('storyThrewException', () => {
|
|
50
|
+
setTimeout(callback, 0);
|
|
51
|
+
});
|
|
43
52
|
} else {
|
|
44
53
|
callback();
|
|
45
54
|
}
|
|
@@ -107,9 +116,14 @@ function getClientAPI() {
|
|
|
107
116
|
await clientAPI.storyStore.cacheAllCSFFiles();
|
|
108
117
|
storyId = clientAPI.raw()[i].id;
|
|
109
118
|
}
|
|
110
|
-
frameWindow.__STORYBOOK_PREVIEW__.urlStore
|
|
111
|
-
|
|
112
|
-
|
|
119
|
+
if (frameWindow.__STORYBOOK_PREVIEW__.urlStore) {
|
|
120
|
+
frameWindow.__STORYBOOK_PREVIEW__.urlStore.setSelection({
|
|
121
|
+
storyId,
|
|
122
|
+
});
|
|
123
|
+
} else {
|
|
124
|
+
// storybook v7
|
|
125
|
+
frameWindow.__STORYBOOK_PREVIEW__.selectionStore.setSelection({storyId});
|
|
126
|
+
}
|
|
113
127
|
await frameWindow.__STORYBOOK_PREVIEW__.renderSelection();
|
|
114
128
|
},
|
|
115
129
|
onStoryRendered,
|
package/src/eyesStorybook.js
CHANGED
|
@@ -61,6 +61,10 @@ async function eyesStorybook({
|
|
|
61
61
|
const browser = await puppeteer.launch(config.puppeteerOptions);
|
|
62
62
|
logger.log('browser launched');
|
|
63
63
|
const page = await browser.newPage();
|
|
64
|
+
// we send http headers here and in init page
|
|
65
|
+
if (config.puppeteerExtraHTTPHeaders) {
|
|
66
|
+
await page.setExtraHTTPHeaders(config.puppeteerExtraHTTPHeaders);
|
|
67
|
+
}
|
|
64
68
|
const core = await makeCore({
|
|
65
69
|
spec,
|
|
66
70
|
concurrency: testConcurrency,
|
|
@@ -129,6 +133,7 @@ async function eyesStorybook({
|
|
|
129
133
|
getChromeEmulationDevices: client.getChromeEmulationDevices,
|
|
130
134
|
getIOSDevices: client.getIOSDevices,
|
|
131
135
|
},
|
|
136
|
+
showLogs: config.showLogs,
|
|
132
137
|
});
|
|
133
138
|
return result;
|
|
134
139
|
};
|
package/src/renderStories.js
CHANGED
|
@@ -124,8 +124,7 @@ function makeRenderStories({
|
|
|
124
124
|
|
|
125
125
|
function didTestPass({resultsOrErr}) {
|
|
126
126
|
return (
|
|
127
|
-
resultsOrErr
|
|
128
|
-
resultsOrErr.constructor.name !== 'Error' &&
|
|
127
|
+
Array.isArray(resultsOrErr) &&
|
|
129
128
|
resultsOrErr.every(r => !r.isDifferent && !r.isAborted && !r.isNew)
|
|
130
129
|
);
|
|
131
130
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const {resolve} = require('path');
|
|
3
3
|
const ora = require('ora');
|
|
4
4
|
const StorybookConnector = require('./storybookConnector');
|
|
5
|
+
const fs = require('fs');
|
|
5
6
|
|
|
6
7
|
async function startStorybookServer({
|
|
7
8
|
packagePath,
|
|
@@ -14,7 +15,14 @@ async function startStorybookServer({
|
|
|
14
15
|
startStorybookServerTimeout,
|
|
15
16
|
}) {
|
|
16
17
|
const isWindows = process.platform.startsWith('win');
|
|
17
|
-
|
|
18
|
+
let storybookPath, sbArg;
|
|
19
|
+
|
|
20
|
+
if (fs.existsSync(resolve(packagePath, 'node_modules/.bin/sb'))) {
|
|
21
|
+
storybookPath = resolve(packagePath, 'node_modules/.bin/sb');
|
|
22
|
+
sbArg = 'dev';
|
|
23
|
+
} else {
|
|
24
|
+
storybookPath = resolve(packagePath, 'node_modules/.bin/start-storybook');
|
|
25
|
+
}
|
|
18
26
|
|
|
19
27
|
const storybookConnector = new StorybookConnector({
|
|
20
28
|
storybookPath,
|
|
@@ -24,6 +32,7 @@ async function startStorybookServer({
|
|
|
24
32
|
storybookStaticDir,
|
|
25
33
|
isWindows,
|
|
26
34
|
logger,
|
|
35
|
+
sbArg,
|
|
27
36
|
});
|
|
28
37
|
|
|
29
38
|
if (showStorybookOutput) {
|
|
@@ -12,6 +12,7 @@ class StorybookConnector extends EventEmitter {
|
|
|
12
12
|
storybookStaticDir,
|
|
13
13
|
isWindows,
|
|
14
14
|
logger,
|
|
15
|
+
sbArg,
|
|
15
16
|
}) {
|
|
16
17
|
super();
|
|
17
18
|
this._storybookPath = `${storybookPath}${isWindows ? '.cmd' : ''}`;
|
|
@@ -21,6 +22,7 @@ class StorybookConnector extends EventEmitter {
|
|
|
21
22
|
this._storybookStaticDir = storybookStaticDir;
|
|
22
23
|
this._isWindows = isWindows;
|
|
23
24
|
this._logger = logger;
|
|
25
|
+
this._sbArg = sbArg;
|
|
24
26
|
|
|
25
27
|
this._childProcess = null;
|
|
26
28
|
this._version = 5;
|
|
@@ -114,8 +116,18 @@ class StorybookConnector extends EventEmitter {
|
|
|
114
116
|
if (version >= 4) {
|
|
115
117
|
args.push('--ci');
|
|
116
118
|
}
|
|
119
|
+
if (this._sbArg) {
|
|
120
|
+
args.unshift(this._sbArg);
|
|
121
|
+
}
|
|
117
122
|
this._logger.log(`${this._storybookPath} ${args.join(' ')}`);
|
|
118
|
-
|
|
123
|
+
const spawnOptions = {detached: false};
|
|
124
|
+
|
|
125
|
+
// Storybook has an issue when running with Node.js v18 - https://github.com/storybookjs/storybook/issues/20482
|
|
126
|
+
if (parseInt(process.versions.node) > 16) {
|
|
127
|
+
spawnOptions.env = {...process.env, NODE_OPTIONS: '--openssl-legacy-provider'};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
this._childProcess = spawn(this._storybookPath, args, spawnOptions);
|
|
119
131
|
this._addListeners();
|
|
120
132
|
|
|
121
133
|
this._childProcess.once('exit', code => {
|