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
|
@@ -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
|
+
});
|
|
@@ -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
|
+
}
|
|
@@ -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
|
|
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
|
-
|
|
11
|
+
keyToGroupTestsBy: PropTypes.string.isRequired
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
render() {
|
|
15
|
-
return this.props.
|
|
16
|
-
? <
|
|
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: {
|
|
22
|
+
({view: {keyToGroupTestsBy}}) => ({keyToGroupTestsBy})
|
|
23
23
|
)(MainTree);
|
|
@@ -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
|
}
|
|
@@ -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
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
},
|
|
@@ -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,
|
|
@@ -142,17 +141,12 @@ class State extends Component {
|
|
|
142
141
|
: <StateFail image={image} />;
|
|
143
142
|
}
|
|
144
143
|
|
|
145
|
-
const className = classNames(
|
|
146
|
-
'image-box__container',
|
|
147
|
-
{'image-box__container_scale': this.props.scaleImages}
|
|
148
|
-
);
|
|
149
|
-
|
|
150
144
|
return (
|
|
151
145
|
<Fragment>
|
|
152
146
|
<hr className="tab__separator"/>
|
|
153
147
|
{this._getStateTitle()}
|
|
154
148
|
{this._drawControlButtons()}
|
|
155
|
-
{elem ? <div className=
|
|
149
|
+
{elem ? <div className='image-box__container'>{elem}</div> : null}
|
|
156
150
|
</Fragment>
|
|
157
151
|
);
|
|
158
152
|
}
|
|
@@ -163,7 +157,7 @@ export default connect(
|
|
|
163
157
|
const getLastImageByStateName = mkGetLastImageByStateName();
|
|
164
158
|
|
|
165
159
|
return (state, {imageId, result}) => {
|
|
166
|
-
const {gui, tree
|
|
160
|
+
const {gui, tree} = state;
|
|
167
161
|
const image = tree.images.byId[imageId] || {};
|
|
168
162
|
const shouldImageBeOpened = image.stateName ? tree.images.stateById[imageId].shouldBeOpened : true;
|
|
169
163
|
const node = imageId ? image : result;
|
|
@@ -176,7 +170,6 @@ export default connect(
|
|
|
176
170
|
|
|
177
171
|
return {
|
|
178
172
|
gui,
|
|
179
|
-
scaleImages,
|
|
180
173
|
image,
|
|
181
174
|
node,
|
|
182
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);
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import React, {Component, Fragment} from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
+
import classNames from 'classnames';
|
|
5
6
|
import DiffCircle from './diff-circle';
|
|
6
|
-
import
|
|
7
|
+
import withEncodeUri from './with-encode-uri';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
class ResizedScreenshot extends Component {
|
|
9
10
|
constructor(props) {
|
|
10
11
|
super(props);
|
|
11
12
|
|
|
@@ -24,11 +25,9 @@ export default class Screenshot extends Component {
|
|
|
24
25
|
height: PropTypes.number
|
|
25
26
|
})
|
|
26
27
|
}).isRequired,
|
|
27
|
-
diffClusters: PropTypes.array
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
static defaultProps = {
|
|
31
|
-
noCache: false
|
|
28
|
+
diffClusters: PropTypes.array,
|
|
29
|
+
// from withEncodeUri
|
|
30
|
+
imageUrl: PropTypes.string.isRequired
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
_getScreenshotComponent(elem, diffClusters) {
|
|
@@ -54,38 +53,37 @@ export default class Screenshot extends Component {
|
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
render() {
|
|
57
|
-
const {
|
|
58
|
-
|
|
59
|
-
const url = noCache
|
|
60
|
-
? addTimestamp(encodeUri(imgPath))
|
|
61
|
-
: encodeUri(imgPath);
|
|
56
|
+
const {imageUrl, image: {size: imgSize}, diffClusters, style} = this.props;
|
|
57
|
+
const cursorStyle = diffClusters ? {cursor: 'pointer'} : {};
|
|
62
58
|
|
|
63
59
|
if (!imgSize) {
|
|
64
|
-
const elem =
|
|
60
|
+
const elem = (
|
|
61
|
+
<div className="image-box__screenshot-container image-box__screenshot-container_auto-size">
|
|
62
|
+
<img src={imageUrl} style={{width: '100%', height: '100%', style, ...cursorStyle}}/>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
65
|
|
|
66
66
|
return this._getScreenshotComponent(elem, diffClusters);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
const imgClassNames = classNames(
|
|
70
|
+
'image-box__screenshot',
|
|
71
|
+
this.props.className
|
|
72
|
+
);
|
|
73
|
+
|
|
69
74
|
const paddingTop = ((imgSize.height / imgSize.width) * 100).toFixed(2);
|
|
70
|
-
const elem =
|
|
75
|
+
const elem = (
|
|
76
|
+
<div
|
|
77
|
+
onClick={diffClusters && this._handleDiffClick(diffClusters)}
|
|
78
|
+
className="image-box__screenshot-container image-box__screenshot-container_fixed-size"
|
|
79
|
+
style={{width: imgSize.width, paddingTop: `${paddingTop}%`}}
|
|
80
|
+
>
|
|
81
|
+
<img src={imageUrl} className={imgClassNames} style={{...style, ...cursorStyle}} />
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
71
84
|
|
|
72
85
|
return this._getScreenshotComponent(elem, diffClusters);
|
|
73
86
|
}
|
|
74
87
|
}
|
|
75
88
|
|
|
76
|
-
|
|
77
|
-
if (isUrl(imagePath)) {
|
|
78
|
-
return imagePath;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return imagePath
|
|
82
|
-
// we can't use path.sep here because on Windows browser returns '/' instead of '\\'
|
|
83
|
-
.split(/\/|\\/)
|
|
84
|
-
.map((item) => encodeURIComponent(item))
|
|
85
|
-
.join('/');
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// for prevent image caching
|
|
89
|
-
function addTimestamp(imagePath) {
|
|
90
|
-
return `${imagePath}?t=${Date.now()}`;
|
|
91
|
-
}
|
|
89
|
+
export default withEncodeUri(ResizedScreenshot);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import {isUrl} from '../../../../common-utils';
|
|
4
|
+
|
|
5
|
+
// for prevent image caching
|
|
6
|
+
function addTimestamp(imagePath) {
|
|
7
|
+
return `${imagePath}?t=${Date.now()}`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function encodeUri(imagePath) {
|
|
11
|
+
if (isUrl(imagePath)) {
|
|
12
|
+
return imagePath;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return imagePath
|
|
16
|
+
// we can't use path.sep here because on Windows browser returns '/' instead of '\\'
|
|
17
|
+
.split(/\/|\\/)
|
|
18
|
+
.map((item) => encodeURIComponent(item))
|
|
19
|
+
.join('/');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function withEncodeUri(ScreenshotComponent) {
|
|
23
|
+
return function wrapper(props) {
|
|
24
|
+
const {noCache, image: {path: imgPath}} = props;
|
|
25
|
+
|
|
26
|
+
const imageUrl = noCache
|
|
27
|
+
? addTimestamp(encodeUri(imgPath))
|
|
28
|
+
: encodeUri(imgPath);
|
|
29
|
+
|
|
30
|
+
return <ScreenshotComponent
|
|
31
|
+
imageUrl={imageUrl}
|
|
32
|
+
{...props}
|
|
33
|
+
/>;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
withEncodeUri.propTypes = {
|
|
38
|
+
noCache: PropTypes.bool,
|
|
39
|
+
image: PropTypes.shape({
|
|
40
|
+
path: PropTypes.string.isRequired
|
|
41
|
+
}).isRequired
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default withEncodeUri;
|