html-reporter 9.1.1 → 9.2.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +2 -2
  3. package/hermione.js +0 -4
  4. package/lib/constants/group-tests.js +7 -0
  5. package/lib/gui/tool-runner/report-subscriber.js +0 -4
  6. package/lib/static/components/bottom-progress-bar/index.js +5 -1
  7. package/lib/static/components/controls/common-controls.js +3 -6
  8. package/lib/static/components/controls/{control-select/index.js → selects/control.js} +4 -3
  9. package/lib/static/components/controls/selects/group-tests.js +94 -0
  10. package/lib/static/components/controls/{control-select → selects}/index.styl +23 -9
  11. package/lib/static/components/{error-groups → group-tests}/item.js +8 -8
  12. package/lib/static/components/group-tests/list.js +71 -0
  13. package/lib/static/components/group-tests/prop-types.js +12 -0
  14. package/lib/static/components/gui.js +10 -8
  15. package/lib/static/components/main-tree.js +5 -5
  16. package/lib/static/components/report.js +10 -8
  17. package/lib/static/components/retry-switcher/item.js +15 -7
  18. package/lib/static/components/section/body/index.js +9 -4
  19. package/lib/static/components/section/title/browser.js +1 -2
  20. package/lib/static/gui.min.css +26 -13
  21. package/lib/static/gui.min.js +16 -16
  22. package/lib/static/modules/action-names.js +3 -3
  23. package/lib/static/modules/actions.js +17 -5
  24. package/lib/static/modules/custom-queries.js +1 -2
  25. package/lib/static/modules/default-state.js +14 -3
  26. package/lib/static/modules/middlewares/local-storage.js +0 -1
  27. package/lib/static/modules/middlewares/metrika.js +4 -11
  28. package/lib/static/modules/reducers/grouped-tests/by/meta.js +31 -0
  29. package/lib/static/modules/reducers/grouped-tests/by/result.js +57 -0
  30. package/lib/static/modules/reducers/grouped-tests/helpers.js +91 -0
  31. package/lib/static/modules/reducers/grouped-tests/index.js +52 -0
  32. package/lib/static/modules/reducers/index.js +2 -2
  33. package/lib/static/modules/reducers/notifications.js +6 -10
  34. package/lib/static/modules/reducers/tree/index.js +38 -12
  35. package/lib/static/modules/reducers/tree/nodes/browsers.js +9 -10
  36. package/lib/static/modules/reducers/tree/nodes/results.js +16 -0
  37. package/lib/static/modules/reducers/tree/nodes/suites.js +1 -1
  38. package/lib/static/modules/reducers/view.js +2 -10
  39. package/lib/static/modules/selectors/grouped-tests.js +8 -0
  40. package/lib/static/modules/selectors/view.js +1 -0
  41. package/lib/static/modules/utils.js +19 -1
  42. package/lib/static/report.min.css +26 -13
  43. package/lib/static/report.min.js +16 -16
  44. package/lib/static/styles.css +68 -31
  45. package/lib/test-adapter.js +7 -4
  46. package/package.json +2 -3
  47. package/lib/static/components/error-groups/list.js +0 -56
  48. package/lib/static/modules/group-errors.js +0 -101
  49. package/lib/static/modules/reducers/grouped-errors.js +0 -43
@@ -313,15 +313,15 @@ main.container {
313
313
  height: 100%;
314
314
  }
315
315
 
316
- .groupedErrors {
316
+ .grouped-tests {
317
317
  margin-top: 10px;
318
318
  }
319
319
 
320
- .error-group {
320
+ .tests-group {
321
321
  margin-bottom: 10px;
322
322
  }
323
323
 
324
- .error-group__title {
324
+ .tests-group__title {
325
325
  display: flex;
326
326
  align-items: center;
327
327
  font-size: 20px;
@@ -332,16 +332,20 @@ main.container {
332
332
  user-select: none;
333
333
  }
334
334
 
335
- .error-group__title:hover {
335
+ .tests-group__title:hover {
336
336
  color: #a3a3a3;
337
337
  }
338
338
 
339
- .error-group__name {
339
+ .tests-group__name {
340
340
  text-overflow: ellipsis;
341
341
  overflow: hidden;
342
342
  white-space: nowrap;
343
343
  }
344
344
 
345
+ .tests-group__count {
346
+ flex-shrink: 0;
347
+ }
348
+
345
349
  .sections_type_empty {
346
350
  margin-top: 10px;
347
351
  }
@@ -350,7 +354,7 @@ main.container {
350
354
  margin-top: 10px;
351
355
  }
352
356
 
353
- .error-group__body .section {
357
+ .tests-group__body .section {
354
358
  margin-top: 5px;
355
359
  }
356
360
 
@@ -379,7 +383,7 @@ main.container {
379
383
  }
380
384
 
381
385
  .section__title:before,
382
- .error-group__title:before,
386
+ .tests-group__title:before,
383
387
  .state-title:after,
384
388
  .details__summary:after,
385
389
  .error .details__summary:before {
@@ -392,7 +396,7 @@ main.container {
392
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");
393
397
  }
394
398
 
395
- .error-group__title:before {
399
+ .tests-group__title:before {
396
400
  flex-shrink: 0;
397
401
  }
398
402
 
@@ -423,7 +427,7 @@ details[open] > .details__summary:before {
423
427
  }
424
428
 
425
429
  .section_collapsed .section__title:before,
426
- .error-group_collapsed .error-group__title:before,
430
+ .tests-group_collapsed .tests-group__title:before,
427
431
  .state-title_collapsed.state-title:after {
428
432
  transform: rotate(180deg);
429
433
  }
@@ -480,7 +484,7 @@ details[open] > .details__summary:before {
480
484
  }
481
485
 
482
486
  .section__body,
483
- .error-group__body {
487
+ .tests-group__body {
484
488
  padding-left: 10px;
485
489
  }
486
490
 
@@ -588,37 +592,74 @@ details[open] > .details__summary:before {
588
592
  user-select: none;
589
593
  }
590
594
 
591
- .tab-switcher__button:hover {
592
- border-color: #888;
593
- }
594
-
595
595
  .tab-switcher__button_status_success,
596
596
  .tab-switcher__button_status_updated {
597
- background-color: #7bcc7b;
598
- 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);
599
605
  }
600
606
 
601
607
  .tab-switcher__button_status_error {
602
- background-color: #ff9a9a;
603
- 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);
604
615
  }
605
616
 
606
617
  .tab-switcher__button_status_fail {
607
- background-color: #ffc5e0;
608
- 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);
609
625
  }
610
626
 
611
627
  .tab-switcher__button_status_fail_error {
612
- background: linear-gradient(135deg, #ffc5e0 50%, #ff9a9a 50%);
613
- border-left-color: #ffc5e0;
614
- border-top-color: #ffc5e0;
615
- border-right-color: #ff9a9a;
616
- 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);
617
641
  }
618
642
 
619
643
  .tab-switcher__button_status_skipped {
620
- background-color: #ccc;
621
- 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;
622
663
  }
623
664
 
624
665
  .collapsed,
@@ -680,10 +721,6 @@ a:active {
680
721
  vertical-align: middle;
681
722
  }
682
723
 
683
- .tab-switcher__button.tab-switcher__button_active {
684
- border-color: #000;
685
- }
686
-
687
724
  .details {
688
725
  word-break: break-word;
689
726
  }
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- const Promise = require('bluebird');
4
3
  const _ = require('lodash');
5
4
  const fs = require('fs-extra');
6
5
  const path = require('path');
@@ -124,7 +123,7 @@ module.exports = class TestAdapter {
124
123
  return {};
125
124
  }
126
125
 
127
- async saveErrorScreenshot(reportPath) {
126
+ async _saveErrorScreenshot(reportPath) {
128
127
  if (!this.screenshot.base64) {
129
128
  logger.warn('Cannot save screenshot on reject');
130
129
 
@@ -331,7 +330,7 @@ module.exports = class TestAdapter {
331
330
  }
332
331
 
333
332
  async saveTestImages(reportPath, workers) {
334
- const result = await Promise.map(this.assertViewResults, async (assertResult) => {
333
+ const result = await Promise.all(this.assertViewResults.map(async (assertResult) => {
335
334
  const {stateName} = assertResult;
336
335
  const destRefPath = utils.getReferencePath(this, stateName);
337
336
  const srcRefPath = this.getRefImg(stateName).path;
@@ -362,7 +361,11 @@ module.exports = class TestAdapter {
362
361
  }
363
362
 
364
363
  return Promise.all(actions);
365
- });
364
+ }));
365
+
366
+ if (this.screenshot) {
367
+ await this._saveErrorScreenshot(reportPath);
368
+ }
366
369
 
367
370
  const htmlReporter = this._hermione.htmlReporter;
368
371
  htmlReporter.emit(htmlReporter.events.TEST_SCREENSHOTS_SAVED, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-reporter",
3
- "version": "9.1.1",
3
+ "version": "9.2.2",
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",
@@ -70,8 +70,6 @@
70
70
  "react-hotkeys": "^2.0.0",
71
71
  "react-html-parser": "^2.0.2",
72
72
  "react-markdown": "^3.2.0",
73
- "reapop": "2.1.0",
74
- "reapop-theme-wybo": "^1.1.0",
75
73
  "reduce-reducers": "^1.0.4",
76
74
  "reselect": "^4.0.0",
77
75
  "resolve": "^1.5.0",
@@ -139,6 +137,7 @@
139
137
  "react-dom": "^16.13.1",
140
138
  "react-redux": "^7.2.1",
141
139
  "react-virtualized": "^9.22.3",
140
+ "reapop": "4.0.5",
142
141
  "redux": "^4.0.5",
143
142
  "redux-logger": "^3.0.6",
144
143
  "redux-mock-store": "^1.5.1",
@@ -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,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
- };