@applitools/eyes-storybook 3.40.0 → 3.41.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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.41.0](https://github.com/applitools/eyes.sdk.javascript1/compare/js/eyes-storybook@3.40.0...js/eyes-storybook@3.41.0) (2023-09-05)
4
+
5
+
6
+ ### Features
7
+
8
+ * show aborted tests in Eyes dashboard ([#1877](https://github.com/applitools/eyes.sdk.javascript1/issues/1877)) ([f9840d4](https://github.com/applitools/eyes.sdk.javascript1/commit/f9840d494222ccc6c6f262896771e28da2565bc6))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * @applitools/core-base bumped to 1.6.0
14
+ #### Features
15
+
16
+ * show aborted tests in Eyes dashboard ([#1877](https://github.com/applitools/eyes.sdk.javascript1/issues/1877)) ([f9840d4](https://github.com/applitools/eyes.sdk.javascript1/commit/f9840d494222ccc6c6f262896771e28da2565bc6))
17
+ * @applitools/ec-client bumped to 1.7.8
18
+
19
+ * @applitools/core bumped to 3.10.2
20
+
21
+
3
22
  ## [3.40.0](https://github.com/applitools/eyes.sdk.javascript1/compare/js/eyes-storybook-v3.39.1...js/eyes-storybook@3.40.0) (2023-09-04)
4
23
 
5
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/eyes-storybook",
3
- "version": "3.40.0",
3
+ "version": "3.41.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "applitools",
@@ -57,7 +57,7 @@
57
57
  "postinstall": "node src/postinstall"
58
58
  },
59
59
  "dependencies": {
60
- "@applitools/core": "3.10.1",
60
+ "@applitools/core": "3.10.2",
61
61
  "@applitools/driver": "1.14.0",
62
62
  "@applitools/functional-commons": "1.6.0",
63
63
  "@applitools/logger": "2.0.10",
@@ -6,7 +6,7 @@ const getStoryBaselineName = require('./getStoryBaselineName');
6
6
  const {URL} = require('url');
7
7
  const runRunAfterScript = require('../dist/runRunAfterScript');
8
8
  const waitFor = require('./waitFor');
9
- const PAGE_EVALUATE_TIMEOUT = 120000;
9
+ const PAGE_EVALUATE_TIMEOUT = process.env.APPLITOOLS_PAGE_EVALUATE_TIMEOUT || 120000;
10
10
  const DOM_SNAPSHOTS_TIMEOUT = 5 * 60 * 1000;
11
11
  const utils = require('@applitools/utils');
12
12
 
@@ -14,26 +14,43 @@ function processResults({
14
14
  }) {
15
15
  let outputStr = '\n';
16
16
  const pluralize = utils.general.pluralize;
17
- let testResults = flatten(results.summary.results);
18
- const unresolved = testResults.filter(r => r.result.isDifferent);
19
- const passedOrNew = testResults.filter(r => r.result.status === 'Passed' || r.result.isNew);
20
- const newTests = testResults.filter(r => r.result.isNew);
17
+ const flattenedTestResults = flatten(results.summary.results);
18
+ const testResults = flattenedTestResults.filter(r => r && r.result);
19
+ const testResultsWithErrors = flattenedTestResults.filter(r => r && r.error);
20
+ const unresolved = testResults.filter(r => r.result.isDifferent && !r.result.isAborted);
21
+ const passedOrNew = testResults.filter(
22
+ r => r.result.status === 'Passed' || (r.result.isNew && !r.result.isAborted),
23
+ );
24
+ const aborted = testResults.filter(r => r.result.isAborted);
25
+ const newTests = testResults.filter(r => r.result.isNew && !r.result.isAborted);
21
26
  const newTestsSize = newTests.length;
22
27
  const warnForUnsavedNewTests = !!(!saveNewTests && newTestsSize);
28
+ const errMessagesToExclude = [
29
+ 'detected differences',
30
+ 'Please approve the new baseline',
31
+ 'is failed! See details at',
32
+ ];
23
33
 
24
- let errors = results.summary.results.map(result => [
25
- {err: result.error, title: result.result.name},
26
- ]);
27
- errors = flatten(errors).filter(
28
- ({err}) =>
29
- err &&
30
- !err.message.includes('detected differences') &&
31
- !err.message.includes('Please approve the new baseline'),
32
- );
34
+ const resultsErr = results.results
35
+ .map(result => {
36
+ if (!Array.isArray(result.resultsOrErr)) {
37
+ return {error: result.resultsOrErr, title: result.title};
38
+ }
39
+ })
40
+ .filter(Boolean);
33
41
 
34
- const hasResults = unresolved.length || passedOrNew.length;
42
+ const errors = testResultsWithErrors
43
+ .filter(({error}) => error && !errMessagesToExclude.some(msg => error.message.includes(msg)))
44
+ .map(({result, error, eyes}) => ({
45
+ error,
46
+ title: result?.name || eyes?.test.testName,
47
+ }))
48
+ .concat(resultsErr);
49
+
50
+ const hasResults = unresolved.length || passedOrNew.length || aborted.length;
35
51
  const seeDetailsStr =
36
- hasResults && `See details at ${(passedOrNew[0] || unresolved[0]).result.appUrls.batch}`;
52
+ hasResults &&
53
+ `See details at ${(passedOrNew[0] || unresolved[0] || aborted[0]).result.appUrls.batch}`;
37
54
 
38
55
  if (hasResults) {
39
56
  outputStr += `${seeDetailsStr}\n\n`;
@@ -46,11 +63,15 @@ function processResults({
46
63
  if (unresolved.length > 0) {
47
64
  outputStr += testResultsOutput(unresolved, warnForUnsavedNewTests);
48
65
  }
66
+ if (aborted.length > 0) {
67
+ outputStr += testResultsOutput(aborted, warnForUnsavedNewTests);
68
+ }
49
69
  if (errors.length) {
50
70
  const sortedErrors = errors.sort((a, b) => a.title.localeCompare(b.title));
51
71
  outputStr += uniq(
52
72
  sortedErrors.map(
53
- ({title, err}) => `${title} - ${chalk.red('Failed')} ${err.message || err.toString()}`,
73
+ ({title, error}) =>
74
+ `${title} - ${chalk.red('Failed')}. ${error.message || error.toString()}`,
54
75
  ),
55
76
  ).join('\n');
56
77
  outputStr += '\n';
@@ -130,7 +151,9 @@ function testResultsOutput(results, warnForUnsavedNewTests) {
130
151
  sortedTestResults.forEach(result => {
131
152
  const storyTitle = `${result.result.name} [${result.result.hostApp}] [${result.result.hostDisplaySize.width}x${result.result.hostDisplaySize.height}] - `;
132
153
 
133
- if (result.result.isNew) {
154
+ if (result.result.isAborted) {
155
+ outputStr += `${storyTitle}${chalk.keyword('red')(`Aborted`)}\n`;
156
+ } else if (result.result.isNew) {
134
157
  const newResColor = warnForUnsavedNewTests ? 'orange' : 'blue';
135
158
  outputStr += `${storyTitle}${chalk.keyword(newResColor)('New')}\n`;
136
159
  } else if (!result.result.isDifferent) {
@@ -101,7 +101,6 @@ function makeRenderStories({
101
101
  if (error) {
102
102
  const errMsg = `[page ${pageId}] Failed to get story data for "${title}". ${error}`;
103
103
  logger.log(errMsg);
104
- throw new Error(errMsg);
105
104
  }
106
105
  const testResults = await renderStory({
107
106
  snapshots: storyData,
@@ -129,12 +129,19 @@ function makeRenderStory({
129
129
  return new Promise((resolve, reject) => {
130
130
  throttle(async () => {
131
131
  try {
132
- await eyes.checkAndClose({
133
- target: snapshots,
134
- settings: {...checkParams, ...closeSettings},
135
- });
136
- const results = await eyes.getResults();
137
- resolve(results);
132
+ if (snapshots) {
133
+ await eyes.checkAndClose({
134
+ target: snapshots,
135
+ settings: {...checkParams, ...closeSettings},
136
+ });
137
+ const results = await eyes.getResults();
138
+ resolve(results);
139
+ } else {
140
+ await eyes.abort({settings: {renderers}});
141
+ reject(
142
+ new Error(`Failed to get story data for ${openParams.testName}, test was aborted`),
143
+ );
144
+ }
138
145
  } catch (err) {
139
146
  reject(err);
140
147
  }