@applitools/eyes-storybook 3.53.13 → 3.54.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 +91 -0
- package/package.json +10 -10
- package/src/defaultConfig.js +1 -0
- package/src/eyesStorybook.js +12 -12
- package/src/initPage.js +8 -12
- package/src/utils/determineStorybookVersion.js +1 -2
- package/src/utils/pageNetworkUtils.js +73 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,96 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.54.0](https://github.com/Applitools-Dev/sdk/compare/js/eyes-storybook@3.53.14...js/eyes-storybook@3.54.0) (2025-03-30)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* implement browser-side timeout for eyes storybook ([#2877](https://github.com/Applitools-Dev/sdk/issues/2877)) ([591d950](https://github.com/Applitools-Dev/sdk/commit/591d950154368cc64f93835586da1eef296e2d33))
|
|
9
|
+
|
|
10
|
+
## [3.53.14](https://github.com/Applitools-Dev/sdk/compare/js/eyes-storybook@3.53.13...js/eyes-storybook@3.53.14) (2025-03-30)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Dependencies
|
|
14
|
+
|
|
15
|
+
* @applitools/utils bumped to 1.8.0
|
|
16
|
+
#### Features
|
|
17
|
+
|
|
18
|
+
* allow sending callback functions to waitBeforeCapture ([#2780](https://github.com/Applitools-Dev/sdk/issues/2780)) ([4caa2e8](https://github.com/Applitools-Dev/sdk/commit/4caa2e8ae055d3dd48164eeceaa4c691eeadcdd4))
|
|
19
|
+
* @applitools/logger bumped to 2.1.2
|
|
20
|
+
|
|
21
|
+
* @applitools/dom-snapshot bumped to 4.11.17
|
|
22
|
+
#### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* input range value render issue - add input range to need map list ([#2866](https://github.com/Applitools-Dev/sdk/issues/2866)) ([6b3c113](https://github.com/Applitools-Dev/sdk/commit/6b3c113ab3068fc89b3d3917a12fc51bad66ca97))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
* @applitools/core-base bumped to 1.22.3
|
|
29
|
+
#### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* reject openCheckAndClose on request failures ([#2870](https://github.com/Applitools-Dev/sdk/issues/2870)) ([1d12d60](https://github.com/Applitools-Dev/sdk/commit/1d12d60991e8f222002273d5447702158f1cba84))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
* @applitools/eyes bumped to 1.33.0
|
|
36
|
+
#### Features
|
|
37
|
+
|
|
38
|
+
* allow fully to be sent from the configuration object ([#2867](https://github.com/Applitools-Dev/sdk/issues/2867)) ([e8e7fbc](https://github.com/Applitools-Dev/sdk/commit/e8e7fbcb545e9bab899691d8d136b69f4a67e0d8))
|
|
39
|
+
* allow sending callback functions to waitBeforeCapture ([#2780](https://github.com/Applitools-Dev/sdk/issues/2780)) ([4caa2e8](https://github.com/Applitools-Dev/sdk/commit/4caa2e8ae055d3dd48164eeceaa4c691eeadcdd4))
|
|
40
|
+
* offline results state granularity ([#2872](https://github.com/Applitools-Dev/sdk/issues/2872)) ([c5f6e4e](https://github.com/Applitools-Dev/sdk/commit/c5f6e4ed87c4855704ce1a6c568393a35b677c1d))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
* @applitools/req bumped to 1.7.9
|
|
45
|
+
|
|
46
|
+
* @applitools/image bumped to 1.1.18
|
|
47
|
+
|
|
48
|
+
* @applitools/driver bumped to 1.21.0
|
|
49
|
+
#### Features
|
|
50
|
+
|
|
51
|
+
* allow sending callback functions to waitBeforeCapture ([#2780](https://github.com/Applitools-Dev/sdk/issues/2780)) ([4caa2e8](https://github.com/Applitools-Dev/sdk/commit/4caa2e8ae055d3dd48164eeceaa4c691eeadcdd4))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
* @applitools/spec-driver-puppeteer bumped to 1.4.26
|
|
56
|
+
|
|
57
|
+
* @applitools/screenshoter bumped to 3.11.0
|
|
58
|
+
#### Features
|
|
59
|
+
|
|
60
|
+
* allow sending callback functions to waitBeforeCapture ([#2780](https://github.com/Applitools-Dev/sdk/issues/2780)) ([4caa2e8](https://github.com/Applitools-Dev/sdk/commit/4caa2e8ae055d3dd48164eeceaa4c691eeadcdd4))
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
* @applitools/socket bumped to 1.2.3
|
|
65
|
+
|
|
66
|
+
* @applitools/dom-capture bumped to 11.5.5
|
|
67
|
+
|
|
68
|
+
* @applitools/spec-driver-webdriver bumped to 1.2.1
|
|
69
|
+
|
|
70
|
+
* @applitools/spec-driver-selenium bumped to 1.5.97
|
|
71
|
+
|
|
72
|
+
* @applitools/nml-client bumped to 1.8.27
|
|
73
|
+
|
|
74
|
+
* @applitools/tunnel-client bumped to 1.6.4
|
|
75
|
+
|
|
76
|
+
* @applitools/ufg-client bumped to 1.16.8
|
|
77
|
+
|
|
78
|
+
* @applitools/ec-client bumped to 1.10.7
|
|
79
|
+
|
|
80
|
+
* @applitools/core bumped to 4.34.0
|
|
81
|
+
#### Features
|
|
82
|
+
|
|
83
|
+
* allow sending callback functions to waitBeforeCapture ([#2780](https://github.com/Applitools-Dev/sdk/issues/2780)) ([4caa2e8](https://github.com/Applitools-Dev/sdk/commit/4caa2e8ae055d3dd48164eeceaa4c691eeadcdd4))
|
|
84
|
+
* offline results state granularity ([#2872](https://github.com/Applitools-Dev/sdk/issues/2872)) ([c5f6e4e](https://github.com/Applitools-Dev/sdk/commit/c5f6e4ed87c4855704ce1a6c568393a35b677c1d))
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
#### Bug Fixes
|
|
88
|
+
|
|
89
|
+
* reject openCheckAndClose on request failures ([#2870](https://github.com/Applitools-Dev/sdk/issues/2870)) ([1d12d60](https://github.com/Applitools-Dev/sdk/commit/1d12d60991e8f222002273d5447702158f1cba84))
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
3
94
|
## [3.53.13](https://github.com/Applitools-Dev/sdk/compare/js/eyes-storybook@3.53.12...js/eyes-storybook@3.53.13) (2025-03-06)
|
|
4
95
|
|
|
5
96
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/eyes-storybook",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.54.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -53,15 +53,15 @@
|
|
|
53
53
|
"up:framework": "cd test/fixtures/storybook-versions/${APPLITOOLS_FRAMEWORK_VERSION} && npm ci"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@applitools/core": "4.
|
|
57
|
-
"@applitools/driver": "1.
|
|
58
|
-
"@applitools/eyes": "1.
|
|
56
|
+
"@applitools/core": "4.34.0",
|
|
57
|
+
"@applitools/driver": "1.21.0",
|
|
58
|
+
"@applitools/eyes": "1.33.0",
|
|
59
59
|
"@applitools/functional-commons": "1.6.0",
|
|
60
|
-
"@applitools/logger": "2.1.
|
|
60
|
+
"@applitools/logger": "2.1.2",
|
|
61
61
|
"@applitools/monitoring-commons": "1.0.19",
|
|
62
|
-
"@applitools/spec-driver-puppeteer": "1.4.
|
|
63
|
-
"@applitools/ufg-client": "1.16.
|
|
64
|
-
"@applitools/utils": "1.
|
|
62
|
+
"@applitools/spec-driver-puppeteer": "1.4.26",
|
|
63
|
+
"@applitools/ufg-client": "1.16.8",
|
|
64
|
+
"@applitools/utils": "1.8.0",
|
|
65
65
|
"boxen": "4.2.0",
|
|
66
66
|
"chalk": "3.0.0",
|
|
67
67
|
"detect-port": "1.3.0",
|
|
@@ -79,13 +79,13 @@
|
|
|
79
79
|
"@applitools/test-server": "^1.2.2",
|
|
80
80
|
"@applitools/test-utils": "^1.5.17",
|
|
81
81
|
"@storybook/addon-interactions": "^6.4.18",
|
|
82
|
-
"@storybook/react": "^6.
|
|
82
|
+
"@storybook/react": "^6.5.16",
|
|
83
83
|
"@storybook/testing-library": "^0.0.9",
|
|
84
84
|
"@testing-library/dom": "^5.6.1",
|
|
85
85
|
"bitmap-manipulation": "^2.0.0",
|
|
86
86
|
"chai": "^4.2.0",
|
|
87
87
|
"core-js": "^3.6.1",
|
|
88
|
-
"express": "^4.
|
|
88
|
+
"express": "^4.21.2",
|
|
89
89
|
"filenamify": "^4.1.0",
|
|
90
90
|
"node-fetch": "^2.6.0",
|
|
91
91
|
"react": "^16.12.0",
|
package/src/defaultConfig.js
CHANGED
package/src/eyesStorybook.js
CHANGED
|
@@ -23,6 +23,7 @@ const executeRenders = require('./executeRenders');
|
|
|
23
23
|
const {extractEnvironment} = require('./extractEnvironment');
|
|
24
24
|
const {makeCore} = require('@applitools/core');
|
|
25
25
|
const makeGetStoriesWithConfig = require('./getStoriesWithConfig');
|
|
26
|
+
const {makeNetworkUtils} = require('./utils/pageNetworkUtils');
|
|
26
27
|
|
|
27
28
|
async function eyesStorybook({
|
|
28
29
|
config,
|
|
@@ -55,22 +56,21 @@ async function eyesStorybook({
|
|
|
55
56
|
const browser = await puppeteer.launch(config.puppeteerOptions);
|
|
56
57
|
logger.log('browser launched');
|
|
57
58
|
const page = await browser.newPage();
|
|
59
|
+
|
|
60
|
+
const {startInterception} = makeNetworkUtils({
|
|
61
|
+
page,
|
|
62
|
+
logger,
|
|
63
|
+
});
|
|
58
64
|
// we send http headers here and in init page
|
|
59
65
|
if (config.puppeteerExtraHTTPHeaders) {
|
|
60
66
|
await page.setExtraHTTPHeaders(config.puppeteerExtraHTTPHeaders);
|
|
61
67
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
request.abort();
|
|
69
|
-
} else {
|
|
70
|
-
request.continue();
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
68
|
+
|
|
69
|
+
await startInterception({
|
|
70
|
+
timeout: config.browserRequestsTimeout,
|
|
71
|
+
blockPatterns: config.networkBlockPatterns,
|
|
72
|
+
});
|
|
73
|
+
|
|
74
74
|
const environment = extractEnvironment();
|
|
75
75
|
const core = await makeCore({spec, agentId, environment, logger});
|
|
76
76
|
const manager = await core.makeManager({
|
package/src/initPage.js
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
const {presult} = require('@applitools/functional-commons');
|
|
2
2
|
const browserLog = require('./browserLog');
|
|
3
3
|
const fakeIE = require('./fakeIE');
|
|
4
|
+
const {makeNetworkUtils} = require('./utils/pageNetworkUtils');
|
|
4
5
|
|
|
5
6
|
function makeInitPage({iframeUrl, config, browser, logger, getTransitiongIntoIE, getRenderIE}) {
|
|
7
|
+
const networkUtils = makeNetworkUtils({logger});
|
|
6
8
|
return async function initPage({pageId, pagePool}) {
|
|
7
9
|
logger.log('initializing puppeteer page number ', pageId);
|
|
8
10
|
const browserContext = await browser.createBrowserContext();
|
|
9
11
|
const page = await browserContext.newPage();
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
request.abort();
|
|
17
|
-
} else {
|
|
18
|
-
request.continue();
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
12
|
+
const {startInterception} = networkUtils.extend({page, pageId});
|
|
13
|
+
|
|
14
|
+
await startInterception({
|
|
15
|
+
timeout: config.browserRequestsTimeout,
|
|
16
|
+
blockPatterns: config.networkBlockPatterns,
|
|
17
|
+
});
|
|
22
18
|
|
|
23
19
|
if (config.viewportSize) {
|
|
24
20
|
await page.setViewport(config.viewportSize);
|
|
@@ -26,8 +26,7 @@ async function determineStorybookVersion({packagePath, isWindows}) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
const sbVersion = execSync(
|
|
30
|
-
|
|
29
|
+
const sbVersion = execSync(`"${storybookPath}" ${sbArg ?? ''} --version`).toString();
|
|
31
30
|
return {storybookPath, sbVersion, sbArg};
|
|
32
31
|
}
|
|
33
32
|
module.exports = determineStorybookVersion;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/* eslint-disable no-restricted-globals */
|
|
2
|
+
const {setTimeout} = require('timers/promises');
|
|
3
|
+
|
|
4
|
+
function makeBrowserNetworkPolicy({page, logger, pageId = null}) {
|
|
5
|
+
const scope = pageId ? `[page ${pageId}]` : '[master page]';
|
|
6
|
+
return {
|
|
7
|
+
extend(options) {
|
|
8
|
+
return makeBrowserNetworkPolicy({page, logger, pageId, ...options});
|
|
9
|
+
},
|
|
10
|
+
async startInterception({timeout, blockPatterns}) {
|
|
11
|
+
if (timeout || blockPatterns) {
|
|
12
|
+
const cdp = await page.target().createCDPSession();
|
|
13
|
+
|
|
14
|
+
await cdp.send('Fetch.enable');
|
|
15
|
+
await cdp.on('Fetch.requestPaused', async ({requestId, request}) => {
|
|
16
|
+
logger.log(`${scope} Request to ${request.url}`);
|
|
17
|
+
if (blockPatterns && blockPatterns.some(pattern => request.url.includes(pattern))) {
|
|
18
|
+
logger.log(`${scope} Blocking request to ${request.url}`);
|
|
19
|
+
await cdp.send('Fetch.failRequest', {requestId, errorReason: 'Blocked'});
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (timeout) {
|
|
23
|
+
await Promise.race([
|
|
24
|
+
setTimeout(timeout, {action: 'abort'}),
|
|
25
|
+
fetchRequest(request)
|
|
26
|
+
.then(response => ({action: 'fulfill', response}))
|
|
27
|
+
.catch(() => ({action: 'fail'})),
|
|
28
|
+
]).then(async ({action, response}) => {
|
|
29
|
+
if (action === 'abort') {
|
|
30
|
+
logger.log(`${scope} Timeout for request to ${request.url}`);
|
|
31
|
+
await cdp.send('Fetch.failRequest', {requestId, errorReason: 'Aborted'});
|
|
32
|
+
} else if (action === 'fulfill') {
|
|
33
|
+
logger.log(`${scope} Fulfilled request to ${request.url}`);
|
|
34
|
+
const bodyBytes = await response.arrayBuffer();
|
|
35
|
+
const body = Buffer.from(bodyBytes).toString('base64');
|
|
36
|
+
const cdpResponse = {
|
|
37
|
+
requestId,
|
|
38
|
+
responseCode: response.status,
|
|
39
|
+
responseHeaders: [...response.headers.entries()].map(([name, value]) => ({
|
|
40
|
+
name,
|
|
41
|
+
value,
|
|
42
|
+
})),
|
|
43
|
+
body,
|
|
44
|
+
};
|
|
45
|
+
await cdp.send('Fetch.fulfillRequest', cdpResponse);
|
|
46
|
+
} else {
|
|
47
|
+
logger.log(`${scope} Failed request to ${request.url}`);
|
|
48
|
+
await cdp.send('Fetch.failRequest', {requestId, errorReason: 'Failed'});
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
} else {
|
|
52
|
+
logger.log(`${scope} Not intercepting request to ${request.url}`);
|
|
53
|
+
await cdp.send('Fetch.continueRequest', {
|
|
54
|
+
requestId,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function fetchRequest(request) {
|
|
64
|
+
return fetch(request.url, {
|
|
65
|
+
method: request.method,
|
|
66
|
+
headers: request.headers,
|
|
67
|
+
body: request.postData,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
module.exports = {
|
|
72
|
+
makeNetworkUtils: makeBrowserNetworkPolicy,
|
|
73
|
+
};
|