html-reporter 9.1.1 → 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 (43) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +2 -2
  3. package/lib/constants/group-tests.js +7 -0
  4. package/lib/static/components/bottom-progress-bar/index.js +5 -1
  5. package/lib/static/components/controls/common-controls.js +3 -6
  6. package/lib/static/components/controls/{control-select/index.js → selects/control.js} +4 -3
  7. package/lib/static/components/controls/selects/group-tests.js +94 -0
  8. package/lib/static/components/controls/{control-select → selects}/index.styl +23 -9
  9. package/lib/static/components/{error-groups → group-tests}/item.js +8 -8
  10. package/lib/static/components/group-tests/list.js +71 -0
  11. package/lib/static/components/group-tests/prop-types.js +12 -0
  12. package/lib/static/components/main-tree.js +5 -5
  13. package/lib/static/components/retry-switcher/item.js +15 -7
  14. package/lib/static/components/section/body/index.js +9 -4
  15. package/lib/static/components/section/title/browser.js +1 -2
  16. package/lib/static/gui.min.css +26 -13
  17. package/lib/static/gui.min.js +16 -16
  18. package/lib/static/modules/action-names.js +3 -3
  19. package/lib/static/modules/actions.js +2 -2
  20. package/lib/static/modules/custom-queries.js +1 -2
  21. package/lib/static/modules/default-state.js +12 -2
  22. package/lib/static/modules/middlewares/local-storage.js +0 -1
  23. package/lib/static/modules/middlewares/metrika.js +4 -11
  24. package/lib/static/modules/reducers/grouped-tests/by/meta.js +31 -0
  25. package/lib/static/modules/reducers/grouped-tests/by/result.js +57 -0
  26. package/lib/static/modules/reducers/grouped-tests/helpers.js +91 -0
  27. package/lib/static/modules/reducers/grouped-tests/index.js +52 -0
  28. package/lib/static/modules/reducers/index.js +2 -2
  29. package/lib/static/modules/reducers/tree/index.js +38 -12
  30. package/lib/static/modules/reducers/tree/nodes/browsers.js +9 -10
  31. package/lib/static/modules/reducers/tree/nodes/results.js +16 -0
  32. package/lib/static/modules/reducers/tree/nodes/suites.js +1 -1
  33. package/lib/static/modules/reducers/view.js +2 -10
  34. package/lib/static/modules/selectors/grouped-tests.js +8 -0
  35. package/lib/static/modules/selectors/view.js +1 -0
  36. package/lib/static/modules/utils.js +19 -1
  37. package/lib/static/report.min.css +26 -13
  38. package/lib/static/report.min.js +16 -16
  39. package/lib/static/styles.css +68 -31
  40. package/package.json +1 -1
  41. package/lib/static/components/error-groups/list.js +0 -56
  42. package/lib/static/modules/group-errors.js +0 -101
  43. package/lib/static/modules/reducers/grouped-errors.js +0 -43
package/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ <a name="9.2.0"></a>
6
+ # [9.2.0](https://github.com/gemini-testing/html-reporter/compare/v9.1.1...v9.2.0) (2022-08-05)
7
+
8
+
9
+ ### Features
10
+
11
+ * add ability to group tests by keys from meta of tests ([5fd3526](https://github.com/gemini-testing/html-reporter/commit/5fd3526))
12
+ * add ability to mark matched results on selected group ([8275b95](https://github.com/gemini-testing/html-reporter/commit/8275b95))
13
+
14
+
15
+
5
16
  <a name="9.1.1"></a>
6
17
  ## [9.1.1](https://github.com/gemini-testing/html-reporter/compare/v9.1.0...v9.1.1) (2022-08-04)
7
18
 
package/README.md CHANGED
@@ -54,7 +54,7 @@ directory.
54
54
  * **errorPatterns** (optional) - `Array` - error message patterns are used:
55
55
 
56
56
  * to show more understandable information about matched error;
57
- * in 'Group by error' mode.
57
+ * in 'Group by' mode with selected 'error' key.
58
58
 
59
59
  Array elements must be one of the types:
60
60
 
@@ -66,7 +66,7 @@ directory.
66
66
  * *name* of error pattern will be displayed as title of error message and original error message will be hidden under details;
67
67
  * *hint* of error pattern will be displayed after error *stack* field. Can be specified as html string. For example, `<div>some-useful-hint</div>`.
68
68
 
69
- In 'Group by error' mode test will be associated with group if test error matches on group error pattern. New group will be created if test cannot be associated with existing groups.
69
+ In 'Group by' mode with selected 'error' key test will be associated with group if test error matches on group error pattern. New group will be created if test cannot be associated with existing groups.
70
70
 
71
71
  * **metaInfoBaseUrls** (optional) `Object` - base paths for making link from Meta-info values. Object option must be Meta-info's key and value must be `String`. For example, {'file': 'base/path'}.
72
72
  * **saveFormat** (**DEPRECATED**, optional) `String` - allows to specify the format, in which the results will be saved. Available values are:
@@ -0,0 +1,7 @@
1
+ exports.SECTIONS = {
2
+ RESULT: 'result',
3
+ META: 'meta'
4
+ };
5
+ exports.ERROR_KEY = 'error';
6
+ exports.RESULT_KEYS = [exports.ERROR_KEY];
7
+ exports.KEY_DELIMITER = '.';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- import {extend} from 'lodash';
3
+ import {extend, isNumber} from 'lodash';
4
4
  import React from 'react';
5
5
  import {connect} from 'react-redux';
6
6
 
@@ -15,6 +15,10 @@ const BottomProgressBar = (props) => {
15
15
  const currentRootSuiteIdx = suiteIdsIndexMap[currentRootSuiteId];
16
16
  const percent = 100 / (visibleRootSuiteIds.length - 1) * currentRootSuiteIdx;
17
17
 
18
+ if (!isNumber(currentRootSuiteIdx)) {
19
+ return null;
20
+ }
21
+
18
22
  return (
19
23
  <div className="bottom-progress-bar">
20
24
  <div className='bottom-progress-bar__progress-container'>
@@ -4,7 +4,8 @@ import {connect} from 'react-redux';
4
4
  import {capitalize} from 'lodash';
5
5
  import * as actions from '../../modules/actions';
6
6
  import ControlButton from './control-button';
7
- import ControlSelect from './control-select';
7
+ import ControlSelect from './selects/control';
8
+ import GroupTestsSelect from './selects/group-tests';
8
9
  import BaseHostInput from './base-host-input';
9
10
  import MenuBar from './menu-bar';
10
11
  import viewModes from '../../../constants/view-modes';
@@ -49,6 +50,7 @@ class ControlButtons extends Component {
49
50
  handler={actions.expandRetries}
50
51
  />
51
52
  </div>
53
+ <GroupTestsSelect />
52
54
  <ControlButton
53
55
  label="Show skipped"
54
56
  isActive={view.showSkipped}
@@ -63,11 +65,6 @@ class ControlButtons extends Component {
63
65
  })}
64
66
  extendClassNames="diff-mode"
65
67
  />
66
- <ControlButton
67
- label="Group by error"
68
- isActive={Boolean(view.groupByError)}
69
- handler={actions.toggleGroupByError}
70
- />
71
68
  <BaseHostInput/>
72
69
  <MenuBar />
73
70
  </div>
@@ -30,15 +30,16 @@ export default class ControlSelect extends Component {
30
30
  }));
31
31
 
32
32
  const className = classNames(
33
- 'control-select',
33
+ 'select',
34
+ 'select_type_control',
34
35
  extendClassNames
35
36
  );
36
37
 
37
38
  return (
38
39
  <div className={className}>
39
- <Label className="control-select__label">{label}</Label>
40
+ <Label className="select__label">{label}</Label>
40
41
  <Dropdown
41
- className="control-select__dropdown"
42
+ className="select__dropdown"
42
43
  selection
43
44
  options={formattedOpts}
44
45
  value={value}
@@ -0,0 +1,94 @@
1
+ import React, {Component, Fragment} from 'react';
2
+ import {bindActionCreators} from 'redux';
3
+ import {connect} from 'react-redux';
4
+ import PropTypes from 'prop-types';
5
+ import {Label, Dropdown} from 'semantic-ui-react';
6
+ import classNames from 'classnames';
7
+ import {isEmpty} from 'lodash';
8
+
9
+ import * as actions from '../../../modules/actions';
10
+ import {groupedTestsType} from '../../group-tests/prop-types';
11
+ import {SECTIONS, KEY_DELIMITER} from '../../../../constants/group-tests';
12
+ import {getParsedKeyToGroupTestsBy} from '../../../modules/selectors/grouped-tests';
13
+
14
+ import './index.styl';
15
+
16
+ class GroupTestsSelect extends Component {
17
+ static propTypes = {
18
+ actions: PropTypes.object.isRequired,
19
+ // from store
20
+ keyToGroupTestsBy: PropTypes.string.isRequired,
21
+ groupedTests: groupedTestsType.isRequired,
22
+ selectedGroupSection: PropTypes.string,
23
+ selectedGroupKey: PropTypes.string
24
+ }
25
+
26
+ _groupTestsByKey = (_, dom) => {
27
+ if (dom.value !== this.props.keyToGroupTestsBy) {
28
+ this.props.actions.groupTestsByKey(dom.value);
29
+ }
30
+ }
31
+
32
+ _renderSection(sectionName) {
33
+ const {groupedTests} = this.props;
34
+ const keys = groupedTests[sectionName].allKeys;
35
+
36
+ if (isEmpty(keys)) {
37
+ return null;
38
+ }
39
+
40
+ return (
41
+ <Fragment key={sectionName}>
42
+ <Dropdown.Divider/>
43
+ <Dropdown.Header content={sectionName} />
44
+ <Dropdown.Divider/>
45
+ {keys.map(key => {
46
+ const id = getGroupElemId(sectionName, key);
47
+ const isActive = id === this.props.keyToGroupTestsBy;
48
+
49
+ return <Dropdown.Item key={id} value={id} active={isActive} onClick={this._groupTestsByKey}>{key}</Dropdown.Item>;
50
+ })}
51
+ </Fragment>
52
+ );
53
+ }
54
+
55
+ render() {
56
+ const {selectedGroupKey} = this.props;
57
+ const className = classNames(
58
+ 'select',
59
+ 'select_type_group'
60
+ );
61
+
62
+ return (
63
+ <div className={className}>
64
+ <Label className="select__label">Group by</Label>
65
+ <Dropdown
66
+ className="select__dropdown selection"
67
+ value={selectedGroupKey}
68
+ text={selectedGroupKey}
69
+ onChange={this._groupTestsByKey}
70
+ placeholder="select key"
71
+ clearable={Boolean(selectedGroupKey)}
72
+ >
73
+ <Dropdown.Menu>
74
+ {Object.values(SECTIONS).map((sectionName) => this._renderSection(sectionName))}
75
+ </Dropdown.Menu>
76
+ </Dropdown>
77
+ </div>
78
+ );
79
+ }
80
+ }
81
+
82
+ export default connect(
83
+ (state) =>{
84
+ const {view: {keyToGroupTestsBy}, groupedTests} = state;
85
+ const [selectedGroupSection, selectedGroupKey] = getParsedKeyToGroupTestsBy(state);
86
+
87
+ return {keyToGroupTestsBy, groupedTests, selectedGroupSection, selectedGroupKey};
88
+ },
89
+ (dispatch) => ({actions: bindActionCreators(actions, dispatch)})
90
+ )(GroupTestsSelect);
91
+
92
+ function getGroupElemId(groupName, groupKey) {
93
+ return `${groupName}${KEY_DELIMITER}${groupKey}`;
94
+ }
@@ -1,9 +1,9 @@
1
- .control-select
1
+ .select
2
2
  display: inline-flex
3
3
  margin-right: 15px
4
4
  margin-bottom: 15px
5
5
 
6
- .control-select__label
6
+ .select__label
7
7
  font-size: 11px
8
8
  margin: 0
9
9
  padding: 0 5px
@@ -13,12 +13,13 @@
13
13
  border-top-right-radius: 0
14
14
  border-bottom-right-radius: 0
15
15
 
16
- .control-select__dropdown.ui.dropdown
16
+ .select__dropdown.ui.dropdown
17
17
  min-height: 25px
18
- min-width: 60px
18
+ min-width: 70px
19
19
  font-size: 11px
20
20
  line-height: 13px
21
21
  padding: 5px
22
+ padding-right: 25px
22
23
  border: 1px solid #ccc
23
24
  border-radius: 2px
24
25
  border-top-left-radius: 0
@@ -32,13 +33,26 @@
32
33
  .menu
33
34
  border-color: #ffd947
34
35
 
35
- .icon
36
- top: 50%
37
- right: 10px
36
+ .icon.dropdown
38
37
  padding: 0
39
38
  margin: 0
40
- transform: translateY(-50%)
39
+ line-height: initial
41
40
 
42
41
  &.diff-mode
43
- .control-select__dropdown.ui.dropdown
42
+ .select__dropdown.ui.dropdown
44
43
  min-width: 90px
44
+
45
+ &.select_type_group
46
+ .select__dropdown.ui.dropdown
47
+ min-width: 110px
48
+
49
+ .menu > .header
50
+ margin: 0
51
+ padding: 0 0 0 5px
52
+ border-bottom: 0
53
+
54
+ .menu > .divider
55
+ margin: 5px 0
56
+
57
+ .menu > .item
58
+ padding-left: 10px !important
@@ -4,7 +4,7 @@ import classNames from 'classnames';
4
4
 
5
5
  import Suites from '../suites';
6
6
 
7
- export default class ErrorGroupsItem extends Component {
7
+ export default class GroupTestsItem extends Component {
8
8
  static propTypes = {
9
9
  group: PropTypes.object.isRequired,
10
10
  isActive: PropTypes.bool.isRequired,
@@ -13,24 +13,24 @@ export default class ErrorGroupsItem extends Component {
13
13
 
14
14
  render() {
15
15
  const {group, isActive, onClick} = this.props;
16
- const {name, pattern, count} = group;
16
+ const {name, pattern, testCount, resultCount} = group;
17
17
 
18
18
  const body = isActive ? (
19
- <div className="error-group__body">
19
+ <div className="tests-group__body">
20
20
  <Suites />
21
21
  </div>
22
22
  ) : null;
23
23
 
24
24
  const className = classNames(
25
- 'error-group',
26
- {'error-group_collapsed': !isActive}
25
+ 'tests-group',
26
+ {'tests-group_collapsed': !isActive}
27
27
  );
28
28
 
29
29
  return (
30
30
  <div className={className}>
31
- <div className="error-group__title" onClick={onClick} title={pattern}>
32
- <span className="error-group__name">{name}</span>
33
- <span className="error-group__count">&nbsp;({count})</span>
31
+ <div className="tests-group__title" onClick={onClick} title={pattern}>
32
+ <span className="tests-group__name">{name}</span>
33
+ <span className="tests-group__count">&nbsp;({`tests: ${testCount}, runs: ${resultCount}`})</span>
34
34
  </div>
35
35
  {body}
36
36
  </div>
@@ -0,0 +1,71 @@
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 GroupTestsItem from './item';
7
+ import {groupedTestsType} from './prop-types';
8
+ import * as actions from '../../modules/actions';
9
+ import {getParsedKeyToGroupTestsBy} from '../../modules/selectors/grouped-tests';
10
+
11
+ class GroupTestsList extends Component {
12
+ static propTypes = {
13
+ // from store
14
+ groupedTests: groupedTestsType.isRequired,
15
+ selectedGroupSection: PropTypes.string.isRequired,
16
+ selectedGroupKey: PropTypes.string.isRequired
17
+ };
18
+
19
+ state = {
20
+ activeGroupIndex: null
21
+ };
22
+
23
+ onGroupChange = (index) => {
24
+ const {groupedTests, selectedGroupSection, selectedGroupKey} = this.props;
25
+ const activeGroupIndex = this.state.activeGroupIndex === index ? null : index;
26
+ const isActive = activeGroupIndex !== null;
27
+
28
+ this.setState({activeGroupIndex}, () => {
29
+ const groups = groupedTests[selectedGroupSection].byKey[selectedGroupKey];
30
+ const {browserIds = [], resultIds = []} = isActive ? groups[index] : {};
31
+
32
+ this.props.actions.toggleTestsGroup({browserIds, resultIds, isActive});
33
+ });
34
+ }
35
+
36
+ render() {
37
+ const {groupedTests, selectedGroupSection, selectedGroupKey} = this.props;
38
+ const groups = groupedTests[selectedGroupSection].byKey[selectedGroupKey];
39
+
40
+ const {activeGroupIndex} = this.state;
41
+
42
+ if (groups.length === 0) {
43
+ const msg = `No tests match the key "${selectedGroupKey}" in the section "${selectedGroupSection}". `
44
+ + `Try to clear "Group by" to see more results.`;
45
+
46
+ return <div className="grouped-tests">{msg}</div>;
47
+ }
48
+
49
+ return <div className="grouped-tests">
50
+ {groups.map((group, ind) => {
51
+ const isActive = ind === activeGroupIndex;
52
+
53
+ return <GroupTestsItem
54
+ key={group.name}
55
+ group={group}
56
+ isActive={isActive}
57
+ onClick={() => this.onGroupChange(ind)}
58
+ />;
59
+ })}
60
+ </div>;
61
+ }
62
+ }
63
+
64
+ export default connect(
65
+ (state) => {
66
+ const [selectedGroupSection, selectedGroupKey] = getParsedKeyToGroupTestsBy(state);
67
+
68
+ return {groupedTests: state.groupedTests, selectedGroupSection, selectedGroupKey};
69
+ },
70
+ (dispatch) => ({actions: bindActionCreators(actions, dispatch)})
71
+ )(GroupTestsList);
@@ -0,0 +1,12 @@
1
+ import PropTypes from 'prop-types';
2
+
3
+ export const groupedTestsType = PropTypes.shape({
4
+ result: PropTypes.shape({
5
+ byKey: PropTypes.object.isRequired,
6
+ allKeys: PropTypes.array.isRequired
7
+ }).isRequired,
8
+ meta: PropTypes.shape({
9
+ byKey: PropTypes.object.isRequired,
10
+ allKeys: PropTypes.array.isRequired
11
+ }).isRequired
12
+ });
@@ -2,22 +2,22 @@ import React, {Component} from 'react';
2
2
  import {connect} from 'react-redux';
3
3
  import PropTypes from 'prop-types';
4
4
 
5
- import ErrorGroupsList from './error-groups/list';
5
+ import GroupTestsList from './group-tests/list';
6
6
  import Suites from './suites';
7
7
 
8
8
  class MainTree extends Component {
9
9
  static propTypes = {
10
10
  // from store
11
- groupByError: PropTypes.bool.isRequired
11
+ keyToGroupTestsBy: PropTypes.string.isRequired
12
12
  }
13
13
 
14
14
  render() {
15
- return this.props.groupByError
16
- ? <ErrorGroupsList />
15
+ return this.props.keyToGroupTestsBy
16
+ ? <GroupTestsList key={this.props.keyToGroupTestsBy} />
17
17
  : <Suites />;
18
18
  }
19
19
  }
20
20
 
21
21
  export default connect(
22
- ({view: {groupByError}}) => ({groupByError})
22
+ ({view: {keyToGroupTestsBy}}) => ({keyToGroupTestsBy})
23
23
  )(MainTree);
@@ -2,6 +2,7 @@ import React, {Component} from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
4
  import {connect} from 'react-redux';
5
+ import {get} from 'lodash';
5
6
  import {isNoRefImageError, isAssertViewError} from '../../modules/utils';
6
7
  import {ERROR} from '../../../constants/test-statuses';
7
8
  import {isFailStatus} from '../../../common-utils';
@@ -14,17 +15,20 @@ class RetrySwitcherItem extends Component {
14
15
  title: PropTypes.string,
15
16
  // from store
16
17
  status: PropTypes.string.isRequired,
17
- attempt: PropTypes.number.isRequired
18
+ attempt: PropTypes.number.isRequired,
19
+ keyToGroupTestsBy: PropTypes.string.isRequired,
20
+ matchedSelectedGroup: PropTypes.bool.isRequired
18
21
  }
19
22
 
20
23
  render() {
21
- const {status, attempt, isActive, onClick, title} = this.props;
24
+ const {status, attempt, isActive, onClick, title, keyToGroupTestsBy, matchedSelectedGroup} = this.props;
22
25
 
23
26
  const className = classNames(
24
27
  'state-button',
25
28
  'tab-switcher__button',
26
29
  {[`tab-switcher__button_status_${status}`]: status},
27
- {'tab-switcher__button_active': isActive}
30
+ {'tab-switcher__button_active': isActive},
31
+ {'tab-switcher__button_non-matched': keyToGroupTestsBy && !matchedSelectedGroup}
28
32
  );
29
33
 
30
34
  return <button title={title} className={className} onClick={onClick}>{attempt + 1}</button>;
@@ -32,13 +36,17 @@ class RetrySwitcherItem extends Component {
32
36
  }
33
37
 
34
38
  export default connect(
35
- ({tree}, {resultId}) => {
39
+ ({tree, view: {keyToGroupTestsBy}}, {resultId}) => {
36
40
  const result = tree.results.byId[resultId];
41
+ const matchedSelectedGroup = get(tree.results.stateById[resultId], 'matchedSelectedGroup', false);
37
42
  const {status, attempt, error} = result;
38
43
 
39
- return hasScreenAndAssertErrors(status, error)
40
- ? {status: `${status}_${ERROR}`, attempt}
41
- : {status, attempt};
44
+ return {
45
+ status: hasScreenAndAssertErrors(status, error) ? `${status}_${ERROR}` : status,
46
+ attempt,
47
+ keyToGroupTestsBy,
48
+ matchedSelectedGroup
49
+ };
42
50
  }
43
51
  )(RetrySwitcherItem);
44
52
 
@@ -1,6 +1,7 @@
1
1
  import React, {Component} from 'react';
2
2
  import {connect} from 'react-redux';
3
3
  import {bindActionCreators} from 'redux';
4
+ import {isNumber} from 'lodash';
4
5
  import PropTypes from 'prop-types';
5
6
  import RetrySwitcher from '../../retry-switcher';
6
7
  import ControlButton from '../../controls/control-button';
@@ -98,10 +99,14 @@ class Body extends Component {
98
99
 
99
100
  export default connect(
100
101
  ({gui, running, view: {retryIndex: viewRetryIndex}, tree}, {browserId}) => {
101
- const {retryIndex: browserRetryIndex} = tree.browsers.stateById[browserId] || {};
102
- const retryIndex = typeof viewRetryIndex === 'number'
103
- ? Math.min(viewRetryIndex, browserRetryIndex)
104
- : browserRetryIndex;
102
+ const {retryIndex: browserRetryIndex, lastMatchedRetryIndex} = tree.browsers.stateById[browserId] || {};
103
+ let retryIndex;
104
+
105
+ if (typeof viewRetryIndex === 'number') {
106
+ retryIndex = Math.min(viewRetryIndex, browserRetryIndex);
107
+ } else {
108
+ retryIndex = isNumber(lastMatchedRetryIndex) ? lastMatchedRetryIndex : browserRetryIndex;
109
+ }
105
110
 
106
111
  return {gui, running, retryIndex};
107
112
  },
@@ -39,8 +39,7 @@ class BrowserTitle extends Component {
39
39
  strictMatchFilter: true,
40
40
  retryIndex,
41
41
  viewModes: viewModes.ALL,
42
- expand: EXPAND_ALL,
43
- groupByError: false
42
+ expand: EXPAND_ALL
44
43
  });
45
44
  }
46
45