@applitools/eyes-storybook 3.27.6 → 3.29.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 +26 -0
- package/README.md +11 -2
- package/dist/getClientAPI.js +13 -1
- package/dist/getStories.js +15 -2
- package/dist/renderStoryWithClientAPI.js +24 -9
- package/dist/runRunAfterScript.js +13 -1
- package/dist/runRunBeforeScript.js +13 -1
- package/package.json +53 -43
- package/src/browser/getClientAPI.js +13 -1
- package/src/browser/getStories.js +2 -1
- package/src/browser/renderStoryWithClientAPI.js +11 -8
- package/src/cli.js +1 -1
- package/src/concurrencyMsg.js +1 -1
- package/src/errMessages.js +1 -1
- package/src/eyesStorybook.js +3 -3
- package/src/generateConfig.js +4 -3
- package/src/getStoryData.js +17 -3
- package/src/postinstall.js +1 -1
- package/src/processResults.js +1 -1
- package/src/renderStory.js +4 -1
- package/src/shouldRenderIE.js +1 -3
- package/src/validateAndPopulateConfig.js +1 -1
- package/src/chalkify.js +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
|
|
6
|
+
## 3.29.1 - 2022/6/16
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
- Allowed `` values in custom properties
|
|
10
|
+
- Add special attribute for pseudo elements
|
|
11
|
+
- Support padding for regions in the following region types - ignoreRegions, layoutRegions, strictRegions, contentRegions
|
|
12
|
+
### Bug fixes
|
|
13
|
+
- Fixed broken links to enums implementation in the README.md
|
|
14
|
+
- Fix rendering issues with Salesforce Lightning design system
|
|
15
|
+
- Add timeout when attempting to get data for a story
|
|
16
|
+
|
|
17
|
+
## 3.29.0 - 2022/6/2
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
- Dorp support for Node.js versions <=12
|
|
21
|
+
### Bug fixes
|
|
22
|
+
|
|
23
|
+
## 3.28.0 - 2022/5/26
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
- Support [Storybook interactions](https://storybook.js.org/docs/react/essentials/interactions). For stories which have a `Play` function defined, the screenshot will be taken automatically after the `Play` flow is done.
|
|
27
|
+
### Bug fixes
|
|
28
|
+
- added `properties` and `notifyOnCompletion` as optional Types of Batch (for TS)
|
|
29
|
+
- Allow running with self-signed certificates
|
|
30
|
+
|
|
5
31
|
## 3.27.6 - 2022/4/13
|
|
6
32
|
|
|
7
33
|
### Features
|
package/README.md
CHANGED
|
@@ -49,6 +49,7 @@ Applitools Eyes SDK for [Storybook](http://storybook.js.org).
|
|
|
49
49
|
- [`layoutBreakpoints`](#layoutbreakpoints)
|
|
50
50
|
- [Running Eyes-Storybook in Docker](#running-eyes-storybook-in-docker)
|
|
51
51
|
- [Dealing with dynamic data](#dealing-with-dynamic-data)
|
|
52
|
+
- [Storybook interactions Play functionality](#storybook-interactions-play-functionality)
|
|
52
53
|
|
|
53
54
|
## Installation
|
|
54
55
|
|
|
@@ -292,7 +293,7 @@ module.exports = {
|
|
|
292
293
|
|
|
293
294
|
Possible values for screen orientation are `landscape` and `portrait`, and if no value is specified, the default is `portrait`.
|
|
294
295
|
|
|
295
|
-
The list of device names is available at https://github.com/applitools/eyes.sdk.javascript1/blob/master/packages/eyes-
|
|
296
|
+
The list of device names is available at https://github.com/applitools/eyes.sdk.javascript1/blob/master/packages/eyes-api/src/enums/DeviceName.ts
|
|
296
297
|
|
|
297
298
|
In addition, it's possible to use chrome's device emulation with custom viewport sizes, pixel density and mobile mode, by passing `deviceScaleFactor` and `mobile` in addition to `width` and `height`. For example:
|
|
298
299
|
|
|
@@ -322,7 +323,7 @@ module.exports = {
|
|
|
322
323
|
}
|
|
323
324
|
```
|
|
324
325
|
|
|
325
|
-
The list of devices is available at https://github.com/applitools/eyes.sdk.javascript1/blob/master/packages/eyes-
|
|
326
|
+
The list of devices is available at https://github.com/applitools/eyes.sdk.javascript1/blob/master/packages/eyes-api/src/enums/IosDeviceName.ts
|
|
326
327
|
|
|
327
328
|
Possible values for `iosVersion` are:
|
|
328
329
|
|
|
@@ -848,3 +849,11 @@ const date = new Date(isBeingTested ? SOME_FIXED_DATE : undefined)
|
|
|
848
849
|
|
|
849
850
|
storiesOf('Some kind', module).add('Date', () => <div>{date}</div>)
|
|
850
851
|
```
|
|
852
|
+
|
|
853
|
+
## Storybook interactions Play functionality
|
|
854
|
+
|
|
855
|
+
Since version 3.28.0, there is a support for Storybooks' Interactions Play functionality: Stories who use 'Play', screenshot will be taken _automatically_ after the 'Play' flow is done.
|
|
856
|
+
This will replace the existing point of taking screenshots, it should not affect any new or existing Stories which are **not** using the 'Play' functionality.
|
|
857
|
+
Tests that use the _`waitBeforeCapture`_ property, the wait period will begin **after** the 'Play' flow is done.
|
|
858
|
+
You can read more at Storybook interactions documentation:
|
|
859
|
+
https://storybook.js.org/docs/react/essentials/interactions
|
package/dist/getClientAPI.js
CHANGED
|
@@ -38,7 +38,15 @@ function __getClientAPI(...args) {
|
|
|
38
38
|
throw new Error("Cannot get client API: couldn't detect storybook version");
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
function onStoryRendered(callback) {
|
|
42
|
+
if (addons && addons.channel && addons.channel.once) {
|
|
43
|
+
addons.channel.once('storyRendered', () => {
|
|
44
|
+
setTimeout(callback, 0);
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
callback();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
42
50
|
function getAPI(version) {
|
|
43
51
|
if (version) {
|
|
44
52
|
let api;
|
|
@@ -57,6 +65,7 @@ function __getClientAPI(...args) {
|
|
|
57
65
|
const {kind, name: story} = api.getStories()[i];
|
|
58
66
|
addons.channel._listeners.setCurrentStory[0]({kind, story});
|
|
59
67
|
},
|
|
68
|
+
onStoryRendered,
|
|
60
69
|
};
|
|
61
70
|
break;
|
|
62
71
|
}
|
|
@@ -69,6 +78,7 @@ function __getClientAPI(...args) {
|
|
|
69
78
|
selectStory: i => {
|
|
70
79
|
clientAPI._storyStore.setSelection(clientAPI.raw()[i]);
|
|
71
80
|
},
|
|
81
|
+
onStoryRendered,
|
|
72
82
|
};
|
|
73
83
|
break;
|
|
74
84
|
}
|
|
@@ -81,6 +91,7 @@ function __getClientAPI(...args) {
|
|
|
81
91
|
selectStory: i => {
|
|
82
92
|
frameWindow.__STORYBOOK_STORY_STORE__.setSelection({storyId: clientAPI.raw()[i].id});
|
|
83
93
|
},
|
|
94
|
+
onStoryRendered,
|
|
84
95
|
};
|
|
85
96
|
break;
|
|
86
97
|
}
|
|
@@ -96,6 +107,7 @@ function __getClientAPI(...args) {
|
|
|
96
107
|
});
|
|
97
108
|
await frameWindow.__STORYBOOK_PREVIEW__.renderSelection();
|
|
98
109
|
},
|
|
110
|
+
onStoryRendered,
|
|
99
111
|
};
|
|
100
112
|
break;
|
|
101
113
|
}
|
package/dist/getStories.js
CHANGED
|
@@ -38,7 +38,15 @@ function __getStories(...args) {
|
|
|
38
38
|
throw new Error("Cannot get client API: couldn't detect storybook version");
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
function onStoryRendered(callback) {
|
|
42
|
+
if (addons && addons.channel && addons.channel.once) {
|
|
43
|
+
addons.channel.once('storyRendered', () => {
|
|
44
|
+
setTimeout(callback, 0);
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
callback();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
42
50
|
function getAPI(version) {
|
|
43
51
|
if (version) {
|
|
44
52
|
let api;
|
|
@@ -57,6 +65,7 @@ function __getStories(...args) {
|
|
|
57
65
|
const {kind, name: story} = api.getStories()[i];
|
|
58
66
|
addons.channel._listeners.setCurrentStory[0]({kind, story});
|
|
59
67
|
},
|
|
68
|
+
onStoryRendered,
|
|
60
69
|
};
|
|
61
70
|
break;
|
|
62
71
|
}
|
|
@@ -69,6 +78,7 @@ function __getStories(...args) {
|
|
|
69
78
|
selectStory: i => {
|
|
70
79
|
clientAPI._storyStore.setSelection(clientAPI.raw()[i]);
|
|
71
80
|
},
|
|
81
|
+
onStoryRendered,
|
|
72
82
|
};
|
|
73
83
|
break;
|
|
74
84
|
}
|
|
@@ -81,6 +91,7 @@ function __getStories(...args) {
|
|
|
81
91
|
selectStory: i => {
|
|
82
92
|
frameWindow.__STORYBOOK_STORY_STORE__.setSelection({storyId: clientAPI.raw()[i].id});
|
|
83
93
|
},
|
|
94
|
+
onStoryRendered,
|
|
84
95
|
};
|
|
85
96
|
break;
|
|
86
97
|
}
|
|
@@ -96,6 +107,7 @@ function __getStories(...args) {
|
|
|
96
107
|
});
|
|
97
108
|
await frameWindow.__STORYBOOK_PREVIEW__.renderSelection();
|
|
98
109
|
},
|
|
110
|
+
onStoryRendered,
|
|
99
111
|
};
|
|
100
112
|
break;
|
|
101
113
|
}
|
|
@@ -259,9 +271,10 @@ function __getStories(...args) {
|
|
|
259
271
|
}
|
|
260
272
|
}
|
|
261
273
|
}
|
|
262
|
-
|
|
274
|
+
const hasPlayFunction = !!story.playFunction;
|
|
263
275
|
return {
|
|
264
276
|
isApi: true,
|
|
277
|
+
hasPlayFunction,
|
|
265
278
|
index,
|
|
266
279
|
name,
|
|
267
280
|
kind,
|
|
@@ -38,7 +38,15 @@ function __renderStoryWithClientAPI(...args) {
|
|
|
38
38
|
throw new Error("Cannot get client API: couldn't detect storybook version");
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
function onStoryRendered(callback) {
|
|
42
|
+
if (addons && addons.channel && addons.channel.once) {
|
|
43
|
+
addons.channel.once('storyRendered', () => {
|
|
44
|
+
setTimeout(callback, 0);
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
callback();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
42
50
|
function getAPI(version) {
|
|
43
51
|
if (version) {
|
|
44
52
|
let api;
|
|
@@ -57,6 +65,7 @@ function __renderStoryWithClientAPI(...args) {
|
|
|
57
65
|
const {kind, name: story} = api.getStories()[i];
|
|
58
66
|
addons.channel._listeners.setCurrentStory[0]({kind, story});
|
|
59
67
|
},
|
|
68
|
+
onStoryRendered,
|
|
60
69
|
};
|
|
61
70
|
break;
|
|
62
71
|
}
|
|
@@ -69,6 +78,7 @@ function __renderStoryWithClientAPI(...args) {
|
|
|
69
78
|
selectStory: i => {
|
|
70
79
|
clientAPI._storyStore.setSelection(clientAPI.raw()[i]);
|
|
71
80
|
},
|
|
81
|
+
onStoryRendered,
|
|
72
82
|
};
|
|
73
83
|
break;
|
|
74
84
|
}
|
|
@@ -81,6 +91,7 @@ function __renderStoryWithClientAPI(...args) {
|
|
|
81
91
|
selectStory: i => {
|
|
82
92
|
frameWindow.__STORYBOOK_STORY_STORE__.setSelection({storyId: clientAPI.raw()[i].id});
|
|
83
93
|
},
|
|
94
|
+
onStoryRendered,
|
|
84
95
|
};
|
|
85
96
|
break;
|
|
86
97
|
}
|
|
@@ -96,6 +107,7 @@ function __renderStoryWithClientAPI(...args) {
|
|
|
96
107
|
});
|
|
97
108
|
await frameWindow.__STORYBOOK_PREVIEW__.renderSelection();
|
|
98
109
|
},
|
|
110
|
+
onStoryRendered,
|
|
99
111
|
};
|
|
100
112
|
break;
|
|
101
113
|
}
|
|
@@ -130,14 +142,17 @@ function __renderStoryWithClientAPI(...args) {
|
|
|
130
142
|
|
|
131
143
|
var getClientAPI_1 = getClientAPI;
|
|
132
144
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
145
|
+
function renderStoryWithClientAPI(index) {
|
|
146
|
+
return new Promise(resolve => {
|
|
147
|
+
let api;
|
|
148
|
+
try {
|
|
149
|
+
api = getClientAPI_1();
|
|
150
|
+
api.selectStory(index);
|
|
151
|
+
api.onStoryRendered(resolve);
|
|
152
|
+
} catch (ex) {
|
|
153
|
+
resolve({message: ex.message, version: api ? api.version : undefined});
|
|
154
|
+
}
|
|
155
|
+
});
|
|
141
156
|
}
|
|
142
157
|
|
|
143
158
|
var renderStoryWithClientAPI_1 = renderStoryWithClientAPI;
|
|
@@ -38,7 +38,15 @@ function __runRunAfterScript(...args) {
|
|
|
38
38
|
throw new Error("Cannot get client API: couldn't detect storybook version");
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
function onStoryRendered(callback) {
|
|
42
|
+
if (addons && addons.channel && addons.channel.once) {
|
|
43
|
+
addons.channel.once('storyRendered', () => {
|
|
44
|
+
setTimeout(callback, 0);
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
callback();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
42
50
|
function getAPI(version) {
|
|
43
51
|
if (version) {
|
|
44
52
|
let api;
|
|
@@ -57,6 +65,7 @@ function __runRunAfterScript(...args) {
|
|
|
57
65
|
const {kind, name: story} = api.getStories()[i];
|
|
58
66
|
addons.channel._listeners.setCurrentStory[0]({kind, story});
|
|
59
67
|
},
|
|
68
|
+
onStoryRendered,
|
|
60
69
|
};
|
|
61
70
|
break;
|
|
62
71
|
}
|
|
@@ -69,6 +78,7 @@ function __runRunAfterScript(...args) {
|
|
|
69
78
|
selectStory: i => {
|
|
70
79
|
clientAPI._storyStore.setSelection(clientAPI.raw()[i]);
|
|
71
80
|
},
|
|
81
|
+
onStoryRendered,
|
|
72
82
|
};
|
|
73
83
|
break;
|
|
74
84
|
}
|
|
@@ -81,6 +91,7 @@ function __runRunAfterScript(...args) {
|
|
|
81
91
|
selectStory: i => {
|
|
82
92
|
frameWindow.__STORYBOOK_STORY_STORE__.setSelection({storyId: clientAPI.raw()[i].id});
|
|
83
93
|
},
|
|
94
|
+
onStoryRendered,
|
|
84
95
|
};
|
|
85
96
|
break;
|
|
86
97
|
}
|
|
@@ -96,6 +107,7 @@ function __runRunAfterScript(...args) {
|
|
|
96
107
|
});
|
|
97
108
|
await frameWindow.__STORYBOOK_PREVIEW__.renderSelection();
|
|
98
109
|
},
|
|
110
|
+
onStoryRendered,
|
|
99
111
|
};
|
|
100
112
|
break;
|
|
101
113
|
}
|
|
@@ -38,7 +38,15 @@ function __runRunBeforeScript(...args) {
|
|
|
38
38
|
throw new Error("Cannot get client API: couldn't detect storybook version");
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
function onStoryRendered(callback) {
|
|
42
|
+
if (addons && addons.channel && addons.channel.once) {
|
|
43
|
+
addons.channel.once('storyRendered', () => {
|
|
44
|
+
setTimeout(callback, 0);
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
callback();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
42
50
|
function getAPI(version) {
|
|
43
51
|
if (version) {
|
|
44
52
|
let api;
|
|
@@ -57,6 +65,7 @@ function __runRunBeforeScript(...args) {
|
|
|
57
65
|
const {kind, name: story} = api.getStories()[i];
|
|
58
66
|
addons.channel._listeners.setCurrentStory[0]({kind, story});
|
|
59
67
|
},
|
|
68
|
+
onStoryRendered,
|
|
60
69
|
};
|
|
61
70
|
break;
|
|
62
71
|
}
|
|
@@ -69,6 +78,7 @@ function __runRunBeforeScript(...args) {
|
|
|
69
78
|
selectStory: i => {
|
|
70
79
|
clientAPI._storyStore.setSelection(clientAPI.raw()[i]);
|
|
71
80
|
},
|
|
81
|
+
onStoryRendered,
|
|
72
82
|
};
|
|
73
83
|
break;
|
|
74
84
|
}
|
|
@@ -81,6 +91,7 @@ function __runRunBeforeScript(...args) {
|
|
|
81
91
|
selectStory: i => {
|
|
82
92
|
frameWindow.__STORYBOOK_STORY_STORE__.setSelection({storyId: clientAPI.raw()[i].id});
|
|
83
93
|
},
|
|
94
|
+
onStoryRendered,
|
|
84
95
|
};
|
|
85
96
|
break;
|
|
86
97
|
}
|
|
@@ -96,6 +107,7 @@ function __runRunBeforeScript(...args) {
|
|
|
96
107
|
});
|
|
97
108
|
await frameWindow.__STORYBOOK_PREVIEW__.renderSelection();
|
|
98
109
|
},
|
|
110
|
+
onStoryRendered,
|
|
99
111
|
};
|
|
100
112
|
break;
|
|
101
113
|
}
|
package/package.json
CHANGED
|
@@ -1,29 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/eyes-storybook",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.29.1",
|
|
4
4
|
"description": "",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"keywords": [
|
|
6
|
+
"applitools",
|
|
7
|
+
"testing",
|
|
8
|
+
"browser",
|
|
9
|
+
"grid",
|
|
10
|
+
"visual-testing",
|
|
11
|
+
"nodejs",
|
|
12
|
+
"javascript"
|
|
13
|
+
],
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git://github.com/applitools/eyes.sdk.javascript1.git",
|
|
17
|
+
"directory": "packages/eyes-storybook"
|
|
18
|
+
},
|
|
19
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
20
|
+
"author": "Applitools Team <team@applitools.com>",
|
|
21
|
+
"aliases": [
|
|
22
|
+
"storybook"
|
|
23
|
+
],
|
|
24
|
+
"bin": {
|
|
25
|
+
"eyes-storybook": "./bin/eyes-storybook.js"
|
|
7
26
|
},
|
|
8
27
|
"files": [
|
|
9
28
|
"src",
|
|
10
29
|
"bin",
|
|
11
30
|
"dist"
|
|
12
31
|
],
|
|
13
|
-
"bin": {
|
|
14
|
-
"eyes-storybook": "./bin/eyes-storybook.js"
|
|
15
|
-
},
|
|
16
32
|
"scripts": {
|
|
17
|
-
"
|
|
18
|
-
"test:mocha": "yarn test:unit && yarn test:it && yarn test:e2e",
|
|
19
|
-
"test:unit": "STDOUT_LEVEL=0 mocha --no-timeouts --trace-warnings 'test/unit/*.test.js'",
|
|
20
|
-
"test:it": "STDOUT_LEVEL=1 mocha --no-timeouts --trace-warnings 'test/it/*.test.js'",
|
|
21
|
-
"test:e2e": "mocha --no-timeouts --trace-warnings 'test/e2e/*.test.js'",
|
|
33
|
+
"lint": "eslint '**/*.js'",
|
|
22
34
|
"build": "rollup -c rollup.config.js",
|
|
23
35
|
"build:heavy": "node scripts/bitmap.js",
|
|
24
|
-
"
|
|
36
|
+
"test": "yarn build && yarn test:mocha && yarn lint",
|
|
37
|
+
"test:versions": "yarn build && yarn test:e2e:versions && yarn lint",
|
|
38
|
+
"test:mocha": "yarn test:unit && yarn test:it && yarn test:e2e",
|
|
39
|
+
"test:unit": "mocha --no-timeouts --trace-warnings 'test/unit/*.test.js'",
|
|
40
|
+
"test:it": "mocha --no-timeouts --trace-warnings 'test/it/*.test.js'",
|
|
41
|
+
"test:e2e": "mocha --no-timeouts --trace-warnings 'test/e2e/*.e2e.test.js'",
|
|
42
|
+
"test:e2e:versions": "npx mocha --no-timeouts --trace-warnings --require test/fixtures/storybook-versions/mochaHooks.js test/e2e/*.e2e.versions.test.js",
|
|
43
|
+
"test:e2e:versions_local": "STORYBOOK_VERSION=latest npx mocha --no-timeouts --trace-warnings --require test/fixtures/storybook-versions/mochaHooks.js test/e2e/*.e2e.versions.test.js",
|
|
25
44
|
"storybook": "start-storybook -c test/fixtures/appWithStorybook -p 9001 -s test/fixtures",
|
|
26
45
|
"storybook:jslayout": "start-storybook -c test/fixtures/jsLayoutStorybookLocal -p 9001 -s test/fixtures",
|
|
46
|
+
"storybook:csf": "yarn storybook:csf-service && start-storybook -c test/fixtures/storybookCSF/.storybook-temp -p 9001",
|
|
47
|
+
"storybook:csf-service": "cp -r test/fixtures/storybookCSF/.storybook/. test/fixtures/storybookCSF/.storybook-temp && rm test/fixtures/storybookCSF/.storybook-temp/config.js",
|
|
27
48
|
"storybook:heavy": "start-storybook -c test/fixtures/heavyStorybook -p 9002 -s test/fixtures",
|
|
28
49
|
"storybook:zeroStories": "start-storybook -c test/fixtures/zeroStoriesRetry -p 9003 -s test/fixtures",
|
|
29
50
|
"eyes-storybook": "node bin/eyes-storybook.js -f test/fixtures/applitools.config.js",
|
|
@@ -35,39 +56,28 @@
|
|
|
35
56
|
"changelog:init": "git config changelog.format \"* %s [[%h]($(echo $npm_package_repository_url|cut -d+ -f2|cut -d. -f1-2)/commit/%H)]\"",
|
|
36
57
|
"changelog:install": "sudo apt-get install git-extras",
|
|
37
58
|
"gh:publish": "gh workflow run publish-storybook.yml --ref $(git rev-parse --abbrev-ref HEAD)",
|
|
59
|
+
"prepublish:setup": "echo 'setup is a no-op. Move along, nothing to see here.'",
|
|
60
|
+
"deps": "bongo deps",
|
|
38
61
|
"postinstall": "node src/postinstall",
|
|
39
62
|
"preversion": "bongo preversion --verifyPendingChanges",
|
|
40
63
|
"version": "bongo version --withPendingChanges",
|
|
41
|
-
"postversion": "bongo postversion --skip-release-notification"
|
|
42
|
-
"deps": "bongo deps",
|
|
43
|
-
"prepublish:setup": "echo 'setup is a no-op. Move along, nothing to see here.'"
|
|
64
|
+
"postversion": "bongo postversion --skip-release-notification"
|
|
44
65
|
},
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"grid",
|
|
50
|
-
"visual-testing",
|
|
51
|
-
"nodejs",
|
|
52
|
-
"javascript"
|
|
53
|
-
],
|
|
54
|
-
"author": "Applitools Team <team@applitools.com>",
|
|
55
|
-
"license": "SEE LICENSE IN LICENSE",
|
|
56
|
-
"repository": {
|
|
57
|
-
"type": "git",
|
|
58
|
-
"url": "git://github.com/applitools/eyes.sdk.javascript1.git",
|
|
59
|
-
"directory": "packages/eyes-storybook"
|
|
66
|
+
"husky": {
|
|
67
|
+
"hooks": {
|
|
68
|
+
"pre-push": "yarn bongo lint"
|
|
69
|
+
}
|
|
60
70
|
},
|
|
61
71
|
"dependencies": {
|
|
62
|
-
"@applitools/driver": "1.
|
|
63
|
-
"@applitools/eyes-sdk-core": "13.
|
|
72
|
+
"@applitools/driver": "1.9.3",
|
|
73
|
+
"@applitools/eyes-sdk-core": "13.8.1",
|
|
64
74
|
"@applitools/functional-commons": "1.6.0",
|
|
65
|
-
"@applitools/logger": "1.
|
|
75
|
+
"@applitools/logger": "1.1.11",
|
|
66
76
|
"@applitools/monitoring-commons": "1.0.19",
|
|
67
|
-
"@applitools/spec-driver-puppeteer": "1.1.
|
|
68
|
-
"@applitools/test-server": "1.0.
|
|
69
|
-
"@applitools/utils": "1.
|
|
70
|
-
"@applitools/visual-grid-client": "15.
|
|
77
|
+
"@applitools/spec-driver-puppeteer": "1.1.5",
|
|
78
|
+
"@applitools/test-server": "1.0.11",
|
|
79
|
+
"@applitools/utils": "1.3.7",
|
|
80
|
+
"@applitools/visual-grid-client": "15.12.44",
|
|
71
81
|
"boxen": "4.2.0",
|
|
72
82
|
"chalk": "3.0.0",
|
|
73
83
|
"detect-port": "1.3.0",
|
|
@@ -79,11 +89,13 @@
|
|
|
79
89
|
"yargs": "15.4.1"
|
|
80
90
|
},
|
|
81
91
|
"devDependencies": {
|
|
82
|
-
"@applitools/bongo": "^2.
|
|
92
|
+
"@applitools/bongo": "^2.1.5",
|
|
83
93
|
"@applitools/scripts": "^1.1.0",
|
|
84
94
|
"@applitools/sdk-shared": "0.9.11",
|
|
85
95
|
"@applitools/snaptdout": "^1.0.1",
|
|
86
|
-
"@storybook/
|
|
96
|
+
"@storybook/addon-interactions": "^6.4.18",
|
|
97
|
+
"@storybook/react": "^6.4.18",
|
|
98
|
+
"@storybook/testing-library": "^0.0.9",
|
|
87
99
|
"@testing-library/dom": "^5.6.1",
|
|
88
100
|
"babel-core": "^6.26.3",
|
|
89
101
|
"babel-loader": "^8.0.6",
|
|
@@ -108,9 +120,7 @@
|
|
|
108
120
|
"rollup-plugin-commonjs": "^10.1.0",
|
|
109
121
|
"ua-parser-js": "^0.7.21"
|
|
110
122
|
},
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"pre-push": "yarn bongo lint"
|
|
114
|
-
}
|
|
123
|
+
"engines": {
|
|
124
|
+
"node": ">=12.13.0"
|
|
115
125
|
}
|
|
116
126
|
}
|
|
@@ -35,7 +35,15 @@ function getClientAPI() {
|
|
|
35
35
|
throw new Error("Cannot get client API: couldn't detect storybook version");
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
function onStoryRendered(callback) {
|
|
39
|
+
if (addons && addons.channel && addons.channel.once) {
|
|
40
|
+
addons.channel.once('storyRendered', () => {
|
|
41
|
+
setTimeout(callback, 0);
|
|
42
|
+
});
|
|
43
|
+
} else {
|
|
44
|
+
callback();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
39
47
|
function getAPI(version) {
|
|
40
48
|
if (version) {
|
|
41
49
|
let api;
|
|
@@ -54,6 +62,7 @@ function getClientAPI() {
|
|
|
54
62
|
const {kind, name: story} = api.getStories()[i];
|
|
55
63
|
addons.channel._listeners.setCurrentStory[0]({kind, story});
|
|
56
64
|
},
|
|
65
|
+
onStoryRendered,
|
|
57
66
|
};
|
|
58
67
|
break;
|
|
59
68
|
}
|
|
@@ -66,6 +75,7 @@ function getClientAPI() {
|
|
|
66
75
|
selectStory: i => {
|
|
67
76
|
clientAPI._storyStore.setSelection(clientAPI.raw()[i]);
|
|
68
77
|
},
|
|
78
|
+
onStoryRendered,
|
|
69
79
|
};
|
|
70
80
|
break;
|
|
71
81
|
}
|
|
@@ -78,6 +88,7 @@ function getClientAPI() {
|
|
|
78
88
|
selectStory: i => {
|
|
79
89
|
frameWindow.__STORYBOOK_STORY_STORE__.setSelection({storyId: clientAPI.raw()[i].id});
|
|
80
90
|
},
|
|
91
|
+
onStoryRendered,
|
|
81
92
|
};
|
|
82
93
|
break;
|
|
83
94
|
}
|
|
@@ -93,6 +104,7 @@ function getClientAPI() {
|
|
|
93
104
|
});
|
|
94
105
|
await frameWindow.__STORYBOOK_PREVIEW__.renderSelection();
|
|
95
106
|
},
|
|
107
|
+
onStoryRendered,
|
|
96
108
|
};
|
|
97
109
|
break;
|
|
98
110
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
const getClientAPI = require('./getClientAPI');
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
function renderStoryWithClientAPI(index) {
|
|
4
|
+
return new Promise(resolve => {
|
|
5
|
+
let api;
|
|
6
|
+
try {
|
|
7
|
+
api = getClientAPI();
|
|
8
|
+
api.selectStory(index);
|
|
9
|
+
api.onStoryRendered(resolve);
|
|
10
|
+
} catch (ex) {
|
|
11
|
+
resolve({message: ex.message, version: api ? api.version : undefined});
|
|
12
|
+
}
|
|
13
|
+
});
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
module.exports = renderStoryWithClientAPI;
|
package/src/cli.js
CHANGED
|
@@ -15,7 +15,7 @@ const handleJsonFile = require('./handleJsonFile');
|
|
|
15
15
|
const handleTapFile = require('./handleTapFile');
|
|
16
16
|
const handleXmlFile = require('./handleXmlFile');
|
|
17
17
|
const {presult} = require('@applitools/functional-commons');
|
|
18
|
-
const chalk = require('
|
|
18
|
+
const chalk = require('chalk');
|
|
19
19
|
const {performance, timeItAsync} = makeTiming();
|
|
20
20
|
|
|
21
21
|
(async function() {
|
package/src/concurrencyMsg.js
CHANGED
package/src/errMessages.js
CHANGED
package/src/eyesStorybook.js
CHANGED
|
@@ -3,7 +3,7 @@ const puppeteer = require('puppeteer');
|
|
|
3
3
|
const getStories = require('../dist/getStories');
|
|
4
4
|
const {makeVisualGridClient} = require('@applitools/visual-grid-client');
|
|
5
5
|
const {presult, delay} = require('@applitools/functional-commons');
|
|
6
|
-
const chalk = require('
|
|
6
|
+
const chalk = require('chalk');
|
|
7
7
|
const makeInitPage = require('./initPage');
|
|
8
8
|
const makeRenderStory = require('./renderStory');
|
|
9
9
|
const makeRenderStories = require('./renderStories');
|
|
@@ -65,7 +65,7 @@ async function eyesStorybook({
|
|
|
65
65
|
} = makeVisualGridClient({
|
|
66
66
|
userAgent,
|
|
67
67
|
...config,
|
|
68
|
-
logger: logger.extend('vgc'),
|
|
68
|
+
logger: logger.extend({label: 'vgc'}),
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
const initPage = makeInitPage({
|
|
@@ -130,7 +130,7 @@ async function eyesStorybook({
|
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
const renderStory = makeRenderStory({
|
|
133
|
-
logger: logger.extend('renderStory'),
|
|
133
|
+
logger: logger.extend({label: 'renderStory'}),
|
|
134
134
|
testWindow,
|
|
135
135
|
performance,
|
|
136
136
|
timeItAsync,
|
package/src/generateConfig.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
const pick = require('lodash.pick');
|
|
3
|
-
const
|
|
3
|
+
const utils = require('@applitools/utils');
|
|
4
|
+
const {GeneralUtils} = require('@applitools/eyes-sdk-core');
|
|
4
5
|
const {resolve} = require('path');
|
|
5
6
|
const {deprecationWarning} = GeneralUtils;
|
|
6
7
|
const uniq = require('./uniq');
|
|
7
8
|
|
|
8
9
|
function generateConfig({argv = {}, defaultConfig = {}, externalConfigParams = []}) {
|
|
9
|
-
const configPath = argv.conf ? resolve(process.cwd(), argv.conf) : undefined;
|
|
10
10
|
const defaultConfigParams = Object.keys(defaultConfig);
|
|
11
|
+
const configPaths = argv.conf ? [resolve(process.cwd(), argv.conf)] : undefined;
|
|
11
12
|
const configParams = uniq(defaultConfigParams.concat(externalConfigParams));
|
|
12
|
-
const config =
|
|
13
|
+
const config = utils.config.getConfig({paths: configPaths, params: configParams});
|
|
13
14
|
const argvConfig = pick(argv, configParams);
|
|
14
15
|
const result = Object.assign({}, defaultConfig, config, argvConfig);
|
|
15
16
|
|
package/src/getStoryData.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
const {presult} = require('@applitools/functional-commons');
|
|
2
|
+
const {presult, ptimeoutWithError} = require('@applitools/functional-commons');
|
|
3
3
|
const {ArgumentGuard} = require('@applitools/eyes-sdk-core');
|
|
4
4
|
const renderStoryWithClientAPI = require('../dist/renderStoryWithClientAPI');
|
|
5
5
|
const runRunBeforeScript = require('../dist/runRunBeforeScript');
|
|
@@ -7,6 +7,7 @@ const getStoryBaselineName = require('./getStoryBaselineName');
|
|
|
7
7
|
const {URL} = require('url');
|
|
8
8
|
const runRunAfterScript = require('../dist/runRunAfterScript');
|
|
9
9
|
const waitFor = require('./waitFor');
|
|
10
|
+
const PAGE_EVALUATE_TIMEOUT = 120000;
|
|
10
11
|
|
|
11
12
|
function makeGetStoryData({logger, takeDomSnapshots, waitBeforeCapture, reloadPagePerStory}) {
|
|
12
13
|
return async function getStoryData({story, storyUrl, page, browser, waitBeforeStory}) {
|
|
@@ -18,8 +19,21 @@ function makeGetStoryData({logger, takeDomSnapshots, waitBeforeCapture, reloadPa
|
|
|
18
19
|
const currentUrl = page.url();
|
|
19
20
|
const expectedQueryParams = eyesParameters ? eyesParameters.queryParams : undefined;
|
|
20
21
|
if (urlQueryParamsEquals(currentUrl, expectedQueryParams)) {
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
try {
|
|
23
|
+
const err = await ptimeoutWithError(
|
|
24
|
+
page.evaluate(renderStoryWithClientAPI, story.index),
|
|
25
|
+
PAGE_EVALUATE_TIMEOUT,
|
|
26
|
+
'page evaluate timed out!',
|
|
27
|
+
);
|
|
28
|
+
logger.log(`[story data] done with page evaluate for story index: ${story.index}`);
|
|
29
|
+
err && handleRenderStoryError(err);
|
|
30
|
+
} catch (ex) {
|
|
31
|
+
if (!ex.message.includes('Eyes could not render stories properly'))
|
|
32
|
+
handleRenderStoryError(ex);
|
|
33
|
+
else {
|
|
34
|
+
throw ex;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
23
37
|
} else {
|
|
24
38
|
await renderStoryLegacy();
|
|
25
39
|
}
|
package/src/postinstall.js
CHANGED
package/src/processResults.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
const flatten = require('lodash.flatten');
|
|
3
|
-
const chalk = require('
|
|
3
|
+
const chalk = require('chalk');
|
|
4
4
|
const {TestResultsError, TestResultsFormatter} = require('@applitools/eyes-sdk-core');
|
|
5
5
|
const utils = require('@applitools/utils');
|
|
6
6
|
const uniq = require('./uniq');
|
package/src/renderStory.js
CHANGED
|
@@ -5,7 +5,7 @@ const {deprecationWarning} = require('@applitools/eyes-sdk-core').GeneralUtils;
|
|
|
5
5
|
|
|
6
6
|
function makeRenderStory({logger, testWindow, performance, timeItAsync}) {
|
|
7
7
|
return function renderStory({config, story, snapshot, url}) {
|
|
8
|
-
const {name, kind, parameters} = story;
|
|
8
|
+
const {name, kind, parameters, hasPlayFunction} = story;
|
|
9
9
|
const baselineName = getStoryBaselineName({name, kind, parameters});
|
|
10
10
|
const title = getStoryTitle({name, kind, parameters});
|
|
11
11
|
const eyesParameters = (parameters && parameters.eyes) || {};
|
|
@@ -55,6 +55,9 @@ function makeRenderStory({logger, testWindow, performance, timeItAsync}) {
|
|
|
55
55
|
{name: 'State', value: name},
|
|
56
56
|
...(properties || []),
|
|
57
57
|
];
|
|
58
|
+
if (hasPlayFunction) {
|
|
59
|
+
storyProperties.push({name: 'Storybook play function', value: 'true'});
|
|
60
|
+
}
|
|
58
61
|
|
|
59
62
|
const openParams = {
|
|
60
63
|
testName: baselineName,
|
package/src/shouldRenderIE.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const {BrowserType} = require('@applitools/eyes-sdk-core');
|
|
2
|
-
|
|
3
1
|
function splitConfigsByBrowser(config) {
|
|
4
2
|
const browsers = validateBrowsers(config);
|
|
5
3
|
if (browsers.length) {
|
|
@@ -33,7 +31,7 @@ function hasIE(config) {
|
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
function isIE(browser) {
|
|
36
|
-
return browser.name ===
|
|
34
|
+
return browser.name === 'ie' || browser.name === 'ie11';
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
function validateBrowsers(config) {
|
package/src/chalkify.js
DELETED