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.
- package/CHANGELOG.md +41 -0
- package/README.md +35 -3
- package/lib/config/index.js +17 -6
- package/lib/constants/defaults.js +2 -1
- package/lib/constants/diff-modes.js +32 -0
- package/lib/constants/group-tests.js +7 -0
- package/lib/constants/plugin-events.js +2 -1
- package/lib/server-utils.js +1 -1
- package/lib/static/components/bottom-progress-bar/index.js +5 -1
- package/lib/static/components/controls/common-controls.js +19 -20
- package/lib/static/components/controls/controls.less +0 -31
- package/lib/static/components/controls/selects/control.js +51 -0
- package/lib/static/components/controls/selects/group-tests.js +94 -0
- package/lib/static/components/controls/selects/index.styl +58 -0
- package/lib/static/components/{error-groups → group-tests}/item.js +8 -8
- package/lib/static/components/group-tests/list.js +71 -0
- package/lib/static/components/group-tests/prop-types.js +12 -0
- package/lib/static/components/icons/arrows-move.js +24 -0
- package/lib/static/components/main-tree.js +5 -5
- package/lib/static/components/modals/screenshot-accepter/body.js +4 -12
- package/lib/static/components/modals/screenshot-accepter/header.js +3 -32
- package/lib/static/components/retry-switcher/item.js +15 -7
- package/lib/static/components/section/body/index.js +9 -4
- package/lib/static/components/section/title/browser.js +1 -2
- package/lib/static/components/state/index.js +2 -9
- package/lib/static/components/state/{diff-circle.js → screenshot/diff-circle.js} +1 -1
- package/lib/static/components/state/screenshot/full.js +28 -0
- package/lib/static/components/state/{screenshot.js → screenshot/resized.js} +28 -30
- package/lib/static/components/state/screenshot/with-encode-uri.js +44 -0
- package/lib/static/components/state/screenshot/with-synced-scale.js +116 -0
- package/lib/static/components/state/state-error.js +3 -3
- package/lib/static/components/state/state-fail/index.js +142 -0
- package/lib/static/components/state/state-fail/index.styl +31 -0
- package/lib/static/components/state/state-fail/onion-skin-diff/index.js +43 -0
- package/lib/static/components/state/state-fail/onion-skin-diff/index.styl +19 -0
- package/lib/static/components/state/state-fail/prop-types.js +16 -0
- package/lib/static/components/state/state-fail/swipe-diff/index.js +138 -0
- package/lib/static/components/state/state-fail/swipe-diff/index.styl +82 -0
- package/lib/static/components/state/state-fail/switch-diff/index.js +36 -0
- package/lib/static/components/state/state-fail/switch-diff/index.styl +12 -0
- package/lib/static/components/state/state-success.js +2 -2
- package/lib/static/gui.min.css +205 -27
- package/lib/static/gui.min.js +16 -16
- package/lib/static/modules/action-names.js +9 -5
- package/lib/static/modules/actions.js +29 -5
- package/lib/static/modules/custom-queries.js +1 -2
- package/lib/static/modules/default-state.js +14 -4
- package/lib/static/modules/middlewares/local-storage.js +1 -3
- package/lib/static/modules/middlewares/metrika.js +10 -13
- package/lib/static/modules/reducers/grouped-tests/by/meta.js +31 -0
- package/lib/static/modules/reducers/grouped-tests/by/result.js +57 -0
- package/lib/static/modules/reducers/grouped-tests/helpers.js +91 -0
- package/lib/static/modules/reducers/grouped-tests/index.js +52 -0
- package/lib/static/modules/reducers/index.js +2 -2
- package/lib/static/modules/reducers/tree/index.js +38 -12
- package/lib/static/modules/reducers/tree/nodes/browsers.js +9 -10
- package/lib/static/modules/reducers/tree/nodes/results.js +16 -0
- package/lib/static/modules/reducers/tree/nodes/suites.js +1 -1
- package/lib/static/modules/reducers/view.js +29 -22
- package/lib/static/modules/selectors/grouped-tests.js +8 -0
- package/lib/static/modules/selectors/view.js +1 -0
- package/lib/static/modules/utils.js +19 -1
- package/lib/static/report.min.css +205 -27
- package/lib/static/report.min.js +16 -16
- package/lib/static/styles.css +71 -42
- package/lib/test-adapter.js +11 -2
- package/package.json +4 -2
- package/webpack.common.js +7 -0
- package/lib/static/components/controls/view-select.js +0 -50
- package/lib/static/components/error-groups/list.js +0 -56
- package/lib/static/components/state/state-fail.js +0 -56
- package/lib/static/modules/group-errors.js +0 -101
- package/lib/static/modules/reducers/grouped-errors.js +0 -43
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,47 @@
|
|
|
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
|
+
|
|
16
|
+
<a name="9.1.1"></a>
|
|
17
|
+
## [9.1.1](https://github.com/gemini-testing/html-reporter/compare/v9.1.0...v9.1.1) (2022-08-04)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
<a name="9.1.0"></a>
|
|
22
|
+
# [9.1.0](https://github.com/gemini-testing/html-reporter/compare/v9.0.0...v9.1.0) (2022-08-04)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* add TEST_SCREENSHOTS_SAVED event ([e50ab0f](https://github.com/gemini-testing/html-reporter/commit/e50ab0f))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
<a name="9.0.0"></a>
|
|
32
|
+
# [9.0.0](https://github.com/gemini-testing/html-reporter/compare/v8.4.4...v9.0.0) (2022-05-20)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Features
|
|
36
|
+
|
|
37
|
+
* add new modes to view image diffs ([318c3b4](https://github.com/gemini-testing/html-reporter/commit/318c3b4))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### BREAKING CHANGES
|
|
41
|
+
|
|
42
|
+
* remove "scaleImages" option from config
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
5
46
|
<a name="8.4.4"></a>
|
|
6
47
|
## [8.4.4](https://github.com/gemini-testing/html-reporter/compare/v8.4.3...v8.4.4) (2022-04-29)
|
|
7
48
|
|
package/README.md
CHANGED
|
@@ -41,12 +41,20 @@ directory.
|
|
|
41
41
|
* `all` - show all tests. Default value.
|
|
42
42
|
* `failed` - show only failed tests.
|
|
43
43
|
|
|
44
|
+
* **diffMode** (optional) - `String` - default diff mode. Available values are:
|
|
45
|
+
|
|
46
|
+
* `3-up` - show all images (expected, actual, diff) in column. Default value;
|
|
47
|
+
* `3-up-scaled` - show all images in row (fit into page width);
|
|
48
|
+
* `only-diff` - show only diff image;
|
|
49
|
+
* `switch` - mode with ability to switch between expected and actual images (use click on mouse in images field to switch);
|
|
50
|
+
* `swipe` - mode with ability to move divider between expected and actual images;
|
|
51
|
+
* `onion-skin` - mode with ability to change the transparency of actual image.
|
|
52
|
+
|
|
44
53
|
* **baseHost** (optional) - `String` - it changes original host for view in the browser; by default original host does not change
|
|
45
|
-
* **scaleImages** (optional) – `Boolean` – fit images into page width; `false` by default.
|
|
46
54
|
* **errorPatterns** (optional) - `Array` - error message patterns are used:
|
|
47
55
|
|
|
48
56
|
* to show more understandable information about matched error;
|
|
49
|
-
* in 'Group by error'
|
|
57
|
+
* in 'Group by' mode with selected 'error' key.
|
|
50
58
|
|
|
51
59
|
Array elements must be one of the types:
|
|
52
60
|
|
|
@@ -58,7 +66,7 @@ directory.
|
|
|
58
66
|
* *name* of error pattern will be displayed as title of error message and original error message will be hidden under details;
|
|
59
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>`.
|
|
60
68
|
|
|
61
|
-
In 'Group by error'
|
|
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.
|
|
62
70
|
|
|
63
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'}.
|
|
64
72
|
* **saveFormat** (**DEPRECATED**, optional) `String` - allows to specify the format, in which the results will be saved. Available values are:
|
|
@@ -526,6 +534,7 @@ Property name | Description
|
|
|
526
534
|
Event | Description
|
|
527
535
|
------------------------- | -------------
|
|
528
536
|
`DATABASE_CREATED` | Will be triggered after sqlite database is created. The handler accepts a database instance. The event is synchronous.
|
|
537
|
+
`TEST_SCREENSHOTS_SAVED` | Will be triggered after test screenshots were saved. The handler accepts test id and screenshots info. The event is synchronous.
|
|
529
538
|
|
|
530
539
|
### events
|
|
531
540
|
|
|
@@ -546,6 +555,29 @@ module.exports = (hermione, opts) => {
|
|
|
546
555
|
};
|
|
547
556
|
```
|
|
548
557
|
|
|
558
|
+
Example of a subscription to an event `TEST_SCREENSHOTS_SAVED`:
|
|
559
|
+
|
|
560
|
+
```js
|
|
561
|
+
hermione.htmlReporter.on(hermione.htmlReporter.events.TEST_SCREENSHOTS_SAVED, ({testId, attempt, imagesInfo}) => {
|
|
562
|
+
console.log(`Screenshots for test "${testId}" (attempt #${attempt}) were saved:`, imagesInfo);
|
|
563
|
+
/* Expected output:
|
|
564
|
+
Screenshots for test "Feature Test.chrome-desktop" (attempt #0) were saved:
|
|
565
|
+
[
|
|
566
|
+
{
|
|
567
|
+
stateName: 'plain',
|
|
568
|
+
refImg: { path: '...', size: { width: 400, height: 200 } },
|
|
569
|
+
status: 'fail',
|
|
570
|
+
error: undefined,
|
|
571
|
+
diffClusters: [...],
|
|
572
|
+
expectedImg: { path: '...', size: { width: 400, height: 200 } }
|
|
573
|
+
actualImg: { path: '...', size: { width: 400, height: 200 } }
|
|
574
|
+
diffImg: { path: '...', size: { width: 400, height: 200 } }
|
|
575
|
+
}
|
|
576
|
+
]
|
|
577
|
+
*/
|
|
578
|
+
});
|
|
579
|
+
```
|
|
580
|
+
|
|
549
581
|
### addExtraItem
|
|
550
582
|
|
|
551
583
|
Adds item to html report as link:
|
package/lib/config/index.js
CHANGED
|
@@ -6,6 +6,7 @@ const chalk = require('chalk');
|
|
|
6
6
|
|
|
7
7
|
const {logger} = require('../common-utils');
|
|
8
8
|
const {config: configDefaults} = require('../constants/defaults');
|
|
9
|
+
const diffModes = require('../constants/diff-modes');
|
|
9
10
|
const saveFormats = require('../constants/save-formats');
|
|
10
11
|
const {assertCustomGui} = require('./custom-gui-asserts');
|
|
11
12
|
|
|
@@ -114,6 +115,18 @@ const assertPluginDescription = (description) => {
|
|
|
114
115
|
return true;
|
|
115
116
|
};
|
|
116
117
|
|
|
118
|
+
const assertDiffMode = (diffMode) => {
|
|
119
|
+
if (!_.isString(diffMode)) {
|
|
120
|
+
throw new Error(`"diffMode" option must be a string, but got ${typeof diffMode}`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const availableValues = Object.values(diffModes).map(v => v.id);
|
|
124
|
+
|
|
125
|
+
if (!availableValues.includes(diffMode)) {
|
|
126
|
+
throw new Error(`"diffMode" must be one of "${availableValues.join('", "')}", but got "${diffMode}"`);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
117
130
|
const mapErrorPatterns = (errorPatterns) => {
|
|
118
131
|
return errorPatterns.map(patternInfo => {
|
|
119
132
|
return _.isString(patternInfo)
|
|
@@ -156,16 +169,14 @@ const getParser = () => {
|
|
|
156
169
|
defaultValue: configDefaults.defaultView,
|
|
157
170
|
validate: assertString('defaultView')
|
|
158
171
|
}),
|
|
172
|
+
diffMode: option({
|
|
173
|
+
defaultValue: configDefaults.diffMode,
|
|
174
|
+
validate: assertDiffMode
|
|
175
|
+
}),
|
|
159
176
|
baseHost: option({
|
|
160
177
|
defaultValue: configDefaults.baseHost,
|
|
161
178
|
validate: assertString('baseHost')
|
|
162
179
|
}),
|
|
163
|
-
scaleImages: option({
|
|
164
|
-
defaultValue: configDefaults.scaleImages,
|
|
165
|
-
parseEnv: JSON.parse,
|
|
166
|
-
parseCli: JSON.parse,
|
|
167
|
-
validate: assertBoolean('scaleImages')
|
|
168
|
-
}),
|
|
169
180
|
lazyLoadOffset: option({
|
|
170
181
|
defaultValue: configDefaults.lazyLoadOffset,
|
|
171
182
|
validate: (value) => _.isNull(value) || deprecationWarning('lazyLoadOffset')
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const diffModes = require('./diff-modes');
|
|
3
4
|
const viewModes = require('./view-modes');
|
|
4
5
|
|
|
5
6
|
module.exports = {
|
|
@@ -8,8 +9,8 @@ module.exports = {
|
|
|
8
9
|
saveErrorDetails: false,
|
|
9
10
|
commandsWithShortHistory: [],
|
|
10
11
|
defaultView: viewModes.ALL,
|
|
12
|
+
diffMode: diffModes.THREE_UP.id,
|
|
11
13
|
baseHost: '',
|
|
12
|
-
scaleImages: false,
|
|
13
14
|
lazyLoadOffset: null,
|
|
14
15
|
errorPatterns: [],
|
|
15
16
|
metaInfoBaseUrls: {},
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
THREE_UP: {
|
|
3
|
+
id: '3-up',
|
|
4
|
+
title: '3-up',
|
|
5
|
+
description: 'images in column'
|
|
6
|
+
},
|
|
7
|
+
THREE_UP_SCALED: {
|
|
8
|
+
id: '3-up-scaled',
|
|
9
|
+
title: '3-up scaled',
|
|
10
|
+
description: 'scaled images in row'
|
|
11
|
+
},
|
|
12
|
+
ONLY_DIFF: {
|
|
13
|
+
id: 'only-diff',
|
|
14
|
+
title: 'Only diff',
|
|
15
|
+
description: 'click on image to see area with diff'
|
|
16
|
+
},
|
|
17
|
+
SWITCH: {
|
|
18
|
+
id: 'switch',
|
|
19
|
+
title: 'Switch',
|
|
20
|
+
description: 'click on image to switch'
|
|
21
|
+
},
|
|
22
|
+
SWIPE: {
|
|
23
|
+
id: 'swipe',
|
|
24
|
+
title: 'Swipe',
|
|
25
|
+
description: 'move divider'
|
|
26
|
+
},
|
|
27
|
+
ONION_SKIN: {
|
|
28
|
+
id: 'onion-skin',
|
|
29
|
+
title: 'Onion skin',
|
|
30
|
+
description: 'move slider'
|
|
31
|
+
}
|
|
32
|
+
};
|
package/lib/server-utils.js
CHANGED
|
@@ -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'>
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
'use strict';
|
|
2
1
|
import React, {Component} from 'react';
|
|
3
2
|
import {bindActionCreators} from 'redux';
|
|
4
3
|
import {connect} from 'react-redux';
|
|
4
|
+
import {capitalize} from 'lodash';
|
|
5
5
|
import * as actions from '../../modules/actions';
|
|
6
6
|
import ControlButton from './control-button';
|
|
7
|
-
import
|
|
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';
|
|
12
|
+
import diffModes from '../../../constants/diff-modes';
|
|
11
13
|
import {EXPAND_ALL, COLLAPSE_ALL, EXPAND_ERRORS, EXPAND_RETRIES} from '../../../constants/expand-modes';
|
|
12
14
|
|
|
13
15
|
class ControlButtons extends Component {
|
|
@@ -16,10 +18,12 @@ class ControlButtons extends Component {
|
|
|
16
18
|
|
|
17
19
|
return (
|
|
18
20
|
<div className="common-controls">
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
{
|
|
22
|
-
|
|
21
|
+
<ControlSelect
|
|
22
|
+
label="Show tests"
|
|
23
|
+
value={view.viewMode}
|
|
24
|
+
handler={actions.changeViewMode}
|
|
25
|
+
options = {Object.values(viewModes).map((value) => ({value, text: capitalize(value)}))}
|
|
26
|
+
/>
|
|
23
27
|
<div className="control-group">
|
|
24
28
|
<ControlButton
|
|
25
29
|
label="Expand all"
|
|
@@ -46,25 +50,20 @@ class ControlButtons extends Component {
|
|
|
46
50
|
handler={actions.expandRetries}
|
|
47
51
|
/>
|
|
48
52
|
</div>
|
|
53
|
+
<GroupTestsSelect />
|
|
49
54
|
<ControlButton
|
|
50
55
|
label="Show skipped"
|
|
51
56
|
isActive={view.showSkipped}
|
|
52
57
|
handler={actions.toggleSkipped}
|
|
53
58
|
/>
|
|
54
|
-
<
|
|
55
|
-
label="
|
|
56
|
-
|
|
57
|
-
handler={actions.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
handler={actions.toggleScaleImages}
|
|
63
|
-
/>
|
|
64
|
-
<ControlButton
|
|
65
|
-
label="Group by error"
|
|
66
|
-
isActive={Boolean(view.groupByError)}
|
|
67
|
-
handler={actions.toggleGroupByError}
|
|
59
|
+
<ControlSelect
|
|
60
|
+
label="Diff mode"
|
|
61
|
+
value={view.diffMode}
|
|
62
|
+
handler={actions.changeDiffMode}
|
|
63
|
+
options = {Object.values(diffModes).map((dm) => {
|
|
64
|
+
return {value: dm.id, text: dm.title};
|
|
65
|
+
})}
|
|
66
|
+
extendClassNames="diff-mode"
|
|
68
67
|
/>
|
|
69
68
|
<BaseHostInput/>
|
|
70
69
|
<MenuBar />
|
|
@@ -62,34 +62,3 @@
|
|
|
62
62
|
border-color: #555;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
.viewmode {
|
|
67
|
-
width: 115px;
|
|
68
|
-
display: inline-block;
|
|
69
|
-
margin-right: 15px;
|
|
70
|
-
margin-bottom: 15px;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.viewmode .ui.fluid.dropdown {
|
|
74
|
-
font-size: 11px;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.viewmode .ui.selection.dropdown {
|
|
78
|
-
padding: 6px;
|
|
79
|
-
min-height: 25px;
|
|
80
|
-
border: 1px solid #ccc;
|
|
81
|
-
border-radius: 2px;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.viewmode .ui.selection.dropdown:hover {
|
|
85
|
-
border: 1px solid #555;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.viewmode .ui.selection.dropdown>.dropdown.icon {
|
|
89
|
-
top: 5px;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.viewmode .ui.selection.active.dropdown:hover,
|
|
93
|
-
.viewmode .ui.selection.active.dropdown .menu {
|
|
94
|
-
border-color: #ffd947;
|
|
95
|
-
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, {Component} from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import {Label, Dropdown} from 'semantic-ui-react';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
|
|
6
|
+
import './index.styl';
|
|
7
|
+
|
|
8
|
+
export default class ControlSelect extends Component {
|
|
9
|
+
static propTypes = {
|
|
10
|
+
label: PropTypes.string.isRequired,
|
|
11
|
+
value: PropTypes.string.isRequired,
|
|
12
|
+
handler: PropTypes.func.isRequired,
|
|
13
|
+
options: PropTypes.arrayOf(PropTypes.shape({
|
|
14
|
+
value: PropTypes.string,
|
|
15
|
+
text: PropTypes.string
|
|
16
|
+
})).isRequired,
|
|
17
|
+
extendClassNames: PropTypes.oneOfType([PropTypes.array, PropTypes.string])
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
_onChange = (_, dom) => {
|
|
21
|
+
this.props.handler(dom.value);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
render() {
|
|
25
|
+
const {value, label, options, extendClassNames} = this.props;
|
|
26
|
+
const formattedOpts = options.map(({value, text}) => ({
|
|
27
|
+
value,
|
|
28
|
+
text,
|
|
29
|
+
key: value
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
const className = classNames(
|
|
33
|
+
'select',
|
|
34
|
+
'select_type_control',
|
|
35
|
+
extendClassNames
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div className={className}>
|
|
40
|
+
<Label className="select__label">{label}</Label>
|
|
41
|
+
<Dropdown
|
|
42
|
+
className="select__dropdown"
|
|
43
|
+
selection
|
|
44
|
+
options={formattedOpts}
|
|
45
|
+
value={value}
|
|
46
|
+
onChange={this._onChange}
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
.select
|
|
2
|
+
display: inline-flex
|
|
3
|
+
margin-right: 15px
|
|
4
|
+
margin-bottom: 15px
|
|
5
|
+
|
|
6
|
+
.select__label
|
|
7
|
+
font-size: 11px
|
|
8
|
+
margin: 0
|
|
9
|
+
padding: 0 5px
|
|
10
|
+
line-height: 25px
|
|
11
|
+
background-color: #e7e7e7
|
|
12
|
+
border-radius: 2px
|
|
13
|
+
border-top-right-radius: 0
|
|
14
|
+
border-bottom-right-radius: 0
|
|
15
|
+
|
|
16
|
+
.select__dropdown.ui.dropdown
|
|
17
|
+
min-height: 25px
|
|
18
|
+
min-width: 70px
|
|
19
|
+
font-size: 11px
|
|
20
|
+
line-height: 13px
|
|
21
|
+
padding: 5px
|
|
22
|
+
padding-right: 25px
|
|
23
|
+
border: 1px solid #ccc
|
|
24
|
+
border-radius: 2px
|
|
25
|
+
border-top-left-radius: 0
|
|
26
|
+
border-bottom-left-radius: 0
|
|
27
|
+
|
|
28
|
+
&:hover
|
|
29
|
+
border: 1px solid #555;
|
|
30
|
+
|
|
31
|
+
&.active
|
|
32
|
+
&:hover
|
|
33
|
+
.menu
|
|
34
|
+
border-color: #ffd947
|
|
35
|
+
|
|
36
|
+
.icon.dropdown
|
|
37
|
+
padding: 0
|
|
38
|
+
margin: 0
|
|
39
|
+
line-height: initial
|
|
40
|
+
|
|
41
|
+
&.diff-mode
|
|
42
|
+
.select__dropdown.ui.dropdown
|
|
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
|
|
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,
|
|
16
|
+
const {name, pattern, testCount, resultCount} = group;
|
|
17
17
|
|
|
18
18
|
const body = isActive ? (
|
|
19
|
-
<div className="
|
|
19
|
+
<div className="tests-group__body">
|
|
20
20
|
<Suites />
|
|
21
21
|
</div>
|
|
22
22
|
) : null;
|
|
23
23
|
|
|
24
24
|
const className = classNames(
|
|
25
|
-
'
|
|
26
|
-
{'
|
|
25
|
+
'tests-group',
|
|
26
|
+
{'tests-group_collapsed': !isActive}
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
30
|
<div className={className}>
|
|
31
|
-
<div className="
|
|
32
|
-
<span className="
|
|
33
|
-
<span className="
|
|
31
|
+
<div className="tests-group__title" onClick={onClick} title={pattern}>
|
|
32
|
+
<span className="tests-group__name">{name}</span>
|
|
33
|
+
<span className="tests-group__count"> ({`tests: ${testCount}, runs: ${resultCount}`})</span>
|
|
34
34
|
</div>
|
|
35
35
|
{body}
|
|
36
36
|
</div>
|