@applitools/eyes-storybook 3.27.3 → 3.27.4
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 +13 -0
- package/README.md +1 -1
- package/package.json +6 -6
- package/src/cli.js +1 -0
- package/src/processResults.js +40 -18
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 3.27.4 - 2022/2/9
|
|
6
|
+
|
|
7
|
+
- updated to @applitools/driver@1.4.9 (from 1.4.7)
|
|
8
|
+
- updated to @applitools/eyes-sdk-core@13.0.0 (from 12.24.9)
|
|
9
|
+
- updated to @applitools/logger@1.0.9 (from 1.0.8)
|
|
10
|
+
- updated to @applitools/visual-grid-client@15.8.62 (from 15.8.55)
|
|
11
|
+
- support adding new test(s) and the value of saveNewTest is false will warn
|
|
12
|
+
- README.md update default value of 'exitcode' to 'true' (from 'false')
|
|
13
|
+
- updated to @applitools/driver@1.4.12 (from 1.4.9)
|
|
14
|
+
- updated to @applitools/eyes-sdk-core@13.0.2 (from 13.0.0)
|
|
15
|
+
- updated to @applitools/logger@1.0.10 (from 1.0.9)
|
|
16
|
+
- updated to @applitools/visual-grid-client@15.8.63 (from 15.8.62)
|
|
17
|
+
- updated to @applitools/utils@1.2.12 (from 1.2.11)
|
|
5
18
|
|
|
6
19
|
## 3.27.3 - 2022/1/26
|
|
7
20
|
|
package/README.md
CHANGED
|
@@ -153,7 +153,7 @@ In addition to command-line arguments, it's possible to define the following con
|
|
|
153
153
|
| `storybookStaticDir` | undefined | Path to Storybook's static files folder (also available as command-line argument). |
|
|
154
154
|
| `showStorybookOutput` | undefined | Whether or not you want to see Storybook output (also available as command-line argument). |
|
|
155
155
|
| `viewportSize` | { width: 1024, height: 600} | The size of the puppeteer browser's window. 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.|
|
|
156
|
-
| `exitcode` |
|
|
156
|
+
| `exitcode` | true | If tests failed close with non-zero exit code (also available as command-line argument). |
|
|
157
157
|
| `browser` | { width: 800, height: 600, name: 'chrome' } | The size and browser of the generated screenshots. For more info and possible values, see the [browser section below](#configuring-the-browser).|
|
|
158
158
|
| `showLogs` | false | Whether or not you want to see logs of the Eyes-Storybook plugin. |
|
|
159
159
|
| `batch` | undefined | An object which describes different aspects of the batch. The following lines in this table depict the various ways to configure the batch. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/eyes-storybook",
|
|
3
|
-
"version": "3.27.
|
|
3
|
+
"version": "3.27.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=8.6.0"
|
|
@@ -59,14 +59,15 @@
|
|
|
59
59
|
"directory": "packages/eyes-storybook"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@applitools/driver": "1.4.
|
|
63
|
-
"@applitools/eyes-sdk-core": "13.0.
|
|
62
|
+
"@applitools/driver": "1.4.12",
|
|
63
|
+
"@applitools/eyes-sdk-core": "13.0.2",
|
|
64
64
|
"@applitools/functional-commons": "1.6.0",
|
|
65
|
-
"@applitools/logger": "1.0.
|
|
65
|
+
"@applitools/logger": "1.0.10",
|
|
66
66
|
"@applitools/monitoring-commons": "1.0.19",
|
|
67
67
|
"@applitools/spec-driver-puppeteer": "1.1.0",
|
|
68
68
|
"@applitools/test-server": "1.0.8",
|
|
69
|
-
"@applitools/
|
|
69
|
+
"@applitools/utils": "1.2.12",
|
|
70
|
+
"@applitools/visual-grid-client": "15.8.63",
|
|
70
71
|
"boxen": "4.2.0",
|
|
71
72
|
"chalk": "3.0.0",
|
|
72
73
|
"detect-port": "1.3.0",
|
|
@@ -82,7 +83,6 @@
|
|
|
82
83
|
"@applitools/sdk-release-kit": "0.13.11",
|
|
83
84
|
"@applitools/sdk-shared": "0.9.11",
|
|
84
85
|
"@applitools/snaptdout": "^1.0.1",
|
|
85
|
-
"@applitools/utils": "1.2.11",
|
|
86
86
|
"@storybook/react": "^6.4.0",
|
|
87
87
|
"@testing-library/dom": "^5.6.1",
|
|
88
88
|
"babel-core": "^6.26.3",
|
package/src/cli.js
CHANGED
package/src/processResults.js
CHANGED
|
@@ -2,17 +2,21 @@
|
|
|
2
2
|
const flatten = require('lodash.flatten');
|
|
3
3
|
const chalk = require('./chalkify');
|
|
4
4
|
const {TestResultsError, TestResultsFormatter} = require('@applitools/eyes-sdk-core');
|
|
5
|
+
const utils = require('@applitools/utils');
|
|
5
6
|
const uniq = require('./uniq');
|
|
6
7
|
const concurrencyMsg = require('./concurrencyMsg');
|
|
7
8
|
|
|
8
|
-
function processResults({results = [], totalTime, testConcurrency}) {
|
|
9
|
+
function processResults({results = [], totalTime, testConcurrency, saveNewTests = true}) {
|
|
9
10
|
let outputStr = '\n';
|
|
10
11
|
const formatter = new TestResultsFormatter();
|
|
11
|
-
|
|
12
|
+
const pluralize = utils.general.pluralize;
|
|
12
13
|
let testResults = results.map(r => r.resultsOrErr);
|
|
13
14
|
testResults = flatten(testResults).filter(r => r.constructor.name !== 'Error');
|
|
14
15
|
const unresolved = testResults.filter(r => r.getIsDifferent());
|
|
15
16
|
const passedOrNew = testResults.filter(r => !r.getIsDifferent());
|
|
17
|
+
const newTests = testResults.filter(r => r.getIsNew());
|
|
18
|
+
const newTestsSize = newTests.length;
|
|
19
|
+
const warnForUnsavedNewTests = !!(!saveNewTests && newTestsSize);
|
|
16
20
|
|
|
17
21
|
let errors = results.map(({title, resultsOrErr}) =>
|
|
18
22
|
Array.isArray(resultsOrErr)
|
|
@@ -31,10 +35,10 @@ function processResults({results = [], totalTime, testConcurrency}) {
|
|
|
31
35
|
|
|
32
36
|
outputStr += '[EYES: TEST RESULTS]:\n\n';
|
|
33
37
|
if (passedOrNew.length > 0) {
|
|
34
|
-
outputStr += testResultsOutput(passedOrNew);
|
|
38
|
+
outputStr += testResultsOutput(passedOrNew, warnForUnsavedNewTests);
|
|
35
39
|
}
|
|
36
40
|
if (unresolved.length > 0) {
|
|
37
|
-
outputStr += testResultsOutput(unresolved);
|
|
41
|
+
outputStr += testResultsOutput(unresolved, warnForUnsavedNewTests);
|
|
38
42
|
}
|
|
39
43
|
if (errors.length) {
|
|
40
44
|
const sortedErrors = errors.sort((a, b) => a.title.localeCompare(b.title));
|
|
@@ -52,23 +56,38 @@ function processResults({results = [], totalTime, testConcurrency}) {
|
|
|
52
56
|
|
|
53
57
|
if (errors.length && !unresolved.length) {
|
|
54
58
|
outputStr += chalk.red(
|
|
55
|
-
`\nA total of ${errors.length} stor${
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
`\nA total of ${errors.length} stor${pluralize(errors, [
|
|
60
|
+
'ies',
|
|
61
|
+
'y',
|
|
62
|
+
])} failed for unexpected error${pluralize(errors)}.`,
|
|
58
63
|
);
|
|
59
64
|
} else if (unresolved.length && !errors.length) {
|
|
60
65
|
outputStr += chalk.keyword('orange')(
|
|
61
|
-
`\nA total of ${unresolved.length} difference${
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
`\nA total of ${unresolved.length} difference${pluralize(unresolved, [
|
|
67
|
+
's were',
|
|
68
|
+
' was',
|
|
69
|
+
])} found.`,
|
|
64
70
|
);
|
|
65
71
|
} else if (unresolved.length || errors.length) {
|
|
66
72
|
outputStr += chalk.red(
|
|
67
|
-
`\nA total of ${unresolved.length} difference${
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
`\nA total of ${unresolved.length} difference${pluralize(unresolved, [
|
|
74
|
+
's were',
|
|
75
|
+
' was',
|
|
76
|
+
])} found and ${errors.length} stor${pluralize(errors, [
|
|
77
|
+
'ies',
|
|
78
|
+
'y',
|
|
79
|
+
])} failed for ${pluralize(errors, ['', 'an '])}unexpected error${pluralize(errors)}.`,
|
|
80
|
+
);
|
|
81
|
+
} else if (warnForUnsavedNewTests) {
|
|
82
|
+
const countText =
|
|
83
|
+
newTestsSize > 1
|
|
84
|
+
? `are ${newTestsSize} new tests`
|
|
85
|
+
: `is a new test: '${newTests[0].getName()}'`;
|
|
86
|
+
outputStr += chalk.red(
|
|
87
|
+
`\n'saveNewTests' was set to false and there ${countText}. Please approve ${pluralize(
|
|
88
|
+
newTestsSize,
|
|
89
|
+
['their', 'its'],
|
|
90
|
+
)} baseline${pluralize(newTestsSize)} in Eyes dashboard.\n`,
|
|
72
91
|
);
|
|
73
92
|
} else if (passedOrNew.length) {
|
|
74
93
|
outputStr += chalk.green(`\nNo differences were found!`);
|
|
@@ -93,7 +112,9 @@ function processResults({results = [], totalTime, testConcurrency}) {
|
|
|
93
112
|
}),
|
|
94
113
|
);
|
|
95
114
|
});
|
|
96
|
-
const exitCode =
|
|
115
|
+
const exitCode =
|
|
116
|
+
!warnForUnsavedNewTests && passedOrNew.length && !errors.length && !unresolved.length ? 0 : 1;
|
|
117
|
+
|
|
97
118
|
return {
|
|
98
119
|
outputStr,
|
|
99
120
|
formatter,
|
|
@@ -101,7 +122,7 @@ function processResults({results = [], totalTime, testConcurrency}) {
|
|
|
101
122
|
};
|
|
102
123
|
}
|
|
103
124
|
|
|
104
|
-
function testResultsOutput(results) {
|
|
125
|
+
function testResultsOutput(results, warnForUnsavedNewTests) {
|
|
105
126
|
let outputStr = '';
|
|
106
127
|
const sortedTestResults = results.sort((a, b) => a.getName().localeCompare(b.getName()));
|
|
107
128
|
sortedTestResults.forEach(result => {
|
|
@@ -110,7 +131,8 @@ function testResultsOutput(results) {
|
|
|
110
131
|
.toString()}] - `;
|
|
111
132
|
|
|
112
133
|
if (result.getIsNew()) {
|
|
113
|
-
|
|
134
|
+
const newResColor = warnForUnsavedNewTests ? 'orange' : 'blue';
|
|
135
|
+
outputStr += `${storyTitle}${chalk.keyword(newResColor)('New')}\n`;
|
|
114
136
|
} else if (result.isPassed()) {
|
|
115
137
|
outputStr += `${storyTitle}${chalk.green('Passed')}\n`;
|
|
116
138
|
} else {
|