@applitools/eyes-storybook 3.34.0 → 3.34.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 +12 -0
- package/package.json +8 -8
- package/src/eyesStorybook.js +18 -14
- package/src/generateConfig.js +17 -2
- package/src/getStoriesWithConfig.js +8 -3
- package/src/initPage.js +8 -1
- package/src/renderStory.js +1 -1
- package/src/startStorybookServer.js +16 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
## 3.34.2 - 2023/5/16
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
- Add support for reloading the page when using layoutBreakpoints
|
|
10
|
+
### Bug fixes
|
|
11
|
+
|
|
12
|
+
## 3.34.1 - 2023/5/9
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
### Bug fixes
|
|
16
|
+
- Fix the issue where storybook v6 will not start if storybook cli is being used
|
|
17
|
+
|
|
6
18
|
## 3.34.0 - 2023/5/4
|
|
7
19
|
|
|
8
20
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/eyes-storybook",
|
|
3
|
-
"version": "3.34.
|
|
3
|
+
"version": "3.34.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@applitools/core": "
|
|
77
|
-
"@applitools/driver": "1.11.
|
|
76
|
+
"@applitools/core": "3.0.1",
|
|
77
|
+
"@applitools/driver": "1.11.51",
|
|
78
78
|
"@applitools/functional-commons": "1.6.0",
|
|
79
|
-
"@applitools/logger": "
|
|
79
|
+
"@applitools/logger": "2.0.0",
|
|
80
80
|
"@applitools/monitoring-commons": "1.0.19",
|
|
81
|
-
"@applitools/spec-driver-puppeteer": "1.1.
|
|
82
|
-
"@applitools/test-server": "1.
|
|
83
|
-
"@applitools/ufg-client": "1.2.
|
|
84
|
-
"@applitools/utils": "1.3.
|
|
81
|
+
"@applitools/spec-driver-puppeteer": "1.1.62",
|
|
82
|
+
"@applitools/test-server": "1.2.0",
|
|
83
|
+
"@applitools/ufg-client": "1.2.13",
|
|
84
|
+
"@applitools/utils": "1.3.36",
|
|
85
85
|
"boxen": "4.2.0",
|
|
86
86
|
"chalk": "3.0.0",
|
|
87
87
|
"detect-port": "1.3.0",
|
package/src/eyesStorybook.js
CHANGED
|
@@ -25,7 +25,6 @@ const {makeCore} = require('@applitools/core');
|
|
|
25
25
|
const {makeUFGClient} = require('@applitools/ufg-client');
|
|
26
26
|
const makeGetStoriesWithConfig = require('./getStoriesWithConfig');
|
|
27
27
|
|
|
28
|
-
const CONCURRENT_PAGES = 3;
|
|
29
28
|
const MAX_RETRIES = 10;
|
|
30
29
|
const RETRY_INTERVAL = 1000;
|
|
31
30
|
|
|
@@ -42,14 +41,12 @@ async function eyesStorybook({
|
|
|
42
41
|
takeMemLoop();
|
|
43
42
|
logger.log('eyesStorybook started');
|
|
44
43
|
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
testConcurrency,
|
|
52
|
-
} = config;
|
|
44
|
+
const CONCURRENT_TABS = isNaN(Number(process.env.APPLITOOLS_CONCURRENT_TABS))
|
|
45
|
+
? 3
|
|
46
|
+
: Number(process.env.APPLITOOLS_CONCURRENT_TABS);
|
|
47
|
+
logger.log(`Running with ${CONCURRENT_TABS} concurrent tabs`);
|
|
48
|
+
|
|
49
|
+
const {storybookUrl, readStoriesTimeout, reloadPagePerStory, proxy, testConcurrency} = config;
|
|
53
50
|
|
|
54
51
|
let iframeUrl;
|
|
55
52
|
try {
|
|
@@ -151,14 +148,21 @@ async function eyesStorybook({
|
|
|
151
148
|
},
|
|
152
149
|
});
|
|
153
150
|
try {
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
151
|
+
const stories = await getStoriesWithSpinner();
|
|
152
|
+
|
|
153
|
+
if (CONCURRENT_TABS <= 3) {
|
|
154
|
+
await Promise.all(
|
|
155
|
+
new Array(CONCURRENT_TABS).fill().map(async () => {
|
|
157
156
|
const {pageId} = await pagePool.createPage();
|
|
158
157
|
pagePool.addToPool(pageId);
|
|
159
158
|
}),
|
|
160
|
-
)
|
|
161
|
-
|
|
159
|
+
);
|
|
160
|
+
} else {
|
|
161
|
+
for (const _x of new Array(CONCURRENT_TABS).fill()) {
|
|
162
|
+
const {pageId} = await pagePool.createPage();
|
|
163
|
+
pagePool.addToPool(pageId);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
162
166
|
|
|
163
167
|
const filteredStories = filterStories({stories, config});
|
|
164
168
|
const storiesIncludingVariations = addVariationStories({
|
package/src/generateConfig.js
CHANGED
|
@@ -77,7 +77,7 @@ function generateConfig({argv = {}, defaultConfig = {}, externalConfigParams = [
|
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
transformConfig(result);
|
|
81
81
|
if (!result.renderers) {
|
|
82
82
|
result.renderers = [{name: 'chrome', width: 1024, height: 768}];
|
|
83
83
|
}
|
|
@@ -85,6 +85,11 @@ function generateConfig({argv = {}, defaultConfig = {}, externalConfigParams = [
|
|
|
85
85
|
return result;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
function transformConfig(result) {
|
|
89
|
+
transformLayoutBreakpoints(result);
|
|
90
|
+
transformBrowser(result);
|
|
91
|
+
}
|
|
92
|
+
|
|
88
93
|
function transformBrowser(result) {
|
|
89
94
|
if (result.browser) {
|
|
90
95
|
result.renderers = [];
|
|
@@ -104,4 +109,14 @@ function transformBrowser(result) {
|
|
|
104
109
|
delete result.browser;
|
|
105
110
|
return result;
|
|
106
111
|
}
|
|
107
|
-
|
|
112
|
+
|
|
113
|
+
function transformLayoutBreakpoints(result) {
|
|
114
|
+
if (
|
|
115
|
+
utils.types.isBoolean(result.layoutBreakpoints) ||
|
|
116
|
+
utils.types.isArray(result.layoutBreakpoints)
|
|
117
|
+
) {
|
|
118
|
+
result.layoutBreakpoints = {breakpoints: result.layoutBreakpoints};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
module.exports = {generateConfig, transformConfig};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const {splitConfigsByBrowser, shouldRenderIE} = require('./shouldRenderIE');
|
|
2
2
|
const getStoryTitle = require('./getStoryTitle');
|
|
3
|
-
const {
|
|
3
|
+
const {transformConfig} = require('./generateConfig');
|
|
4
4
|
const {checkSettingsParams} = require('./checkSettingsParams');
|
|
5
5
|
const getStoryBaselineName = require('./getStoryBaselineName');
|
|
6
6
|
|
|
@@ -34,8 +34,11 @@ function makeGetStoriesWithConfig({config}) {
|
|
|
34
34
|
}
|
|
35
35
|
})
|
|
36
36
|
.filter(Boolean);
|
|
37
|
+
|
|
38
|
+
const storyConfigReduced = allowedProps(storyConfig);
|
|
39
|
+
transformConfig(storyConfigReduced);
|
|
37
40
|
addConfigToStories({
|
|
38
|
-
config:
|
|
41
|
+
config: storyConfigReduced,
|
|
39
42
|
stories: storiesSubset,
|
|
40
43
|
isStoryConfig: true,
|
|
41
44
|
});
|
|
@@ -70,13 +73,15 @@ function makeGetStoriesWithConfig({config}) {
|
|
|
70
73
|
|
|
71
74
|
function addConfigToStory({story, config, isIE, isStoryConfig}) {
|
|
72
75
|
const storiesToUpdate = isIE ? storiesWithConfigIE : storiesWithConfig;
|
|
76
|
+
const storyEyesParameters = {...story.parameters?.eyes};
|
|
77
|
+
transformConfig(storyEyesParameters);
|
|
73
78
|
storiesToUpdate.set(story.baselineName, {
|
|
74
79
|
...story,
|
|
75
80
|
config: {
|
|
76
81
|
...basicConfig,
|
|
77
82
|
...storiesToUpdate.get(story.baselineName)?.config,
|
|
78
83
|
...config,
|
|
79
|
-
...
|
|
84
|
+
...storyEyesParameters,
|
|
80
85
|
properties: [
|
|
81
86
|
...(isStoryConfig ? basicConfig.properties || [] : []),
|
|
82
87
|
...(storiesToUpdate.get(story.baselineName)?.config.properties || []),
|
package/src/initPage.js
CHANGED
|
@@ -3,9 +3,16 @@ const browserLog = require('./browserLog');
|
|
|
3
3
|
const fakeIE = require('./fakeIE');
|
|
4
4
|
|
|
5
5
|
function makeInitPage({iframeUrl, config, browser, logger, getTransitiongIntoIE, getRenderIE}) {
|
|
6
|
+
const browserContexts = [browser.defaultBrowserContext()];
|
|
7
|
+
|
|
6
8
|
return async function initPage({pageId, pagePool}) {
|
|
7
9
|
logger.log('initializing puppeteer page number ', pageId);
|
|
8
|
-
const
|
|
10
|
+
const pages = await browserContexts[browserContexts.length - 1].pages();
|
|
11
|
+
if (pages.length === 5) {
|
|
12
|
+
const browserContext = await browser.createIncognitoBrowserContext();
|
|
13
|
+
browserContexts.push(browserContext);
|
|
14
|
+
}
|
|
15
|
+
const page = await browserContexts[browserContexts.length - 1].newPage();
|
|
9
16
|
|
|
10
17
|
if (config.viewportSize) {
|
|
11
18
|
await page.setViewport(config.viewportSize);
|
package/src/renderStory.js
CHANGED
|
@@ -15,7 +15,7 @@ function makeRenderStory({
|
|
|
15
15
|
const throttle = throat(storyDataGap);
|
|
16
16
|
return function renderStory({story, snapshots, url}) {
|
|
17
17
|
const config = story.config;
|
|
18
|
-
const {name, kind,
|
|
18
|
+
const {name, kind, hasPlayFunction} = story;
|
|
19
19
|
const baselineName = story.baselineName;
|
|
20
20
|
const title = story.storyTitle;
|
|
21
21
|
const {
|
|
@@ -3,6 +3,11 @@ const {resolve} = require('path');
|
|
|
3
3
|
const ora = require('ora');
|
|
4
4
|
const StorybookConnector = require('./storybookConnector');
|
|
5
5
|
const fs = require('fs');
|
|
6
|
+
const {exec} = require('child_process');
|
|
7
|
+
const {promisify: p} = require('util');
|
|
8
|
+
const pexec = p(exec);
|
|
9
|
+
// eslint-disable-next-line
|
|
10
|
+
const semver = require('semver');
|
|
6
11
|
|
|
7
12
|
async function startStorybookServer({
|
|
8
13
|
packagePath,
|
|
@@ -16,12 +21,18 @@ async function startStorybookServer({
|
|
|
16
21
|
}) {
|
|
17
22
|
const isWindows = process.platform.startsWith('win');
|
|
18
23
|
let storybookPath, sbArg;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
const storybookPathV6 = resolve(packagePath, 'node_modules/.bin/start-storybook');
|
|
25
|
+
const storybookPathV7 = resolve(packagePath, 'node_modules/.bin/sb');
|
|
26
|
+
if (fs.existsSync(storybookPathV7)) {
|
|
27
|
+
const version = await pexec(`${storybookPathV7} --version`);
|
|
28
|
+
if (semver.satisfies(version.stdout, '<7.0.0')) {
|
|
29
|
+
storybookPath = storybookPathV6;
|
|
30
|
+
} else {
|
|
31
|
+
storybookPath = storybookPathV7;
|
|
32
|
+
sbArg = 'dev';
|
|
33
|
+
}
|
|
23
34
|
} else {
|
|
24
|
-
storybookPath =
|
|
35
|
+
storybookPath = storybookPathV6;
|
|
25
36
|
}
|
|
26
37
|
|
|
27
38
|
const storybookConnector = new StorybookConnector({
|