@applitools/eyes-storybook 3.33.1 → 3.34.0
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 +6 -0
- package/package.json +5 -5
- package/src/eyesStorybook.js +8 -2
- package/src/getStoriesWithConfig.js +14 -5
- package/src/getStoryData.js +6 -12
- package/src/renderStories.js +1 -7
- package/src/renderStory.js +1 -7
- package/src/utils/prepare-settings.js +4 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/eyes-storybook",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.34.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -73,14 +73,14 @@
|
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@applitools/core": "2.5.
|
|
77
|
-
"@applitools/driver": "1.11.
|
|
76
|
+
"@applitools/core": "2.5.10",
|
|
77
|
+
"@applitools/driver": "1.11.49",
|
|
78
78
|
"@applitools/functional-commons": "1.6.0",
|
|
79
79
|
"@applitools/logger": "1.1.52",
|
|
80
80
|
"@applitools/monitoring-commons": "1.0.19",
|
|
81
|
-
"@applitools/spec-driver-puppeteer": "1.1.
|
|
81
|
+
"@applitools/spec-driver-puppeteer": "1.1.60",
|
|
82
82
|
"@applitools/test-server": "1.1.31",
|
|
83
|
-
"@applitools/ufg-client": "1.2.
|
|
83
|
+
"@applitools/ufg-client": "1.2.12",
|
|
84
84
|
"@applitools/utils": "1.3.35",
|
|
85
85
|
"boxen": "4.2.0",
|
|
86
86
|
"chalk": "3.0.0",
|
package/src/eyesStorybook.js
CHANGED
|
@@ -112,7 +112,13 @@ async function eyesStorybook({
|
|
|
112
112
|
});
|
|
113
113
|
const pagePool = createPagePool({initPage, logger});
|
|
114
114
|
|
|
115
|
-
const doTakeDomSnapshots = async ({
|
|
115
|
+
const doTakeDomSnapshots = async ({
|
|
116
|
+
page,
|
|
117
|
+
renderers,
|
|
118
|
+
layoutBreakpoints,
|
|
119
|
+
waitBeforeCapture,
|
|
120
|
+
disableBrowserFetching,
|
|
121
|
+
}) => {
|
|
116
122
|
const driver = await new Driver({spec, driver: page, logger});
|
|
117
123
|
const skipResources = client.getCachedResourceUrls();
|
|
118
124
|
const result = await takeDomSnapshots({
|
|
@@ -125,6 +131,7 @@ async function eyesStorybook({
|
|
|
125
131
|
renderers,
|
|
126
132
|
waitBeforeCapture,
|
|
127
133
|
skipResources,
|
|
134
|
+
disableBrowserFetching,
|
|
128
135
|
},
|
|
129
136
|
}),
|
|
130
137
|
provides: {
|
|
@@ -175,7 +182,6 @@ async function eyesStorybook({
|
|
|
175
182
|
const getStoryData = makeGetStoryData({
|
|
176
183
|
logger,
|
|
177
184
|
takeDomSnapshots: doTakeDomSnapshots,
|
|
178
|
-
waitBeforeCapture,
|
|
179
185
|
});
|
|
180
186
|
const closeSettings = {
|
|
181
187
|
...settings,
|
|
@@ -13,7 +13,7 @@ function makeGetStoriesWithConfig({config}) {
|
|
|
13
13
|
return function getStoriesWithConfig({stories, logger = console}) {
|
|
14
14
|
const storiesWithTitle = addStoryTitleAndBaselineName(stories);
|
|
15
15
|
if (!config.storyConfiguration) {
|
|
16
|
-
addConfigToStories({config, stories: storiesWithTitle});
|
|
16
|
+
addConfigToStories({config, stories: storiesWithTitle, isStoryConfig: false});
|
|
17
17
|
} else {
|
|
18
18
|
const storyConfigurations = Array.isArray(config.storyConfiguration)
|
|
19
19
|
? config.storyConfiguration
|
|
@@ -37,6 +37,7 @@ function makeGetStoriesWithConfig({config}) {
|
|
|
37
37
|
addConfigToStories({
|
|
38
38
|
config: transformBrowser(allowedProps(storyConfig)),
|
|
39
39
|
stories: storiesSubset,
|
|
40
|
+
isStoryConfig: true,
|
|
40
41
|
});
|
|
41
42
|
|
|
42
43
|
remainingStories = remainingStories.filter(story => !storiesSubset.includes(story));
|
|
@@ -44,7 +45,7 @@ function makeGetStoriesWithConfig({config}) {
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
if (remainingStories.length) {
|
|
47
|
-
addConfigToStories({config: basicConfig, stories: remainingStories});
|
|
48
|
+
addConfigToStories({config: basicConfig, stories: remainingStories, isStoryConfig: true});
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
return {
|
|
@@ -53,20 +54,21 @@ function makeGetStoriesWithConfig({config}) {
|
|
|
53
54
|
};
|
|
54
55
|
};
|
|
55
56
|
|
|
56
|
-
function addConfigToStories({config, stories}) {
|
|
57
|
+
function addConfigToStories({config, stories, isStoryConfig}) {
|
|
57
58
|
const configs = config.fakeIE ? splitConfigsByBrowser(config) : [config];
|
|
58
59
|
for (const config of configs) {
|
|
59
60
|
for (const story of stories) {
|
|
60
|
-
|
|
61
|
+
addConfigToStory({
|
|
61
62
|
story,
|
|
62
63
|
config,
|
|
63
64
|
isIE: shouldRenderIE(config),
|
|
65
|
+
isStoryConfig,
|
|
64
66
|
});
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
|
|
69
|
-
function
|
|
71
|
+
function addConfigToStory({story, config, isIE, isStoryConfig}) {
|
|
70
72
|
const storiesToUpdate = isIE ? storiesWithConfigIE : storiesWithConfig;
|
|
71
73
|
storiesToUpdate.set(story.baselineName, {
|
|
72
74
|
...story,
|
|
@@ -74,6 +76,13 @@ function makeGetStoriesWithConfig({config}) {
|
|
|
74
76
|
...basicConfig,
|
|
75
77
|
...storiesToUpdate.get(story.baselineName)?.config,
|
|
76
78
|
...config,
|
|
79
|
+
...transformBrowser({...story.parameters?.eyes}),
|
|
80
|
+
properties: [
|
|
81
|
+
...(isStoryConfig ? basicConfig.properties || [] : []),
|
|
82
|
+
...(storiesToUpdate.get(story.baselineName)?.config.properties || []),
|
|
83
|
+
...(config.properties || []),
|
|
84
|
+
...(story.parameters?.eyes?.properties || []),
|
|
85
|
+
],
|
|
77
86
|
},
|
|
78
87
|
});
|
|
79
88
|
}
|
package/src/getStoryData.js
CHANGED
|
@@ -10,15 +10,8 @@ const PAGE_EVALUATE_TIMEOUT = 120000;
|
|
|
10
10
|
const DOM_SNAPSHOTS_TIMEOUT = 5 * 60 * 1000;
|
|
11
11
|
const utils = require('@applitools/utils');
|
|
12
12
|
|
|
13
|
-
function makeGetStoryData({logger, takeDomSnapshots,
|
|
14
|
-
return async function getStoryData({
|
|
15
|
-
story,
|
|
16
|
-
storyUrl,
|
|
17
|
-
page,
|
|
18
|
-
renderers,
|
|
19
|
-
waitBeforeStory,
|
|
20
|
-
layoutBreakpoints,
|
|
21
|
-
}) {
|
|
13
|
+
function makeGetStoryData({logger, takeDomSnapshots, reloadPagePerStory}) {
|
|
14
|
+
return async function getStoryData({story, storyUrl, page}) {
|
|
22
15
|
const title = getStoryBaselineName(story);
|
|
23
16
|
logger.log(`getting data from story`, title);
|
|
24
17
|
|
|
@@ -50,7 +43,7 @@ function makeGetStoryData({logger, takeDomSnapshots, waitBeforeCapture, reloadPa
|
|
|
50
43
|
await renderStoryLegacy();
|
|
51
44
|
}
|
|
52
45
|
|
|
53
|
-
const wait =
|
|
46
|
+
const wait = story.config.waitBeforeCapture;
|
|
54
47
|
if (typeof wait === 'number') {
|
|
55
48
|
utils.guard.isGreaterThenOrEqual(wait, 0, {name: 'waitBeforeCapture'});
|
|
56
49
|
}
|
|
@@ -64,14 +57,15 @@ function makeGetStoryData({logger, takeDomSnapshots, waitBeforeCapture, reloadPa
|
|
|
64
57
|
logger.log(`running takeDomSnapshot(s) for story ${title}`);
|
|
65
58
|
const domSnapshotsPromise = takeDomSnapshots({
|
|
66
59
|
page,
|
|
67
|
-
renderers,
|
|
68
|
-
layoutBreakpoints:
|
|
60
|
+
renderers: story.config.renderers,
|
|
61
|
+
layoutBreakpoints: story.config.layoutBreakpoints,
|
|
69
62
|
waitBeforeCapture: wait
|
|
70
63
|
? async () => {
|
|
71
64
|
logger.log(`waiting before screenshot of ${title} ${wait}`);
|
|
72
65
|
await waitFor(page, wait);
|
|
73
66
|
}
|
|
74
67
|
: undefined,
|
|
68
|
+
disableBrowserFetching: story.config.disableBrowserFetching,
|
|
75
69
|
});
|
|
76
70
|
|
|
77
71
|
const result = await ptimeoutWithError(
|
package/src/renderStories.js
CHANGED
|
@@ -58,17 +58,12 @@ function makeRenderStories({
|
|
|
58
58
|
const story = stories[currIndex++];
|
|
59
59
|
const storyUrl = getStoryUrl(story, storybookUrl);
|
|
60
60
|
const title = getStoryBaselineName(story);
|
|
61
|
-
const {waitBeforeCapture} = (story.parameters && story.parameters.eyes) || {};
|
|
62
|
-
|
|
63
61
|
try {
|
|
64
62
|
let [error, storyData] = await presult(
|
|
65
63
|
getStoryData({
|
|
66
64
|
story,
|
|
67
65
|
storyUrl,
|
|
68
|
-
renderers: story.config.renderers,
|
|
69
66
|
page,
|
|
70
|
-
layoutBreakpoints: story.config.layoutBreakpoints,
|
|
71
|
-
waitBeforeStory: waitBeforeCapture || story.config.waitBeforeCapture,
|
|
72
67
|
}),
|
|
73
68
|
);
|
|
74
69
|
|
|
@@ -92,9 +87,7 @@ function makeRenderStories({
|
|
|
92
87
|
getStoryData({
|
|
93
88
|
story,
|
|
94
89
|
storyUrl,
|
|
95
|
-
renderers: story.config.renderers,
|
|
96
90
|
page: newPageObj.page,
|
|
97
|
-
waitBeforeStory: waitBeforeCapture,
|
|
98
91
|
}),
|
|
99
92
|
);
|
|
100
93
|
error = newError;
|
|
@@ -116,6 +109,7 @@ function makeRenderStories({
|
|
|
116
109
|
});
|
|
117
110
|
return onDoneStory(testResults, story);
|
|
118
111
|
} catch (ex) {
|
|
112
|
+
logger.log(`[page ${pageId}] error while processing story "${title}". ${ex}`);
|
|
119
113
|
return onDoneStory(ex, story);
|
|
120
114
|
}
|
|
121
115
|
}
|
package/src/renderStory.js
CHANGED
|
@@ -18,12 +18,6 @@ function makeRenderStory({
|
|
|
18
18
|
const {name, kind, parameters, hasPlayFunction} = story;
|
|
19
19
|
const baselineName = story.baselineName;
|
|
20
20
|
const title = story.storyTitle;
|
|
21
|
-
const eyesParameters = (parameters && parameters.eyes) || {};
|
|
22
|
-
const eyesOptions = {
|
|
23
|
-
...config,
|
|
24
|
-
...eyesParameters,
|
|
25
|
-
properties: [...(config.properties || []), ...(eyesParameters.properties || [])],
|
|
26
|
-
};
|
|
27
21
|
const {
|
|
28
22
|
ignoreDisplacements,
|
|
29
23
|
ignoreRegions,
|
|
@@ -58,7 +52,7 @@ function makeRenderStory({
|
|
|
58
52
|
ignoreCaret,
|
|
59
53
|
matchLevel,
|
|
60
54
|
ignoreBaseline,
|
|
61
|
-
} =
|
|
55
|
+
} = config;
|
|
62
56
|
|
|
63
57
|
if (sizeMode) {
|
|
64
58
|
console.log(deprecationWarning({deprecatedThing: "'sizeMode'", newThing: "'target'"}));
|
|
@@ -2,7 +2,10 @@ function prepareTakeDomSnapshotsSettings({config, options}) {
|
|
|
2
2
|
let result = {...options};
|
|
3
3
|
result.layoutBreakpoints =
|
|
4
4
|
result.layoutBreakpoints !== undefined ? result.layoutBreakpoints : config.layoutBreakpoints;
|
|
5
|
-
result.disableBrowserFetching =
|
|
5
|
+
result.disableBrowserFetching =
|
|
6
|
+
result.disableBrowserFetching !== undefined
|
|
7
|
+
? result.disableBrowserFetching
|
|
8
|
+
: config.disableBrowserFetching;
|
|
6
9
|
return result;
|
|
7
10
|
}
|
|
8
11
|
|