@applitools/eyes-storybook 3.61.0 → 3.61.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 +85 -0
- package/dist/index.d.ts +23 -1
- package/package.json +5 -5
- package/src/configParams.js +10 -2
- package/src/defaultConfig.js +3 -12
- package/src/errMessages.js +22 -0
- package/src/extractEnvironment.js +4 -1
- package/src/eyesStorybook.js +5 -13
- package/src/eyesStorybookEventEmitter.js +2 -1
- package/src/generateConfig.js +2 -12
- package/src/getConfigAndLogger.js +2 -1
- package/src/index.ts +26 -1
- package/src/renderStories.js +5 -1
- package/src/renderStory.js +2 -2
- package/src/transformSettings.js +2 -0
- package/src/utils/config-validator.js +8 -3
- package/src/validateAndPopulateConfig.js +9 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,90 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.61.2](https://github.com/Applitools-Dev/sdk/compare/js/eyes-storybook@3.61.1...js/eyes-storybook@3.61.2) (2025-10-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* missed verifying environments | AD-11225 ([#3256](https://github.com/Applitools-Dev/sdk/issues/3256)) ([e8a5d78](https://github.com/Applitools-Dev/sdk/commit/e8a5d78426422614fc776b3d32ff2c375b95be18))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* @applitools/dom-snapshot bumped to 4.13.10
|
|
14
|
+
#### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* sandboxing | FLD-3482 ([#3274](https://github.com/Applitools-Dev/sdk/issues/3274)) ([b452cbf](https://github.com/Applitools-Dev/sdk/commit/b452cbf831907b04cd70624c0af655246ce580f1))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
* @applitools/driver bumped to 1.24.0
|
|
21
|
+
#### Features
|
|
22
|
+
|
|
23
|
+
* use performActions (W3C) instead of touchPerform (MJSONWP) ([#3223](https://github.com/Applitools-Dev/sdk/issues/3223)) ([d4e5da8](https://github.com/Applitools-Dev/sdk/commit/d4e5da8dc19ad3c3f76de8e762be867970df3dd2))
|
|
24
|
+
* @applitools/spec-driver-webdriver bumped to 1.5.0
|
|
25
|
+
#### Features
|
|
26
|
+
|
|
27
|
+
* use performActions (W3C) instead of touchPerform (MJSONWP) ([#3223](https://github.com/Applitools-Dev/sdk/issues/3223)) ([d4e5da8](https://github.com/Applitools-Dev/sdk/commit/d4e5da8dc19ad3c3f76de8e762be867970df3dd2))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
* @applitools/spec-driver-selenium bumped to 1.7.6
|
|
32
|
+
|
|
33
|
+
* @applitools/spec-driver-puppeteer bumped to 1.6.6
|
|
34
|
+
|
|
35
|
+
* @applitools/screenshoter bumped to 3.12.7
|
|
36
|
+
|
|
37
|
+
* @applitools/nml-client bumped to 1.11.9
|
|
38
|
+
|
|
39
|
+
* @applitools/ec-client bumped to 1.12.11
|
|
40
|
+
|
|
41
|
+
* @applitools/core bumped to 4.50.2
|
|
42
|
+
#### Bug Fixes
|
|
43
|
+
|
|
44
|
+
* missed verifying environments | AD-11225 ([#3256](https://github.com/Applitools-Dev/sdk/issues/3256)) ([e8a5d78](https://github.com/Applitools-Dev/sdk/commit/e8a5d78426422614fc776b3d32ff2c375b95be18))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
* @applitools/eyes bumped to 1.36.11
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## [3.61.1](https://github.com/Applitools-Dev/sdk/compare/js/eyes-storybook@3.61.0...js/eyes-storybook@3.61.1) (2025-10-09)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Bug Fixes
|
|
55
|
+
|
|
56
|
+
* various config fixes for storybook-addon ([#3257](https://github.com/Applitools-Dev/sdk/issues/3257)) ([86fd4d1](https://github.com/Applitools-Dev/sdk/commit/86fd4d114122bbaf675b5fa361b0e967595ca296))
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### Dependencies
|
|
60
|
+
|
|
61
|
+
* @applitools/dom-snapshot bumped to 4.13.9
|
|
62
|
+
#### Bug Fixes
|
|
63
|
+
|
|
64
|
+
* verbose Unknown CSS object model logging | AD-11542 | FLD-3687 ([#3261](https://github.com/Applitools-Dev/sdk/issues/3261)) ([ba85d32](https://github.com/Applitools-Dev/sdk/commit/ba85d3287a81af109db1a7b407e5ead20f395d9f))
|
|
65
|
+
* @applitools/core-base bumped to 1.28.2
|
|
66
|
+
#### Bug Fixes
|
|
67
|
+
|
|
68
|
+
* various config fixes for storybook-addon ([#3257](https://github.com/Applitools-Dev/sdk/issues/3257)) ([86fd4d1](https://github.com/Applitools-Dev/sdk/commit/86fd4d114122bbaf675b5fa361b0e967595ca296))
|
|
69
|
+
* @applitools/eyes bumped to 1.36.10
|
|
70
|
+
#### Bug Fixes
|
|
71
|
+
|
|
72
|
+
* various config fixes for storybook-addon ([#3257](https://github.com/Applitools-Dev/sdk/issues/3257)) ([86fd4d1](https://github.com/Applitools-Dev/sdk/commit/86fd4d114122bbaf675b5fa361b0e967595ca296))
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
* @applitools/nml-client bumped to 1.11.8
|
|
77
|
+
|
|
78
|
+
* @applitools/ec-client bumped to 1.12.10
|
|
79
|
+
|
|
80
|
+
* @applitools/core bumped to 4.50.1
|
|
81
|
+
#### Bug Fixes
|
|
82
|
+
|
|
83
|
+
* various config fixes for storybook-addon ([#3257](https://github.com/Applitools-Dev/sdk/issues/3257)) ([86fd4d1](https://github.com/Applitools-Dev/sdk/commit/86fd4d114122bbaf675b5fa361b0e967595ca296))
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
3
88
|
## [3.61.0](https://github.com/Applitools-Dev/sdk/compare/js/eyes-storybook@3.60.0...js/eyes-storybook@3.61.0) (2025-10-01)
|
|
4
89
|
|
|
5
90
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ConfigurationPlain, DesktopBrowserInfo, ChromeEmulationInfo, IOSDeviceInfo, IOSMultiDeviceInfo } from '@applitools/eyes';
|
|
2
|
-
type irrelevantToStorybook = 'waitBeforeScreenshots' | 'agentId' | 'captureStatusBar' | 'concurrentSessions' | 'connectionTimeout' | 'debugScreenshots' | 'defaultMatchSettings' | 'disableNMLUrlCache' | 'forceFullPageScreenshot' | 'hideCaret' | 'hideScrollbars' | 'hostApp' | 'hostAppInfo' | 'hostOS' | 'hostOSInfo' | 'ignoreBaseline' | 'ignoreCaret' | 'latestCommitInfo' | 'isDisabled' | 'matchTimeout' | 'mobileOptions' | 'removeSession' | 'rotation' | 'scaleRatio' | 'scrollRootElement' | 'sessionType' | 'stitchMode' | 'stitchOverlap' | 'viewportSize'
|
|
2
|
+
type irrelevantToStorybook = 'waitBeforeScreenshots' | 'agentId' | 'captureStatusBar' | 'concurrentSessions' | 'connectionTimeout' | 'debugScreenshots' | 'defaultMatchSettings' | 'disableNMLUrlCache' | 'forceFullPageScreenshot' | 'hideCaret' | 'hideScrollbars' | 'hostApp' | 'hostAppInfo' | 'hostOS' | 'hostOSInfo' | 'ignoreBaseline' | 'ignoreCaret' | 'latestCommitInfo' | 'isDisabled' | 'matchTimeout' | 'mobileOptions' | 'removeSession' | 'rotation' | 'scaleRatio' | 'scrollRootElement' | 'sessionType' | 'stitchMode' | 'stitchOverlap' | 'viewportSize';
|
|
3
3
|
/**
|
|
4
4
|
* Configuration options for Applitools Eyes Storybook integration.
|
|
5
5
|
*
|
|
@@ -98,6 +98,21 @@ export type ApplitoolsConfig = Omit<ConfigurationPlain, irrelevantToStorybook |
|
|
|
98
98
|
* @default false
|
|
99
99
|
*/
|
|
100
100
|
browserCacheRequests?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Headers to override in all browser requests.
|
|
103
|
+
* @default undefined
|
|
104
|
+
*/
|
|
105
|
+
browserHeadersOverride?: Record<string, string>;
|
|
106
|
+
/**
|
|
107
|
+
* Timeout in milliseconds for all browser requests.
|
|
108
|
+
* @default undefined
|
|
109
|
+
*/
|
|
110
|
+
browserRequestsTimeout?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Array of URL patterns to block requests to.
|
|
113
|
+
* @default undefined
|
|
114
|
+
*/
|
|
115
|
+
networkBlockPatterns?: string[];
|
|
101
116
|
/**
|
|
102
117
|
* Array of browser configurations for screenshot generation.
|
|
103
118
|
* Defines size and browser type for generated screenshots.
|
|
@@ -241,6 +256,13 @@ export type ApplitoolsConfig = Omit<ConfigurationPlain, irrelevantToStorybook |
|
|
|
241
256
|
* @default undefined
|
|
242
257
|
*/
|
|
243
258
|
shard?: string;
|
|
259
|
+
/**
|
|
260
|
+
* The size of the Puppeteer browser's window.
|
|
261
|
+
* This is the browser window which renders the stories originally (and opens at the size provided in the `viewportSize` parameter), and then a DOM snapshot is uploaded to the server, which renders this snapshot on all the browsers and sizes provided in the browser parameter.
|
|
262
|
+
*
|
|
263
|
+
* Note: Stories will **not** be rendered and tested on this viewport size, unless you also include it in the `browser` parameter.
|
|
264
|
+
*/
|
|
265
|
+
viewportSize?: ConfigurationPlain['viewportSize'];
|
|
244
266
|
};
|
|
245
267
|
export type configKeys = keyof ApplitoolsConfig;
|
|
246
268
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/eyes-storybook",
|
|
3
|
-
"version": "3.61.
|
|
3
|
+
"version": "3.61.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"up:framework": "cd test/fixtures/storybook-versions/${APPLITOOLS_FRAMEWORK_VERSION} && npm ci"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@applitools/core": "4.
|
|
63
|
-
"@applitools/driver": "1.
|
|
64
|
-
"@applitools/eyes": "1.36.
|
|
62
|
+
"@applitools/core": "4.50.2",
|
|
63
|
+
"@applitools/driver": "1.24.0",
|
|
64
|
+
"@applitools/eyes": "1.36.11",
|
|
65
65
|
"@applitools/functional-commons": "1.6.0",
|
|
66
66
|
"@applitools/logger": "2.2.4",
|
|
67
67
|
"@applitools/monitoring-commons": "1.0.19",
|
|
68
|
-
"@applitools/spec-driver-puppeteer": "1.6.
|
|
68
|
+
"@applitools/spec-driver-puppeteer": "1.6.6",
|
|
69
69
|
"@applitools/ufg-client": "1.17.4",
|
|
70
70
|
"@applitools/utils": "1.12.0",
|
|
71
71
|
"@inquirer/prompts": "7.0.1",
|
package/src/configParams.js
CHANGED
|
@@ -30,10 +30,8 @@ const configParams = [
|
|
|
30
30
|
'autProxy',
|
|
31
31
|
'saveDiffs',
|
|
32
32
|
'saveFailedTests',
|
|
33
|
-
'saveNewTests',
|
|
34
33
|
'compareWithParentBranch',
|
|
35
34
|
'ignoreBaseline',
|
|
36
|
-
'serverUrl',
|
|
37
35
|
'concurrency',
|
|
38
36
|
'testConcurrency',
|
|
39
37
|
'useDom',
|
|
@@ -44,6 +42,16 @@ const configParams = [
|
|
|
44
42
|
'dontCloseBatches',
|
|
45
43
|
'showBrowserLogs',
|
|
46
44
|
'shard',
|
|
45
|
+
'storybookUrl',
|
|
46
|
+
'browserCacheRequests',
|
|
47
|
+
'browserHeadersOverride',
|
|
48
|
+
'browserRequestsTimeout',
|
|
49
|
+
'networkBlockPatterns',
|
|
50
|
+
'navigationWaitUntil',
|
|
51
|
+
'include',
|
|
52
|
+
'xmlFilePath',
|
|
53
|
+
'tapFilePath',
|
|
54
|
+
'storybookStaticDir',
|
|
47
55
|
];
|
|
48
56
|
|
|
49
57
|
module.exports = {configParams};
|
package/src/defaultConfig.js
CHANGED
|
@@ -5,25 +5,16 @@ module.exports = {
|
|
|
5
5
|
storybookPort: 9000,
|
|
6
6
|
storybookHost: 'localhost',
|
|
7
7
|
storybookConfigDir: '.storybook',
|
|
8
|
-
storybookUrl: undefined,
|
|
9
|
-
storybookStaticDir: undefined,
|
|
10
8
|
showStorybookOutput: false,
|
|
11
9
|
waitBeforeScreenshot: 50, // backward compatibility
|
|
12
10
|
waitBeforeScreenshots: 50, // backward compatibility
|
|
13
11
|
waitBeforeCapture: 50,
|
|
14
12
|
viewportSize: {width: 1024, height: 768},
|
|
15
|
-
tapFilePath: undefined,
|
|
16
|
-
xmlFilePath: undefined,
|
|
17
13
|
exitcode: true,
|
|
18
14
|
readStoriesTimeout: 60000,
|
|
19
15
|
reloadPagePerStory: false,
|
|
20
|
-
include: undefined,
|
|
21
16
|
startStorybookServerTimeout: 300,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
browserHeadersOverride: undefined,
|
|
26
|
-
browserCacheRequests: undefined,
|
|
27
|
-
showBrowserLogs: undefined,
|
|
28
|
-
shard: undefined,
|
|
17
|
+
serverUrl: 'https://eyes.applitools.com',
|
|
18
|
+
saveNewTests: true,
|
|
19
|
+
fully: true,
|
|
29
20
|
};
|
package/src/errMessages.js
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
const chalk = require('chalk');
|
|
4
4
|
const {MissingApiKeyError} = require('@applitools/core');
|
|
5
|
+
const {EyesError} = require('@applitools/eyes');
|
|
6
|
+
|
|
7
|
+
class AbortedByUserError extends EyesError {
|
|
8
|
+
reason = 'abortedByUser';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
class InvalidConfigFileError extends EyesError {
|
|
12
|
+
reason = 'invalidConfigFile';
|
|
13
|
+
|
|
14
|
+
constructor(error) {
|
|
15
|
+
super();
|
|
16
|
+
|
|
17
|
+
const documentationUrl = 'https://applitools.com/tutorials/sdks/storybook/config#properties';
|
|
18
|
+
|
|
19
|
+
this.message =
|
|
20
|
+
`Your configuration file is invalid. Please review our documentation for valid configuration settings: ${documentationUrl}.
|
|
21
|
+
Additionally, you can generate a new configuration by running 'npx eyes-setup'.
|
|
22
|
+
\n\nError details: ${error.message}`.trim();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
5
25
|
|
|
6
26
|
const missingAppNameAndPackageJsonFailMsg = `
|
|
7
27
|
${chalk.red(
|
|
@@ -45,4 +65,6 @@ module.exports = {
|
|
|
45
65
|
refineErrorMessage,
|
|
46
66
|
deprecationWarning,
|
|
47
67
|
MissingApiKeyError,
|
|
68
|
+
AbortedByUserError,
|
|
69
|
+
InvalidConfigFileError,
|
|
48
70
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const {getStorybookFrameworks} = require('./utils/frameworks');
|
|
2
2
|
|
|
3
|
-
function extractEnvironment() {
|
|
3
|
+
function extractEnvironment(addonVersion) {
|
|
4
4
|
const versions = {};
|
|
5
5
|
try {
|
|
6
6
|
const {name, version} = require('storybook/package.json');
|
|
@@ -23,6 +23,9 @@ function extractEnvironment() {
|
|
|
23
23
|
peerDependencies,
|
|
24
24
|
);
|
|
25
25
|
sdk = {lang: 'js', name, currentVersion: version, framework, dependencyFrameworks};
|
|
26
|
+
if (addonVersion) {
|
|
27
|
+
sdk.addonVersion = addonVersion;
|
|
28
|
+
}
|
|
26
29
|
} catch {
|
|
27
30
|
// NOTE: ignore error
|
|
28
31
|
}
|
package/src/eyesStorybook.js
CHANGED
|
@@ -34,6 +34,7 @@ async function eyesStorybook({
|
|
|
34
34
|
outputStream = process.stderr,
|
|
35
35
|
eventEmitter,
|
|
36
36
|
signal = new AbortController().signal,
|
|
37
|
+
addonVersion,
|
|
37
38
|
}) {
|
|
38
39
|
logger.log(`Running with the following config:\n${configDigest(config)}`);
|
|
39
40
|
|
|
@@ -77,7 +78,7 @@ async function eyesStorybook({
|
|
|
77
78
|
cache: config.browserCacheRequests,
|
|
78
79
|
});
|
|
79
80
|
|
|
80
|
-
const environment = extractEnvironment();
|
|
81
|
+
const environment = extractEnvironment(addonVersion);
|
|
81
82
|
const core = await makeCore({spec, agentId: config.agentId, environment, logger});
|
|
82
83
|
const manager = await core.makeManager({
|
|
83
84
|
type: 'ufg',
|
|
@@ -95,18 +96,9 @@ async function eyesStorybook({
|
|
|
95
96
|
},
|
|
96
97
|
})
|
|
97
98
|
.catch(async error => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
error.message.includes('Please check your API key and try again.')
|
|
102
|
-
) {
|
|
103
|
-
const failMsg = 'Incorrect API Key';
|
|
104
|
-
logger.log(failMsg);
|
|
105
|
-
await browser.close();
|
|
106
|
-
throw new Error(failMsg);
|
|
107
|
-
} else {
|
|
108
|
-
throw error;
|
|
109
|
-
}
|
|
99
|
+
logger.error(error?.message);
|
|
100
|
+
await browser.close();
|
|
101
|
+
throw error;
|
|
110
102
|
});
|
|
111
103
|
|
|
112
104
|
const getStoriesWithConfig = makeGetStoriesWithConfig({config});
|
|
@@ -10,11 +10,12 @@ function eyesStorybookEventEmitter({
|
|
|
10
10
|
performance,
|
|
11
11
|
timeItAsync,
|
|
12
12
|
signal,
|
|
13
|
+
addonVersion,
|
|
13
14
|
}) {
|
|
14
15
|
const eventEmitter = new EventEmitter();
|
|
15
16
|
const startedAt = Date.now();
|
|
16
17
|
|
|
17
|
-
eyesStorybook({config, logger, performance, timeItAsync, eventEmitter, signal})
|
|
18
|
+
eyesStorybook({config, logger, performance, timeItAsync, eventEmitter, signal, addonVersion})
|
|
18
19
|
.then(({results}) => {
|
|
19
20
|
eventEmitter.emit('result', {
|
|
20
21
|
startedAt,
|
package/src/generateConfig.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const lodash = require('lodash');
|
|
3
3
|
const utils = require('@applitools/utils');
|
|
4
4
|
const {resolve} = require('path');
|
|
5
|
-
const {deprecationWarning} = require('./errMessages');
|
|
5
|
+
const {deprecationWarning, InvalidConfigFileError} = require('./errMessages');
|
|
6
6
|
const uniq = require('./uniq');
|
|
7
7
|
const {DEFAULT_CONCURRENCY} = require('@applitools/core');
|
|
8
8
|
const MAX_DATA_GAP = DEFAULT_CONCURRENCY * 2;
|
|
@@ -53,10 +53,6 @@ function generateConfig({argv = {}, defaultConfig = {}, externalConfigParams = [
|
|
|
53
53
|
|
|
54
54
|
result.eyesServerUrl = result.serverUrl;
|
|
55
55
|
|
|
56
|
-
result.viewportSize = result.viewportSize ? result.viewportSize : {width: 1024, height: 600};
|
|
57
|
-
|
|
58
|
-
result.saveNewTests = result.saveNewTests === undefined ? true : result.saveNewTests;
|
|
59
|
-
|
|
60
56
|
// Auto-enable dontCloseBatches when sharding is used (unless explicitly set by user)
|
|
61
57
|
if (result.shard && result.dontCloseBatches === undefined) {
|
|
62
58
|
result.dontCloseBatches = true;
|
|
@@ -66,7 +62,6 @@ function generateConfig({argv = {}, defaultConfig = {}, externalConfigParams = [
|
|
|
66
62
|
}
|
|
67
63
|
|
|
68
64
|
result.keepBatchOpen = result.dontCloseBatches;
|
|
69
|
-
result.fully = result.fully === undefined ? true : false;
|
|
70
65
|
|
|
71
66
|
if (result.batchName) {
|
|
72
67
|
result.batch = {name: result.batchName, ...result.batch};
|
|
@@ -103,12 +98,7 @@ function getAndParseConfig({configPaths, configParams}) {
|
|
|
103
98
|
if (error.message.includes('Could not find configuration file')) {
|
|
104
99
|
return utils.config.populateConfigParams({config: {}, params: configParams});
|
|
105
100
|
}
|
|
106
|
-
|
|
107
|
-
throw new Error(
|
|
108
|
-
`Your configuration file is invalid. Please review our documentation for valid configuration settings: ${documentationUrl}.
|
|
109
|
-
Additionally, you can generate a new configuration by running 'npx eyes-setup'.
|
|
110
|
-
\n\nError details: ${error.message}`.trim(),
|
|
111
|
-
);
|
|
101
|
+
throw new InvalidConfigFileError(error);
|
|
112
102
|
}
|
|
113
103
|
}
|
|
114
104
|
|
|
@@ -17,8 +17,9 @@ async function getConfigAndLogger(argv = {}) {
|
|
|
17
17
|
config,
|
|
18
18
|
logger,
|
|
19
19
|
packagePath: process.cwd(),
|
|
20
|
+
addonVersion: argv.addonVersion,
|
|
20
21
|
});
|
|
21
|
-
return {config, logger};
|
|
22
|
+
return {config, logger, defaultConfig};
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
module.exports = {getConfigAndLogger};
|
package/src/index.ts
CHANGED
|
@@ -29,7 +29,6 @@ type irrelevantToStorybook = 'waitBeforeScreenshots'
|
|
|
29
29
|
| 'stitchMode'
|
|
30
30
|
| 'stitchOverlap'
|
|
31
31
|
| 'viewportSize'
|
|
32
|
-
| 'isAddon'
|
|
33
32
|
;
|
|
34
33
|
|
|
35
34
|
|
|
@@ -140,6 +139,24 @@ export type ApplitoolsConfig = Omit<ConfigurationPlain, irrelevantToStorybook |
|
|
|
140
139
|
*/
|
|
141
140
|
browserCacheRequests?: boolean;
|
|
142
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Headers to override in all browser requests.
|
|
144
|
+
* @default undefined
|
|
145
|
+
*/
|
|
146
|
+
browserHeadersOverride?: Record<string, string>;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Timeout in milliseconds for all browser requests.
|
|
150
|
+
* @default undefined
|
|
151
|
+
*/
|
|
152
|
+
browserRequestsTimeout?: number;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Array of URL patterns to block requests to.
|
|
156
|
+
* @default undefined
|
|
157
|
+
*/
|
|
158
|
+
networkBlockPatterns?: string[];
|
|
159
|
+
|
|
143
160
|
/**
|
|
144
161
|
* Array of browser configurations for screenshot generation.
|
|
145
162
|
* Defines size and browser type for generated screenshots.
|
|
@@ -308,6 +325,14 @@ export type ApplitoolsConfig = Omit<ConfigurationPlain, irrelevantToStorybook |
|
|
|
308
325
|
* @default undefined
|
|
309
326
|
*/
|
|
310
327
|
shard?: string;
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* The size of the Puppeteer browser's window.
|
|
331
|
+
* This is the browser window which renders the stories originally (and opens at the size provided in the `viewportSize` parameter), and then a DOM snapshot is uploaded to the server, which renders this snapshot on all the browsers and sizes provided in the browser parameter.
|
|
332
|
+
*
|
|
333
|
+
* Note: Stories will **not** be rendered and tested on this viewport size, unless you also include it in the `browser` parameter.
|
|
334
|
+
*/
|
|
335
|
+
viewportSize?: ConfigurationPlain['viewportSize'];
|
|
311
336
|
}
|
|
312
337
|
|
|
313
338
|
export type configKeys = keyof ApplitoolsConfig;
|
package/src/renderStories.js
CHANGED
|
@@ -4,6 +4,7 @@ const getStoryBaselineName = require('./getStoryBaselineName');
|
|
|
4
4
|
const ora = require('ora');
|
|
5
5
|
const {EventEmitter} = require('node:events');
|
|
6
6
|
const {presult} = require('@applitools/functional-commons');
|
|
7
|
+
const {AbortedByUserError} = require('./errMessages');
|
|
7
8
|
|
|
8
9
|
function makeRenderStories({
|
|
9
10
|
getStoryData,
|
|
@@ -46,7 +47,10 @@ function makeRenderStories({
|
|
|
46
47
|
const story = stories[currIndex++];
|
|
47
48
|
const title = getStoryBaselineName(story);
|
|
48
49
|
logger.log('aborting story before processing', title);
|
|
49
|
-
onDoneStory(
|
|
50
|
+
onDoneStory(
|
|
51
|
+
new AbortedByUserError(`${title} aborted before processing ${signal.reason}`),
|
|
52
|
+
story,
|
|
53
|
+
);
|
|
50
54
|
return processStoryLoop();
|
|
51
55
|
}
|
|
52
56
|
|
package/src/renderStory.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const throat = require('throat');
|
|
4
|
-
const {
|
|
4
|
+
const {AbortedByUserError} = require('./errMessages');
|
|
5
5
|
const {storyToCheckSettings, storyToOpenSettings} = require('./transformSettings');
|
|
6
6
|
|
|
7
7
|
function makeRenderStory({
|
|
@@ -62,7 +62,7 @@ function makeRenderStory({
|
|
|
62
62
|
// This will intentionally cause not to wait for results.
|
|
63
63
|
// Therefore there will be a "hanging" promise.
|
|
64
64
|
// But for the purpose of the addon, which is a long living process, it doesn't matter that we didn't stop the operation inside core.
|
|
65
|
-
reject(new
|
|
65
|
+
reject(new AbortedByUserError(`${title} aborted after open ${signal.reason}`));
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
}).then(onDoneStory);
|
package/src/transformSettings.js
CHANGED
|
@@ -15,6 +15,7 @@ function storyToOpenSettings({story, appName, serverSettings, concurrency}) {
|
|
|
15
15
|
envName,
|
|
16
16
|
ignoreBaseline,
|
|
17
17
|
properties,
|
|
18
|
+
environments,
|
|
18
19
|
} = config;
|
|
19
20
|
|
|
20
21
|
const storyProperties = [
|
|
@@ -42,6 +43,7 @@ function storyToOpenSettings({story, appName, serverSettings, concurrency}) {
|
|
|
42
43
|
baselineEnvName,
|
|
43
44
|
environmentName: envName,
|
|
44
45
|
ignoreBaseline,
|
|
46
|
+
environments,
|
|
45
47
|
...serverSettings,
|
|
46
48
|
};
|
|
47
49
|
}
|
|
@@ -36,9 +36,6 @@ const applitoolsBaseKeys = [...dynamicBaseKeys, ...knownAliases];
|
|
|
36
36
|
* @type {Array<keyof (import('../index').ApplitoolsConfig) |
|
|
37
37
|
* 'reloadPagePerStory' |
|
|
38
38
|
* 'startStorybookServerTimeout' |
|
|
39
|
-
* 'networkBlockPatterns' |
|
|
40
|
-
* 'browserRequestsTimeout' |
|
|
41
|
-
* 'browserHeadersOverride' |
|
|
42
39
|
* 'waitBeforeScreenshot' |
|
|
43
40
|
* 'waitBeforeScreenshots' |
|
|
44
41
|
* 'fakeIE' |
|
|
@@ -51,11 +48,19 @@ const storybookSpecificKeys = [
|
|
|
51
48
|
'variations', // TODO - are we sure it should be supported from the applitools config file? https://applitools.com/tutorials/sdks/storybook/component-config#variations
|
|
52
49
|
'runInDocker',
|
|
53
50
|
'showLogs',
|
|
51
|
+
'storybookUrl',
|
|
52
|
+
'storybookStaticDir',
|
|
53
|
+
'include',
|
|
54
54
|
|
|
55
55
|
// Browser & Puppeteer Control
|
|
56
56
|
'browser',
|
|
57
57
|
'puppeteerOptions',
|
|
58
58
|
'puppeteerExtraHTTPHeaders', // created for a specific user, TODO - consider removing
|
|
59
|
+
'browserCacheRequests',
|
|
60
|
+
'browserHeadersOverride',
|
|
61
|
+
'browserRequestsTimeout',
|
|
62
|
+
'networkBlockPatterns',
|
|
63
|
+
'navigationWaitUntil',
|
|
59
64
|
|
|
60
65
|
// Region Matching
|
|
61
66
|
'ignoreRegions',
|
|
@@ -16,7 +16,12 @@ const determineStorybookVersion = require('./utils/determineStorybookVersion');
|
|
|
16
16
|
const {logUnrecognizedKeys} = require('./utils/config-validator');
|
|
17
17
|
const utils = require('@applitools/utils');
|
|
18
18
|
|
|
19
|
-
async function validateAndPopulateConfig({
|
|
19
|
+
async function validateAndPopulateConfig({
|
|
20
|
+
config,
|
|
21
|
+
packagePath = '',
|
|
22
|
+
logger = makeLogger(),
|
|
23
|
+
addonVersion,
|
|
24
|
+
}) {
|
|
20
25
|
if (!config.apiKey && !utils.general.getEnvValue('API_KEY')) {
|
|
21
26
|
throw new MissingApiKeyError();
|
|
22
27
|
}
|
|
@@ -62,8 +67,9 @@ async function validateAndPopulateConfig({config, packagePath = '', logger = mak
|
|
|
62
67
|
}
|
|
63
68
|
}
|
|
64
69
|
|
|
65
|
-
|
|
66
|
-
|
|
70
|
+
config.agentId = `eyes-storybook/${packageVersion} ${
|
|
71
|
+
addonVersion ? `[eyes-storybook-addon/${addonVersion}]` : ''
|
|
72
|
+
}`.trim();
|
|
67
73
|
|
|
68
74
|
if (config.runInDocker) {
|
|
69
75
|
config.puppeteerOptions = config.puppeteerOptions || {};
|