html-reporter 8.4.4 → 9.2.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.
Files changed (73) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +35 -3
  3. package/lib/config/index.js +17 -6
  4. package/lib/constants/defaults.js +2 -1
  5. package/lib/constants/diff-modes.js +32 -0
  6. package/lib/constants/group-tests.js +7 -0
  7. package/lib/constants/plugin-events.js +2 -1
  8. package/lib/server-utils.js +1 -1
  9. package/lib/static/components/bottom-progress-bar/index.js +5 -1
  10. package/lib/static/components/controls/common-controls.js +19 -20
  11. package/lib/static/components/controls/controls.less +0 -31
  12. package/lib/static/components/controls/selects/control.js +51 -0
  13. package/lib/static/components/controls/selects/group-tests.js +94 -0
  14. package/lib/static/components/controls/selects/index.styl +58 -0
  15. package/lib/static/components/{error-groups → group-tests}/item.js +8 -8
  16. package/lib/static/components/group-tests/list.js +71 -0
  17. package/lib/static/components/group-tests/prop-types.js +12 -0
  18. package/lib/static/components/icons/arrows-move.js +24 -0
  19. package/lib/static/components/main-tree.js +5 -5
  20. package/lib/static/components/modals/screenshot-accepter/body.js +4 -12
  21. package/lib/static/components/modals/screenshot-accepter/header.js +3 -32
  22. package/lib/static/components/retry-switcher/item.js +15 -7
  23. package/lib/static/components/section/body/index.js +9 -4
  24. package/lib/static/components/section/title/browser.js +1 -2
  25. package/lib/static/components/state/index.js +2 -9
  26. package/lib/static/components/state/{diff-circle.js → screenshot/diff-circle.js} +1 -1
  27. package/lib/static/components/state/screenshot/full.js +28 -0
  28. package/lib/static/components/state/{screenshot.js → screenshot/resized.js} +28 -30
  29. package/lib/static/components/state/screenshot/with-encode-uri.js +44 -0
  30. package/lib/static/components/state/screenshot/with-synced-scale.js +116 -0
  31. package/lib/static/components/state/state-error.js +3 -3
  32. package/lib/static/components/state/state-fail/index.js +142 -0
  33. package/lib/static/components/state/state-fail/index.styl +31 -0
  34. package/lib/static/components/state/state-fail/onion-skin-diff/index.js +43 -0
  35. package/lib/static/components/state/state-fail/onion-skin-diff/index.styl +19 -0
  36. package/lib/static/components/state/state-fail/prop-types.js +16 -0
  37. package/lib/static/components/state/state-fail/swipe-diff/index.js +138 -0
  38. package/lib/static/components/state/state-fail/swipe-diff/index.styl +82 -0
  39. package/lib/static/components/state/state-fail/switch-diff/index.js +36 -0
  40. package/lib/static/components/state/state-fail/switch-diff/index.styl +12 -0
  41. package/lib/static/components/state/state-success.js +2 -2
  42. package/lib/static/gui.min.css +205 -27
  43. package/lib/static/gui.min.js +16 -16
  44. package/lib/static/modules/action-names.js +9 -5
  45. package/lib/static/modules/actions.js +29 -5
  46. package/lib/static/modules/custom-queries.js +1 -2
  47. package/lib/static/modules/default-state.js +14 -4
  48. package/lib/static/modules/middlewares/local-storage.js +1 -3
  49. package/lib/static/modules/middlewares/metrika.js +10 -13
  50. package/lib/static/modules/reducers/grouped-tests/by/meta.js +31 -0
  51. package/lib/static/modules/reducers/grouped-tests/by/result.js +57 -0
  52. package/lib/static/modules/reducers/grouped-tests/helpers.js +91 -0
  53. package/lib/static/modules/reducers/grouped-tests/index.js +52 -0
  54. package/lib/static/modules/reducers/index.js +2 -2
  55. package/lib/static/modules/reducers/tree/index.js +38 -12
  56. package/lib/static/modules/reducers/tree/nodes/browsers.js +9 -10
  57. package/lib/static/modules/reducers/tree/nodes/results.js +16 -0
  58. package/lib/static/modules/reducers/tree/nodes/suites.js +1 -1
  59. package/lib/static/modules/reducers/view.js +29 -22
  60. package/lib/static/modules/selectors/grouped-tests.js +8 -0
  61. package/lib/static/modules/selectors/view.js +1 -0
  62. package/lib/static/modules/utils.js +19 -1
  63. package/lib/static/report.min.css +205 -27
  64. package/lib/static/report.min.js +16 -16
  65. package/lib/static/styles.css +71 -42
  66. package/lib/test-adapter.js +11 -2
  67. package/package.json +4 -2
  68. package/webpack.common.js +7 -0
  69. package/lib/static/components/controls/view-select.js +0 -50
  70. package/lib/static/components/error-groups/list.js +0 -56
  71. package/lib/static/components/state/state-fail.js +0 -56
  72. package/lib/static/modules/group-errors.js +0 -101
  73. package/lib/static/modules/reducers/grouped-errors.js +0 -43
@@ -257,25 +257,21 @@ main.container {
257
257
 
258
258
  .image-box__container,
259
259
  .image-box__screenshot-container {
260
+ display: flex;
261
+ flex-direction: column;
260
262
  margin-top: 10px;
261
263
  }
262
264
 
263
- .image-box__container:not(.image-box__container_scale) .image-box__image:not(:last-child) {
265
+ .image-box__container .image-box__image:not(:last-child) {
264
266
  margin-bottom: 5px;
265
267
  }
266
268
 
267
- .image-box__container_scale {
268
- display: flex;
269
- flex-flow: row wrap;
270
- }
271
-
272
269
  .report_show-only-errors .section_status_success,
273
270
  .report_show-only-errors .section_status_skipped {
274
271
  display: none;
275
272
  }
276
273
 
277
274
  .image-box__image {
278
- padding-right: 10px;
279
275
  display: inline-block;
280
276
  vertical-align: top;
281
277
  flex-basis: 33.333%;
@@ -284,10 +280,6 @@ main.container {
284
280
  max-width: 100%;
285
281
  }
286
282
 
287
- .image-box__image:last-child {
288
- margin-right: -10px;
289
- }
290
-
291
283
  .image-box__image.image-box__image_single {
292
284
  display: block;
293
285
  padding-right: 0px;
@@ -321,15 +313,15 @@ main.container {
321
313
  height: 100%;
322
314
  }
323
315
 
324
- .groupedErrors {
316
+ .grouped-tests {
325
317
  margin-top: 10px;
326
318
  }
327
319
 
328
- .error-group {
320
+ .tests-group {
329
321
  margin-bottom: 10px;
330
322
  }
331
323
 
332
- .error-group__title {
324
+ .tests-group__title {
333
325
  display: flex;
334
326
  align-items: center;
335
327
  font-size: 20px;
@@ -340,16 +332,20 @@ main.container {
340
332
  user-select: none;
341
333
  }
342
334
 
343
- .error-group__title:hover {
335
+ .tests-group__title:hover {
344
336
  color: #a3a3a3;
345
337
  }
346
338
 
347
- .error-group__name {
339
+ .tests-group__name {
348
340
  text-overflow: ellipsis;
349
341
  overflow: hidden;
350
342
  white-space: nowrap;
351
343
  }
352
344
 
345
+ .tests-group__count {
346
+ flex-shrink: 0;
347
+ }
348
+
353
349
  .sections_type_empty {
354
350
  margin-top: 10px;
355
351
  }
@@ -358,7 +354,7 @@ main.container {
358
354
  margin-top: 10px;
359
355
  }
360
356
 
361
- .error-group__body .section {
357
+ .tests-group__body .section {
362
358
  margin-top: 5px;
363
359
  }
364
360
 
@@ -387,7 +383,7 @@ main.container {
387
383
  }
388
384
 
389
385
  .section__title:before,
390
- .error-group__title:before,
386
+ .tests-group__title:before,
391
387
  .state-title:after,
392
388
  .details__summary:after,
393
389
  .error .details__summary:before {
@@ -400,7 +396,7 @@ main.container {
400
396
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 6.416L12.793 11.206C12.9816 11.3882 13.2342 11.489 13.4964 11.4867C13.7586 11.4844 14.0094 11.3792 14.1948 11.1938C14.3802 11.0084 14.4854 10.7576 14.4877 10.4954C14.4899 10.2332 14.3892 9.9806 14.207 9.792L8.707 4.295C8.51947 4.10753 8.26516 4.00221 8 4.00221C7.73483 4.00221 7.48052 4.10753 7.293 4.295L1.793 9.792C1.61084 9.9806 1.51004 10.2332 1.51232 10.4954C1.5146 10.7576 1.61977 11.0084 1.80518 11.1938C1.99058 11.3792 2.2414 11.4844 2.50359 11.4867C2.76579 11.489 3.01839 11.3882 3.207 11.206L8 6.416Z' fill='black'/%3E%3C/svg%3E%0A");
401
397
  }
402
398
 
403
- .error-group__title:before {
399
+ .tests-group__title:before {
404
400
  flex-shrink: 0;
405
401
  }
406
402
 
@@ -431,7 +427,7 @@ details[open] > .details__summary:before {
431
427
  }
432
428
 
433
429
  .section_collapsed .section__title:before,
434
- .error-group_collapsed .error-group__title:before,
430
+ .tests-group_collapsed .tests-group__title:before,
435
431
  .state-title_collapsed.state-title:after {
436
432
  transform: rotate(180deg);
437
433
  }
@@ -488,7 +484,7 @@ details[open] > .details__summary:before {
488
484
  }
489
485
 
490
486
  .section__body,
491
- .error-group__body {
487
+ .tests-group__body {
492
488
  padding-left: 10px;
493
489
  }
494
490
 
@@ -596,37 +592,74 @@ details[open] > .details__summary:before {
596
592
  user-select: none;
597
593
  }
598
594
 
599
- .tab-switcher__button:hover {
600
- border-color: #888;
601
- }
602
-
603
595
  .tab-switcher__button_status_success,
604
596
  .tab-switcher__button_status_updated {
605
- background-color: #7bcc7b;
606
- border-color: #7bcc7b;
597
+ background-color: rgba(123, 204, 123, 1);
598
+ border-color: rgba(123, 204, 123, 1);
599
+ }
600
+
601
+ .tab-switcher__button_status_success.tab-switcher__button_non-matched,
602
+ .tab-switcher__button_status_updated.tab-switcher__button_non-matched {
603
+ background-color: rgba(123, 204, 123, .25);
604
+ border-color: rgba(123, 204, 123, .25);
607
605
  }
608
606
 
609
607
  .tab-switcher__button_status_error {
610
- background-color: #ff9a9a;
611
- border-color: #ff9a9a;
608
+ background-color: rgba(255, 154, 154, 1);
609
+ border-color: rgba(255, 154, 154, 1);
610
+ }
611
+
612
+ .tab-switcher__button_status_error.tab-switcher__button_non-matched {
613
+ background-color: rgba(255, 154, 154, .25);
614
+ border-color: rgba(255, 154, 154, .25);
612
615
  }
613
616
 
614
617
  .tab-switcher__button_status_fail {
615
- background-color: #ffc5e0;
616
- border-color: #ffc5e0;
618
+ background-color: rgba(255, 197, 224, 1);
619
+ border-color: rgba(255, 197, 224, 1);
620
+ }
621
+
622
+ .tab-switcher__button_status_fail.tab-switcher__button_non-matched {
623
+ background-color: rgba(255, 197, 224, .25);
624
+ border-color: rgba(255, 197, 224, .25);
617
625
  }
618
626
 
619
627
  .tab-switcher__button_status_fail_error {
620
- background: linear-gradient(135deg, #ffc5e0 50%, #ff9a9a 50%);
621
- border-left-color: #ffc5e0;
622
- border-top-color: #ffc5e0;
623
- border-right-color: #ff9a9a;
624
- border-bottom-color: #ff9a9a;
628
+ background: linear-gradient(135deg, rgba(255, 197, 224, 1) 50%, rgba(255, 154, 154, 1) 50%);
629
+ border-left-color: rgba(255, 197, 224, 1);
630
+ border-top-color: rgba(255, 197, 224, 1);
631
+ border-right-color: rgba(255, 154, 154, 1);
632
+ border-bottom-color: rgba(255, 154, 154, 1);
633
+ }
634
+
635
+ .tab-switcher__button_status_fail_error.tab-switcher__button_non-matched {
636
+ background: linear-gradient(135deg, rgba(255, 197, 224, .25) 50%, rgba(255, 154, 154, .25) 50%);
637
+ border-left-color: rgba(255, 197, 224, .25);
638
+ border-top-color: rgba(255, 197, 224, .25);
639
+ border-right-color: rgba(255, 154, 154, .25);
640
+ border-bottom-color: rgba(255, 154, 154, .25);
625
641
  }
626
642
 
627
643
  .tab-switcher__button_status_skipped {
628
- background-color: #ccc;
629
- border-color: #ccc;
644
+ background-color: rgba(204, 204, 204, 1);
645
+ border-color: rgba(204, 204, 204, 1);
646
+ }
647
+
648
+ .tab-switcher__button_status_skipped.tab-switcher__button_non-matched {
649
+ background-color: rgba(204, 204, 204, .25);
650
+ border-color: rgba(204, 204, 204, .25);
651
+ }
652
+
653
+ .tab-switcher__button_non-matched {
654
+ color: rgba(0, 0, 0, .25);
655
+ }
656
+
657
+ .tab-switcher .tab-switcher__button:hover {
658
+ border-color: #888;
659
+ }
660
+
661
+ .tab-switcher__button.tab-switcher__button_active {
662
+ border-color: #000;
630
663
  }
631
664
 
632
665
  .collapsed,
@@ -688,10 +721,6 @@ a:active {
688
721
  vertical-align: middle;
689
722
  }
690
723
 
691
- .tab-switcher__button.tab-switcher__button_active {
692
- border-color: #000;
693
- }
694
-
695
724
  .details {
696
725
  word-break: break-word;
697
726
  }
@@ -330,8 +330,8 @@ module.exports = class TestAdapter {
330
330
  await fs.writeFile(detailsFilePath, detailsData);
331
331
  }
332
332
 
333
- saveTestImages(reportPath, workers) {
334
- return Promise.map(this.assertViewResults, async (assertResult) => {
333
+ async saveTestImages(reportPath, workers) {
334
+ const result = await Promise.map(this.assertViewResults, async (assertResult) => {
335
335
  const {stateName} = assertResult;
336
336
  const destRefPath = utils.getReferencePath(this, stateName);
337
337
  const srcRefPath = this.getRefImg(stateName).path;
@@ -363,6 +363,15 @@ module.exports = class TestAdapter {
363
363
 
364
364
  return Promise.all(actions);
365
365
  });
366
+
367
+ const htmlReporter = this._hermione.htmlReporter;
368
+ htmlReporter.emit(htmlReporter.events.TEST_SCREENSHOTS_SAVED, {
369
+ testId: this._testId,
370
+ attempt: this.attempt,
371
+ imagesInfo: this.getImagesInfo()
372
+ });
373
+
374
+ return result;
366
375
  }
367
376
 
368
377
  //parallelize and cache of 'gemini-core.Image.buildDiff' (because it is very slow)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-reporter",
3
- "version": "8.4.4",
3
+ "version": "9.2.0",
4
4
  "description": "Plugin for hermione which is intended to aggregate the results of tests running into html report",
5
5
  "scripts": {
6
6
  "coverage": "nyc npm run test-unit",
@@ -71,7 +71,7 @@
71
71
  "react-html-parser": "^2.0.2",
72
72
  "react-markdown": "^3.2.0",
73
73
  "reapop": "2.1.0",
74
- "reapop-theme-wybo": "1.0.2",
74
+ "reapop-theme-wybo": "^1.1.0",
75
75
  "reduce-reducers": "^1.0.4",
76
76
  "reselect": "^4.0.0",
77
77
  "resolve": "^1.5.0",
@@ -149,6 +149,8 @@
149
149
  "standard-version": "^4.0.0",
150
150
  "style-loader": "^0.19.0",
151
151
  "styled-components": "^3.4.10",
152
+ "stylus": "^0.57.0",
153
+ "stylus-loader": "^3.0.2",
152
154
  "url-loader": "^1.1.2",
153
155
  "webpack": "^3.6.0",
154
156
  "webpack-dev-server": "^2.11.5",
package/webpack.common.js CHANGED
@@ -38,6 +38,13 @@ module.exports = {
38
38
  use: ['css-loader', 'less-loader']
39
39
  })
40
40
  },
41
+ {
42
+ test: /\.styl$/,
43
+ loader: ExtractTextPlugin.extract({
44
+ fallback: 'style-loader',
45
+ use: ['css-loader', 'stylus-loader']
46
+ })
47
+ },
41
48
  {
42
49
  test: /\.js$/,
43
50
  use: 'babel-loader',
@@ -1,50 +0,0 @@
1
- 'use strict';
2
-
3
- import React, {Component} from 'react';
4
- import PropTypes from 'prop-types';
5
- import {bindActionCreators} from 'redux';
6
- import {connect} from 'react-redux';
7
- import {Dropdown} from 'semantic-ui-react';
8
- import * as actions from '../../modules/actions';
9
-
10
- class ViewSelect extends Component {
11
- static propTypes = {
12
- viewMode: PropTypes.string.isRequired,
13
- actions: PropTypes.object.isRequired,
14
- options: PropTypes.array.isRequired
15
- }
16
-
17
- constructor(props) {
18
- super(props);
19
- }
20
-
21
- _onChange = (_, dom) => {
22
- this.props.actions.changeViewMode(dom.value);
23
- }
24
-
25
- render() {
26
- const {viewMode, options} = this.props;
27
- const formatedOpts = options.map(({value, text}) => ({
28
- value,
29
- text,
30
- key: value
31
- }));
32
-
33
- return (
34
- <div className="viewmode">
35
- <Dropdown
36
- fluid
37
- selection
38
- options={formatedOpts}
39
- value={viewMode}
40
- onChange={this._onChange}
41
- />
42
- </div>
43
- );
44
- }
45
- }
46
-
47
- export default connect(
48
- ({view}) => ({viewMode: view.viewMode}),
49
- (dispatch) => ({actions: bindActionCreators(actions, dispatch)})
50
- )(ViewSelect);
@@ -1,56 +0,0 @@
1
- import React, {Component} from 'react';
2
- import {connect} from 'react-redux';
3
- import PropTypes from 'prop-types';
4
- import {bindActionCreators} from 'redux';
5
-
6
- import ErrorGroupsItem from './item';
7
- import * as actions from '../../modules/actions';
8
-
9
- class ErrorGroupsList extends Component {
10
- static propTypes = {
11
- groupedErrors: PropTypes.array.isRequired
12
- };
13
-
14
- state = {
15
- errorGroupIndex: null
16
- };
17
-
18
- onErrorGroupChange = (index) => {
19
- const errorGroupIndex = this.state.errorGroupIndex === index ? null : index;
20
- const isActive = errorGroupIndex !== null;
21
-
22
- this.setState({errorGroupIndex}, () => {
23
- const browserIds = isActive ? this.props.groupedErrors[index].browserIds : [];
24
- this.props.actions.toggleErrorGroup({browserIds, isActive});
25
- });
26
- }
27
-
28
- render() {
29
- const {groupedErrors} = this.props;
30
- const {errorGroupIndex} = this.state;
31
-
32
- if (groupedErrors.length === 0) {
33
- return <div className="groupedErrors">
34
- There are no failed tests. To see passed tests disable "Group by error" mode.
35
- </div>;
36
- }
37
-
38
- return <div className="groupedErrors">
39
- {groupedErrors.map((group, ind) => {
40
- const isActive = ind === errorGroupIndex;
41
-
42
- return <ErrorGroupsItem
43
- key={group.name}
44
- group={group}
45
- isActive={isActive}
46
- onClick={() => this.onErrorGroupChange(ind)}
47
- />;
48
- })}
49
- </div>;
50
- }
51
- }
52
-
53
- export default connect(
54
- ({groupedErrors}) => ({groupedErrors}),
55
- (dispatch) => ({actions: bindActionCreators(actions, dispatch)})
56
- )(ErrorGroupsList);
@@ -1,56 +0,0 @@
1
- 'use strict';
2
-
3
- import React, {Component, Fragment} from 'react';
4
- import {connect} from 'react-redux';
5
- import PropTypes from 'prop-types';
6
- import Screenshot from './screenshot';
7
-
8
- class StateFail extends Component {
9
- static propTypes = {
10
- image: PropTypes.shape({
11
- expectedImg: PropTypes.object.isRequired,
12
- actualImg: PropTypes.object.isRequired,
13
- diffImg: PropTypes.object.isRequired,
14
- diffClusters: PropTypes.array
15
- }).isRequired,
16
- // from store
17
- showOnlyDiff: PropTypes.bool.isRequired
18
- }
19
-
20
- render() {
21
- const {image: {expectedImg, actualImg, diffImg, diffClusters}} = this.props;
22
-
23
- return (
24
- <Fragment>
25
- {this._drawExpectedAndActual(expectedImg, actualImg)}
26
- {this._drawImageBox('Diff', diffImg, diffClusters)}
27
- </Fragment>
28
- );
29
- }
30
-
31
- _drawExpectedAndActual(expectedImg, actualImg) {
32
- if (this.props.showOnlyDiff) {
33
- return null;
34
- }
35
-
36
- return (
37
- <Fragment>
38
- {this._drawImageBox('Expected', expectedImg)}
39
- {this._drawImageBox('Actual', actualImg)}
40
- </Fragment>
41
- );
42
- }
43
-
44
- _drawImageBox(label, diffImg, diffClusters) {
45
- return (
46
- <div className="image-box__image">
47
- <div className="image-box__title">{label}</div>
48
- <Screenshot image={diffImg} diffClusters={diffClusters}/>
49
- </div>
50
- );
51
- }
52
- }
53
-
54
- export default connect(
55
- ({view: {showOnlyDiff}}) => ({showOnlyDiff})
56
- )(StateFail);
@@ -1,101 +0,0 @@
1
- import {get} from 'lodash';
2
- import {isTestNameMatchFilters, isAssertViewError, shouldShowBrowser} from './utils';
3
- import {getFailedSuiteResults} from './selectors/tree';
4
- import viewModes from '../../constants/view-modes';
5
-
6
- const imageComparisonErrorMessage = 'image comparison failed';
7
-
8
- /**
9
- * @param {object} tree
10
- * @param {string} viewMode
11
- * @param {array} errorPatterns
12
- * @param {array} filteredBrowsers
13
- * @param {string} [testNameFilter]
14
- * @param {boolean} [strictMatchFilter]
15
- * @return {array}
16
- */
17
- function groupErrors({tree = {}, viewMode = viewModes.ALL, errorPatterns = [], filteredBrowsers = [], testNameFilter = '', strictMatchFilter = false}) {
18
- const showOnlyFailed = viewMode === viewModes.FAILED;
19
- const failedResults = showOnlyFailed ? getFailedSuiteResults(tree) : Object.values(tree.results.byId);
20
- const errorGroups = {};
21
-
22
- for (const result of failedResults) {
23
- const browser = tree.browsers.byId[result.parentId];
24
- const images = result.imageIds.map((imageId) => tree.images.byId[imageId]);
25
- const testName = browser.parentId;
26
-
27
- if (!isTestNameMatchFilters(testName, testNameFilter, strictMatchFilter)) {
28
- continue;
29
- }
30
-
31
- if (!shouldShowBrowser(browser, filteredBrowsers)) {
32
- continue;
33
- }
34
-
35
- const errors = extractErrors(result, images);
36
-
37
- for (const errorText of errors) {
38
- const patternInfo = matchGroup(errorText, errorPatterns);
39
- const {pattern, name} = patternInfo;
40
-
41
- if (!errorGroups.hasOwnProperty(name)) {
42
- errorGroups[name] = {
43
- pattern,
44
- name,
45
- browserIds: [],
46
- count: 0
47
- };
48
- }
49
-
50
- const group = errorGroups[name];
51
-
52
- if (!group.browserIds.includes(browser.id)) {
53
- group.browserIds.push(browser.id);
54
- group.count++;
55
- }
56
- }
57
- }
58
-
59
- return Object.values(errorGroups).sort((err1, err2) => err2.count - err1.count);
60
- }
61
-
62
- function extractErrors(result, images) {
63
- const errors = new Set();
64
-
65
- images.forEach(({error, diffImg}) => {
66
- if (get(error, 'message')) {
67
- errors.add(error.message);
68
- }
69
-
70
- if (diffImg) {
71
- errors.add(imageComparisonErrorMessage);
72
- }
73
- });
74
-
75
- const {error} = result;
76
-
77
- if (errors.size > 0 && isAssertViewError(error)) {
78
- return [...errors];
79
- }
80
-
81
- if (get(error, 'message')) {
82
- errors.add(error.message);
83
- }
84
-
85
- return [...errors];
86
- }
87
-
88
- function matchGroup(errorText, errorPatterns) {
89
- for (const group of errorPatterns) {
90
- if (errorText.match(group.regexp)) {
91
- return group;
92
- }
93
- }
94
-
95
- return {
96
- name: errorText,
97
- pattern: errorText
98
- };
99
- }
100
-
101
- module.exports = {groupErrors};
@@ -1,43 +0,0 @@
1
- import {groupErrors} from '../group-errors';
2
- import {getViewQuery} from '../custom-queries';
3
- import actionNames from '../action-names';
4
-
5
- export default (state, action) => {
6
- if (!state.view.groupByError) {
7
- return state;
8
- }
9
-
10
- switch (action.type) {
11
- case actionNames.INIT_GUI_REPORT:
12
- case actionNames.INIT_STATIC_REPORT: {
13
- const viewQuery = getViewQuery(window.location.search);
14
- const {tree, config: {errorPatterns}, view: {viewMode}} = state;
15
- const groupedErrors = groupErrors({tree, viewMode, errorPatterns, ...viewQuery});
16
-
17
- return {...state, groupedErrors};
18
- }
19
-
20
- case actionNames.TESTS_END:
21
- case actionNames.BROWSERS_SELECTED:
22
- case actionNames.ACCEPT_SCREENSHOT:
23
- case actionNames.ACCEPT_OPENED_SCREENSHOTS:
24
- case actionNames.VIEW_UPDATE_FILTER_BY_NAME:
25
- case actionNames.VIEW_SET_STRICT_MATCH_FILTER:
26
- case actionNames.VIEW_TOGGLE_GROUP_BY_ERROR:
27
- case actionNames.VIEW_SHOW_ALL:
28
- case actionNames.VIEW_SHOW_FAILED: {
29
- const {
30
- tree,
31
- config: {errorPatterns},
32
- view: {viewMode, filteredBrowsers, testNameFilter, strictMatchFilter}
33
- } = state;
34
-
35
- const groupedErrors = groupErrors({tree, viewMode, errorPatterns, filteredBrowsers, testNameFilter, strictMatchFilter});
36
-
37
- return {...state, groupedErrors};
38
- }
39
-
40
- default:
41
- return state;
42
- }
43
- };