html-reporter 8.4.2 → 9.0.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 +32 -0
- package/README.md +9 -1
- package/hermione.js +1 -1
- package/lib/config/index.js +17 -6
- package/lib/constants/defaults.js +2 -1
- package/lib/constants/diff-modes.js +32 -0
- package/lib/gui/tool-runner/report-subscriber.js +1 -1
- package/lib/server-utils.js +1 -1
- package/lib/static/components/controls/common-controls.js +17 -15
- package/lib/static/components/controls/control-select/index.js +50 -0
- package/lib/static/components/controls/control-select/index.styl +44 -0
- package/lib/static/components/controls/controls.less +0 -31
- package/lib/static/components/icons/arrows-move.js +24 -0
- 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/state/index.js +6 -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 +9 -5
- 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 +192 -27
- package/lib/static/gui.min.js +16 -16
- package/lib/static/modules/action-names.js +6 -2
- package/lib/static/modules/actions.js +27 -3
- package/lib/static/modules/default-state.js +2 -2
- package/lib/static/modules/middlewares/local-storage.js +1 -2
- package/lib/static/modules/middlewares/metrika.js +6 -2
- package/lib/static/modules/reducers/view.js +27 -12
- package/lib/static/modules/utils.js +1 -1
- package/lib/static/report.min.css +192 -27
- package/lib/static/report.min.js +16 -16
- package/lib/static/styles.css +3 -11
- package/lib/test-adapter.js +1 -1
- package/package.json +3 -1
- package/webpack.common.js +7 -0
- package/lib/static/components/controls/view-select.js +0 -50
- package/lib/static/components/state/state-fail.js +0 -56
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,38 @@
|
|
|
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.0.0"></a>
|
|
6
|
+
# [9.0.0](https://github.com/gemini-testing/html-reporter/compare/v8.4.4...v9.0.0) (2022-05-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add new modes to view image diffs ([318c3b4](https://github.com/gemini-testing/html-reporter/commit/318c3b4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* remove "scaleImages" option from config
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
<a name="8.4.4"></a>
|
|
21
|
+
## [8.4.4](https://github.com/gemini-testing/html-reporter/compare/v8.4.3...v8.4.4) (2022-04-29)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
<a name="8.4.3"></a>
|
|
26
|
+
## [8.4.3](https://github.com/gemini-testing/html-reporter/compare/v8.4.2...v8.4.3) (2022-04-26)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* **state:** hide control buttons ([0b7c79f](https://github.com/gemini-testing/html-reporter/commit/0b7c79f))
|
|
32
|
+
* **state-error:** hide error info for "AssertViewError" ([0711226](https://github.com/gemini-testing/html-reporter/commit/0711226))
|
|
33
|
+
* **static:** fix error when accept the screenshot ([06cfc61](https://github.com/gemini-testing/html-reporter/commit/06cfc61))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
5
37
|
<a name="8.4.2"></a>
|
|
6
38
|
## [8.4.2](https://github.com/gemini-testing/html-reporter/compare/v8.4.1...v8.4.2) (2022-03-31)
|
|
7
39
|
|
package/README.md
CHANGED
|
@@ -41,8 +41,16 @@ 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;
|
package/hermione.js
CHANGED
|
@@ -39,7 +39,7 @@ async function prepare(hermione, reportBuilder, pluginConfig) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
if (formattedResult.screenshot) {
|
|
42
|
-
actions.push(formattedResult.
|
|
42
|
+
actions.push(formattedResult.saveErrorScreenshot(reportPath));
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
await Promise.all(actions);
|
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
|
+
};
|
|
@@ -17,7 +17,7 @@ module.exports = (hermione, reportBuilder, client, reportPath) => {
|
|
|
17
17
|
const actions = [formattedResult.saveTestImages(reportPath, workers)];
|
|
18
18
|
|
|
19
19
|
if (formattedResult.screenshot) {
|
|
20
|
-
actions.push(formattedResult.
|
|
20
|
+
actions.push(formattedResult.saveErrorScreenshot(reportPath));
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
if (formattedResult.errorDetails) {
|
package/lib/server-utils.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
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 './control-select';
|
|
8
8
|
import BaseHostInput from './base-host-input';
|
|
9
9
|
import MenuBar from './menu-bar';
|
|
10
10
|
import viewModes from '../../../constants/view-modes';
|
|
11
|
+
import diffModes from '../../../constants/diff-modes';
|
|
11
12
|
import {EXPAND_ALL, COLLAPSE_ALL, EXPAND_ERRORS, EXPAND_RETRIES} from '../../../constants/expand-modes';
|
|
12
13
|
|
|
13
14
|
class ControlButtons extends Component {
|
|
@@ -16,10 +17,12 @@ class ControlButtons extends Component {
|
|
|
16
17
|
|
|
17
18
|
return (
|
|
18
19
|
<div className="common-controls">
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
{
|
|
22
|
-
|
|
20
|
+
<ControlSelect
|
|
21
|
+
label="Show tests"
|
|
22
|
+
value={view.viewMode}
|
|
23
|
+
handler={actions.changeViewMode}
|
|
24
|
+
options = {Object.values(viewModes).map((value) => ({value, text: capitalize(value)}))}
|
|
25
|
+
/>
|
|
23
26
|
<div className="control-group">
|
|
24
27
|
<ControlButton
|
|
25
28
|
label="Expand all"
|
|
@@ -51,15 +54,14 @@ class ControlButtons extends Component {
|
|
|
51
54
|
isActive={view.showSkipped}
|
|
52
55
|
handler={actions.toggleSkipped}
|
|
53
56
|
/>
|
|
54
|
-
<
|
|
55
|
-
label="
|
|
56
|
-
|
|
57
|
-
handler={actions.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
handler={actions.toggleScaleImages}
|
|
57
|
+
<ControlSelect
|
|
58
|
+
label="Diff mode"
|
|
59
|
+
value={view.diffMode}
|
|
60
|
+
handler={actions.changeDiffMode}
|
|
61
|
+
options = {Object.values(diffModes).map((dm) => {
|
|
62
|
+
return {value: dm.id, text: dm.title};
|
|
63
|
+
})}
|
|
64
|
+
extendClassNames="diff-mode"
|
|
63
65
|
/>
|
|
64
66
|
<ControlButton
|
|
65
67
|
label="Group by error"
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
'control-select',
|
|
34
|
+
extendClassNames
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div className={className}>
|
|
39
|
+
<Label className="control-select__label">{label}</Label>
|
|
40
|
+
<Dropdown
|
|
41
|
+
className="control-select__dropdown"
|
|
42
|
+
selection
|
|
43
|
+
options={formattedOpts}
|
|
44
|
+
value={value}
|
|
45
|
+
onChange={this._onChange}
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
.control-select
|
|
2
|
+
display: inline-flex
|
|
3
|
+
margin-right: 15px
|
|
4
|
+
margin-bottom: 15px
|
|
5
|
+
|
|
6
|
+
.control-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
|
+
.control-select__dropdown.ui.dropdown
|
|
17
|
+
min-height: 25px
|
|
18
|
+
min-width: 60px
|
|
19
|
+
font-size: 11px
|
|
20
|
+
line-height: 13px
|
|
21
|
+
padding: 5px
|
|
22
|
+
border: 1px solid #ccc
|
|
23
|
+
border-radius: 2px
|
|
24
|
+
border-top-left-radius: 0
|
|
25
|
+
border-bottom-left-radius: 0
|
|
26
|
+
|
|
27
|
+
&:hover
|
|
28
|
+
border: 1px solid #555;
|
|
29
|
+
|
|
30
|
+
&.active
|
|
31
|
+
&:hover
|
|
32
|
+
.menu
|
|
33
|
+
border-color: #ffd947
|
|
34
|
+
|
|
35
|
+
.icon
|
|
36
|
+
top: 50%
|
|
37
|
+
right: 10px
|
|
38
|
+
padding: 0
|
|
39
|
+
margin: 0
|
|
40
|
+
transform: translateY(-50%)
|
|
41
|
+
|
|
42
|
+
&.diff-mode
|
|
43
|
+
.control-select__dropdown.ui.dropdown
|
|
44
|
+
min-width: 90px
|
|
@@ -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,24 @@
|
|
|
1
|
+
import React, {Component} from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
export default class ArrowsMove extends Component {
|
|
5
|
+
static propTypes = {
|
|
6
|
+
width: PropTypes.number,
|
|
7
|
+
height: PropTypes.number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static defaultProps = {
|
|
11
|
+
width: 100,
|
|
12
|
+
height: 100
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
render() {
|
|
16
|
+
const {width, height} = this.props;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<svg className="arrows-move" width={width} height={height} viewBox={`-8 -3 16 6`} fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
20
|
+
<path className="arrows-move__icon" d="M -5 -2 L -7 0 L -5 2 M 5 -2 L 7 0 L 5 2" fill="none" vectorEffect="non-scaling-stroke" />
|
|
21
|
+
</svg>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React, {Component, Fragment} from 'react';
|
|
2
2
|
import {connect} from 'react-redux';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import
|
|
5
|
-
import Screenshot from '../../state/screenshot';
|
|
4
|
+
import ResizedScreenshot from '../../state/screenshot/resized';
|
|
6
5
|
import StateFail from '../../state/state-fail';
|
|
7
6
|
import {isNoRefImageError} from '../../../modules/utils';
|
|
8
7
|
|
|
@@ -16,20 +15,15 @@ class ScreenshotAccepterBody extends Component {
|
|
|
16
15
|
error: PropTypes.object
|
|
17
16
|
}),
|
|
18
17
|
// from store
|
|
19
|
-
scaleImages: PropTypes.bool.isRequired,
|
|
20
18
|
testName: PropTypes.string,
|
|
21
19
|
browserName: PropTypes.string
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
_renderImages() {
|
|
25
23
|
const {image} = this.props;
|
|
26
|
-
const className = classNames(
|
|
27
|
-
'image-box__container',
|
|
28
|
-
{'image-box__container_scale': this.props.scaleImages}
|
|
29
|
-
);
|
|
30
24
|
|
|
31
25
|
return (
|
|
32
|
-
<div className=
|
|
26
|
+
<div className='image-box__container'>
|
|
33
27
|
{
|
|
34
28
|
isNoRefImageError(image.error)
|
|
35
29
|
? this._renderImageBox('No reference image', image.actualImg)
|
|
@@ -43,7 +37,7 @@ class ScreenshotAccepterBody extends Component {
|
|
|
43
37
|
return (
|
|
44
38
|
<div className="image-box__image">
|
|
45
39
|
<div className="image-box__title">{label}</div>
|
|
46
|
-
<
|
|
40
|
+
<ResizedScreenshot image={image} />
|
|
47
41
|
</div>
|
|
48
42
|
);
|
|
49
43
|
}
|
|
@@ -80,13 +74,11 @@ class ScreenshotAccepterBody extends Component {
|
|
|
80
74
|
}
|
|
81
75
|
|
|
82
76
|
export default connect(
|
|
83
|
-
({tree
|
|
84
|
-
const {scaleImages} = view;
|
|
77
|
+
({tree}, {image}) => {
|
|
85
78
|
const result = image ? tree.results.byId[image.parentId] : {};
|
|
86
79
|
const browser = image ? tree.browsers.byId[result.parentId] : {};
|
|
87
80
|
|
|
88
81
|
return {
|
|
89
|
-
scaleImages,
|
|
90
82
|
testName: browser.parentId,
|
|
91
83
|
browserName: browser.name
|
|
92
84
|
};
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import React, {Component, Fragment} from 'react';
|
|
2
|
-
import {connect} from 'react-redux';
|
|
3
|
-
import {bindActionCreators} from 'redux';
|
|
4
2
|
import {GlobalHotKeys} from 'react-hotkeys';
|
|
5
3
|
import PropTypes from 'prop-types';
|
|
6
4
|
import {uniqBy} from 'lodash';
|
|
7
5
|
|
|
8
|
-
import * as actions from '../../../modules/actions';
|
|
9
6
|
import Arrow from '../../icons/arrow';
|
|
10
7
|
import ArrowsClose from '../../icons/arrows-close';
|
|
11
8
|
import ControlButton from '../../controls/control-button';
|
|
12
9
|
import RetrySwitcher from '../../retry-switcher';
|
|
13
10
|
|
|
14
|
-
class ScreenshotAccepterHeader extends Component {
|
|
11
|
+
export default class ScreenshotAccepterHeader extends Component {
|
|
15
12
|
static propTypes = {
|
|
16
13
|
images: PropTypes.arrayOf(PropTypes.shape({
|
|
17
14
|
id: PropTypes.string,
|
|
@@ -23,10 +20,7 @@ class ScreenshotAccepterHeader extends Component {
|
|
|
23
20
|
onClose: PropTypes.func.isRequired,
|
|
24
21
|
onRetryChange: PropTypes.func.isRequired,
|
|
25
22
|
onActiveImageChange: PropTypes.func.isRequired,
|
|
26
|
-
onScreenshotAccept: PropTypes.func.isRequired
|
|
27
|
-
// from store
|
|
28
|
-
showOnlyDiff: PropTypes.bool.isRequired,
|
|
29
|
-
scaleImages: PropTypes.bool.isRequired
|
|
23
|
+
onScreenshotAccept: PropTypes.func.isRequired
|
|
30
24
|
}
|
|
31
25
|
|
|
32
26
|
constructor(props) {
|
|
@@ -38,8 +32,6 @@ class ScreenshotAccepterHeader extends Component {
|
|
|
38
32
|
PREV_RETRY: ['left', 'a'],
|
|
39
33
|
NEXT_RETRY: ['right', 'd'],
|
|
40
34
|
ACCEPT_SCREENSHOT: ['space', 'enter'],
|
|
41
|
-
SHOW_ONLY_DIFF: 'shift+d',
|
|
42
|
-
SCALE_IMAGES: 'shift+s',
|
|
43
35
|
CLOSE_MODAL: 'escape',
|
|
44
36
|
IGNORE_META_UP: 'meta+up',
|
|
45
37
|
IGNORE_META_DOWN: 'meta+down',
|
|
@@ -51,8 +43,6 @@ class ScreenshotAccepterHeader extends Component {
|
|
|
51
43
|
PREV_RETRY: this.handlePrevRetry,
|
|
52
44
|
NEXT_RETRY: this.handleNextRetry,
|
|
53
45
|
ACCEPT_SCREENSHOT: this.handleScreenshotAccept,
|
|
54
|
-
SHOW_ONLY_DIFF: this.props.actions.toggleOnlyDiff,
|
|
55
|
-
SCALE_IMAGES: this.props.actions.toggleScaleImages,
|
|
56
46
|
CLOSE_MODAL: this.props.onClose,
|
|
57
47
|
IGNORE_META_UP: () => {},
|
|
58
48
|
IGNORE_META_DOWN: () => {},
|
|
@@ -102,7 +92,7 @@ class ScreenshotAccepterHeader extends Component {
|
|
|
102
92
|
}
|
|
103
93
|
|
|
104
94
|
render() {
|
|
105
|
-
const {images, stateNameImageIds, retryIndex, onClose, onRetryChange
|
|
95
|
+
const {images, stateNameImageIds, retryIndex, onClose, onRetryChange} = this.props;
|
|
106
96
|
const resultIds = uniqBy(images, 'id').map((image) => image.parentId);
|
|
107
97
|
const isArrowControlDisabed = stateNameImageIds.length <= 1;
|
|
108
98
|
|
|
@@ -141,20 +131,6 @@ class ScreenshotAccepterHeader extends Component {
|
|
|
141
131
|
retryIndex={retryIndex}
|
|
142
132
|
onChange={onRetryChange}
|
|
143
133
|
/>
|
|
144
|
-
<ControlButton
|
|
145
|
-
label="Show only diff"
|
|
146
|
-
title="Show only difference image (Shift+d)"
|
|
147
|
-
isSuiteControl={true}
|
|
148
|
-
isActive={showOnlyDiff}
|
|
149
|
-
handler={this.props.actions.toggleOnlyDiff}
|
|
150
|
-
/>
|
|
151
|
-
<ControlButton
|
|
152
|
-
label="Scale images"
|
|
153
|
-
title="Scale images in one line (Shift+s)"
|
|
154
|
-
isSuiteControl={true}
|
|
155
|
-
isActive={scaleImages}
|
|
156
|
-
handler={this.props.actions.toggleScaleImages}
|
|
157
|
-
/>
|
|
158
134
|
<ControlButton
|
|
159
135
|
label={<Fragment>
|
|
160
136
|
<ArrowsClose />
|
|
@@ -172,11 +148,6 @@ class ScreenshotAccepterHeader extends Component {
|
|
|
172
148
|
}
|
|
173
149
|
}
|
|
174
150
|
|
|
175
|
-
export default connect(
|
|
176
|
-
({view: {showOnlyDiff, scaleImages}}) => ({showOnlyDiff, scaleImages}),
|
|
177
|
-
(dispatch) => ({actions: bindActionCreators(actions, dispatch)})
|
|
178
|
-
)(ScreenshotAccepterHeader);
|
|
179
|
-
|
|
180
151
|
function getPrevIndex(currIndex, arrLength) {
|
|
181
152
|
return currIndex > 0 ? currIndex - 1 : arrLength - 1;
|
|
182
153
|
}
|
|
@@ -25,7 +25,6 @@ class State extends Component {
|
|
|
25
25
|
imageId: PropTypes.string,
|
|
26
26
|
// from store
|
|
27
27
|
gui: PropTypes.bool.isRequired,
|
|
28
|
-
scaleImages: PropTypes.bool.isRequired,
|
|
29
28
|
image: PropTypes.shape({
|
|
30
29
|
status: PropTypes.string,
|
|
31
30
|
error: PropTypes.object,
|
|
@@ -70,6 +69,10 @@ class State extends Component {
|
|
|
70
69
|
const isAcceptDisabled = !isAcceptable(node);
|
|
71
70
|
const isFindSameDiffDisabled = !isFailStatus(node.status);
|
|
72
71
|
|
|
72
|
+
if (isAcceptDisabled && isFindSameDiffDisabled && isScreenshotAccepterDisabled) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
|
|
73
76
|
return (
|
|
74
77
|
<div className="state-controls">
|
|
75
78
|
<ControlButton
|
|
@@ -138,17 +141,12 @@ class State extends Component {
|
|
|
138
141
|
: <StateFail image={image} />;
|
|
139
142
|
}
|
|
140
143
|
|
|
141
|
-
const className = classNames(
|
|
142
|
-
'image-box__container',
|
|
143
|
-
{'image-box__container_scale': this.props.scaleImages}
|
|
144
|
-
);
|
|
145
|
-
|
|
146
144
|
return (
|
|
147
145
|
<Fragment>
|
|
148
146
|
<hr className="tab__separator"/>
|
|
149
147
|
{this._getStateTitle()}
|
|
150
148
|
{this._drawControlButtons()}
|
|
151
|
-
{elem ? <div className=
|
|
149
|
+
{elem ? <div className='image-box__container'>{elem}</div> : null}
|
|
152
150
|
</Fragment>
|
|
153
151
|
);
|
|
154
152
|
}
|
|
@@ -159,7 +157,7 @@ export default connect(
|
|
|
159
157
|
const getLastImageByStateName = mkGetLastImageByStateName();
|
|
160
158
|
|
|
161
159
|
return (state, {imageId, result}) => {
|
|
162
|
-
const {gui, tree
|
|
160
|
+
const {gui, tree} = state;
|
|
163
161
|
const image = tree.images.byId[imageId] || {};
|
|
164
162
|
const shouldImageBeOpened = image.stateName ? tree.images.stateById[imageId].shouldBeOpened : true;
|
|
165
163
|
const node = imageId ? image : result;
|
|
@@ -172,7 +170,6 @@ export default connect(
|
|
|
172
170
|
|
|
173
171
|
return {
|
|
174
172
|
gui,
|
|
175
|
-
scaleImages,
|
|
176
173
|
image,
|
|
177
174
|
node,
|
|
178
175
|
shouldImageBeOpened,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React, {Component} from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import {keyframes} from 'styled-components';
|
|
6
|
-
import {CIRCLE_RADIUS} from '
|
|
6
|
+
import {CIRCLE_RADIUS} from '../../../../constants/defaults';
|
|
7
7
|
|
|
8
8
|
export default class DiffCircle extends Component {
|
|
9
9
|
static propTypes = {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
import React, {Component} from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import withEncodeUri from './with-encode-uri';
|
|
6
|
+
|
|
7
|
+
class FullScreenshot extends Component {
|
|
8
|
+
static propTypes = {
|
|
9
|
+
imgRef: PropTypes.shape({
|
|
10
|
+
current: PropTypes.instanceOf(Element)
|
|
11
|
+
}),
|
|
12
|
+
style: PropTypes.shape({
|
|
13
|
+
width: PropTypes.number,
|
|
14
|
+
opacity: PropTypes.number,
|
|
15
|
+
visibility: PropTypes.string
|
|
16
|
+
}),
|
|
17
|
+
// from withEncodeUri
|
|
18
|
+
imageUrl: PropTypes.string.isRequired
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
render() {
|
|
22
|
+
const {imageUrl, className, imgRef, style} = this.props;
|
|
23
|
+
|
|
24
|
+
return <img className={className} src={imageUrl} ref={imgRef} style={style} />;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default withEncodeUri(FullScreenshot);
|