html-reporter 7.1.0 → 7.4.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 +48 -0
- package/README.md +44 -10
- package/lib/common-utils.js +14 -14
- package/lib/config/index.js +11 -7
- package/lib/constants/defaults.js +1 -1
- package/lib/constants/expand-modes.js +8 -0
- package/lib/constants/extension-points.js +1 -0
- package/lib/constants/plugin-events.js +10 -0
- package/lib/gui/constants/client-events.js +2 -4
- package/lib/gui/server.js +1 -4
- package/lib/gui/tool-runner/index.js +4 -2
- package/lib/gui/tool-runner/utils.js +4 -20
- package/lib/plugin-api.js +14 -1
- package/lib/report-builder/static.js +1 -0
- package/lib/server-utils.js +0 -1
- package/lib/sqlite-adapter.js +4 -1
- package/lib/static/components/controls/common-controls.js +5 -9
- package/lib/static/components/error-groups/item.js +12 -17
- package/lib/static/components/error-groups/list.js +45 -18
- package/lib/static/components/gui.js +10 -1
- package/lib/static/components/report.js +6 -1
- package/lib/static/components/section/body/index.js +14 -40
- package/lib/static/components/section/body/result.js +5 -1
- package/lib/static/components/section/section-browser.js +13 -53
- package/lib/static/components/section/section-common.js +23 -88
- package/lib/static/components/section/section-wrapper.js +2 -15
- package/lib/static/components/section/title/browser.js +2 -1
- package/lib/static/components/state/index.js +14 -82
- package/lib/static/components/state/screenshot.js +6 -22
- package/lib/static/components/state/state-error.js +1 -1
- package/lib/static/components/suites.js +100 -28
- package/lib/static/gui.html +1 -1
- package/lib/static/gui.min.css +1 -1
- package/lib/static/gui.min.js +23 -15
- package/lib/static/modules/action-names.js +3 -2
- package/lib/static/modules/actions.js +20 -31
- package/lib/static/modules/default-state.js +2 -1
- package/lib/static/modules/group-errors.js +3 -3
- package/lib/static/modules/middlewares/local-storage.js +0 -2
- package/lib/static/modules/middlewares/metrika.js +1 -6
- package/lib/static/modules/reducers/db.js +4 -2
- package/lib/static/modules/reducers/tree/helpers.js +28 -0
- package/lib/static/modules/reducers/tree/index.js +241 -0
- package/lib/static/modules/reducers/tree/nodes/browsers.js +99 -0
- package/lib/static/modules/reducers/tree/nodes/images.js +50 -0
- package/lib/static/modules/reducers/tree/nodes/results.js +13 -0
- package/lib/static/modules/reducers/tree/nodes/suites.js +217 -0
- package/lib/static/modules/reducers/view.js +7 -11
- package/lib/static/modules/selectors/tree.js +98 -145
- package/lib/static/modules/sqlite.js +20 -15
- package/lib/static/modules/utils.js +58 -10
- package/lib/static/report.min.css +1 -1
- package/lib/static/report.min.js +23 -15
- package/lib/static/styles.css +4 -8
- package/package.json +6 -6
- package/webpack.common.js +5 -0
- package/lib/constants/client-events.js +0 -6
- package/lib/static/components/state/placeholder.js +0 -10
- package/lib/static/modules/reducers/tree.js +0 -169
- package/sqlite.db +0 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import {getSuiteResults} from '../../../selectors/tree';
|
|
3
|
+
import {isNodeFailed} from '../../../utils';
|
|
4
|
+
import {determineStatus} from '../../../../../common-utils';
|
|
5
|
+
import {changeNodeState, shouldNodeBeOpened} from '../helpers';
|
|
6
|
+
import {EXPAND_RETRIES} from '../../../../../constants/expand-modes';
|
|
7
|
+
|
|
8
|
+
export function initSuitesState(tree, view) {
|
|
9
|
+
if (view.groupByError) {
|
|
10
|
+
changeAllSuitesState(tree, {shouldBeShown: false});
|
|
11
|
+
} else {
|
|
12
|
+
calcSuitesShowness(tree);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
calcSuitesOpenness(tree, view.expand);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function changeAllSuitesState(tree, state) {
|
|
19
|
+
tree.suites.allIds.forEach((suiteId) => {
|
|
20
|
+
changeSuiteState(tree, suiteId, state);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function changeSuiteState(tree, suiteId, state) {
|
|
25
|
+
changeNodeState(tree.suites.stateById, suiteId, state);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function updateSuitesStatus(tree, suites) {
|
|
29
|
+
suites.forEach(({id, status}) => {
|
|
30
|
+
if (tree.suites.byId[id].status !== status) {
|
|
31
|
+
tree.suites.byId[id].status = status;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function getFailedRootSuiteIds(suites) {
|
|
37
|
+
return suites.allRootIds.filter((rootId) => {
|
|
38
|
+
return isNodeFailed(suites.byId[rootId]);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function updateAllSuitesStatus(tree, filteredBrowsers) {
|
|
43
|
+
const childSuitesIds = _(tree.browsers.allIds)
|
|
44
|
+
.map((browserId) => tree.browsers.byId[browserId].parentId)
|
|
45
|
+
.uniq()
|
|
46
|
+
.value();
|
|
47
|
+
|
|
48
|
+
return updateParentSuitesStatus(tree, childSuitesIds, filteredBrowsers);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function calcSuitesShowness(tree, suiteIds) {
|
|
52
|
+
const youngestSuites = _.isEmpty(suiteIds)
|
|
53
|
+
? getYoungestSuites(tree)
|
|
54
|
+
: [].concat(suiteIds).map((suiteId) => tree.suites.byId[suiteId]);
|
|
55
|
+
|
|
56
|
+
youngestSuites.forEach((suite) => {
|
|
57
|
+
const shouldBeShown = suite.browserIds
|
|
58
|
+
.some((browserId) => tree.browsers.stateById[browserId].shouldBeShown);
|
|
59
|
+
|
|
60
|
+
changeSuiteState(tree, suite.id, {shouldBeShown});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const changeParentSuiteCb = (parentSuite) => {
|
|
64
|
+
changeSuiteState(tree, parentSuite.id, {shouldBeShown: shouldSuiteBeShown(parentSuite, tree)});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
calcParentSuitesState(youngestSuites, tree, changeParentSuiteCb);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function calcSuitesOpenness(tree, expand, suiteIds) {
|
|
71
|
+
if (expand !== EXPAND_RETRIES) {
|
|
72
|
+
if (_.isEmpty(suiteIds)) {
|
|
73
|
+
suiteIds = tree.suites.allIds;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
[].concat(suiteIds).forEach((suiteId) => {
|
|
77
|
+
const suite = tree.suites.byId[suiteId];
|
|
78
|
+
const shouldBeOpened = calcSuiteOpenness(suite, expand, tree);
|
|
79
|
+
|
|
80
|
+
changeSuiteState(tree, suiteId, {shouldBeOpened});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const youngestSuites = _.isEmpty(suiteIds)
|
|
87
|
+
? getYoungestSuites(tree)
|
|
88
|
+
: [].concat(suiteIds).map((suiteId) => tree.suites.byId[suiteId]);
|
|
89
|
+
|
|
90
|
+
youngestSuites.forEach((suite) => {
|
|
91
|
+
const shouldBeOpened = calcSuiteOpenness(suite, expand, tree);
|
|
92
|
+
changeSuiteState(tree, suite.id, {shouldBeOpened});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const changeParentSuiteCb = (parentSuite) => {
|
|
96
|
+
changeSuiteState(tree, parentSuite.id, {shouldBeOpened: shouldSuiteBeOpened(parentSuite, tree)});
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
calcParentSuitesState(youngestSuites, tree, changeParentSuiteCb);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function calcParentSuitesState(youngerSuites, tree, callback) {
|
|
103
|
+
const closestParentSuites = new Set();
|
|
104
|
+
const closestParentSuiteIds = [];
|
|
105
|
+
|
|
106
|
+
sortSuitesByNesting([...youngerSuites]).forEach((suite) => {
|
|
107
|
+
if (!suite.parentId) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const parentSuite = tree.suites.byId[suite.parentId];
|
|
112
|
+
const uniqParentSuiteId = parentSuite.suitePath.join('|') + '|';
|
|
113
|
+
|
|
114
|
+
if (closestParentSuiteIds.some((parentId) => parentId.startsWith(uniqParentSuiteId))) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
closestParentSuites.add(parentSuite);
|
|
119
|
+
closestParentSuiteIds.push(uniqParentSuiteId);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
if (_.isEmpty(closestParentSuites)) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
for (const parentSuite of closestParentSuites) {
|
|
127
|
+
callback(parentSuite);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
calcParentSuitesState(closestParentSuites, tree, callback);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function sortSuitesByNesting(suites) {
|
|
134
|
+
return suites.sort((a, b) => b.suitePath.length - a.suitePath.length);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function getYoungestSuites(tree) {
|
|
138
|
+
return tree.suites.allIds
|
|
139
|
+
.filter((suiteId) => {
|
|
140
|
+
const suite = tree.suites.byId[suiteId];
|
|
141
|
+
return _.isEmpty(suite.suiteIds) && !_.isEmpty(suite.browserIds);
|
|
142
|
+
})
|
|
143
|
+
.map((suiteId) => tree.suites.byId[suiteId]);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function calcSuiteOpenness(suite, expand, tree) {
|
|
147
|
+
const errorsCb = () => isNodeFailed(suite);
|
|
148
|
+
const retriesCb = () => {
|
|
149
|
+
const preparedTree = {suites: tree.suites.byId, browsers: tree.browsers.byId, results: tree.results.byId};
|
|
150
|
+
const retries = getSuiteResults(suite, preparedTree, _.initial);
|
|
151
|
+
|
|
152
|
+
return retries.some((retry) => isNodeFailed(retry));
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
return shouldNodeBeOpened(expand, {errorsCb, retriesCb});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function shouldSuiteBeShown(suite, tree) {
|
|
159
|
+
return shouldSuiteBe(suite, tree, 'shouldBeShown');
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function shouldSuiteBeOpened(suite, tree) {
|
|
163
|
+
return shouldSuiteBe(suite, tree, 'shouldBeOpened');
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function shouldSuiteBe(suite, tree, field) {
|
|
167
|
+
return (suite.suiteIds || []).some((suiteId) => tree.suites.stateById[suiteId][field])
|
|
168
|
+
|| (suite.browserIds || []).some((browserId) => tree.browsers.stateById[browserId][field]);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function updateParentSuitesStatus(tree, suitesIds = [], filteredBrowsers) {
|
|
172
|
+
if (!suitesIds || !suitesIds.length) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const suites = [].concat(suitesIds).map((id) => tree.suites.byId[id]);
|
|
177
|
+
const parentsToUpdate = new Set();
|
|
178
|
+
|
|
179
|
+
suites.forEach((s) => {
|
|
180
|
+
const newStatus = getChildSuitesStatus(tree, s, filteredBrowsers);
|
|
181
|
+
if (newStatus === s.status) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
s.status = newStatus;
|
|
186
|
+
if (s.parentId) {
|
|
187
|
+
parentsToUpdate.add(s.parentId);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
updateParentSuitesStatus(tree, Array.from(parentsToUpdate), filteredBrowsers);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function getChildSuitesStatus(tree, suite, filteredBrowsers) {
|
|
195
|
+
let childStatuses = [];
|
|
196
|
+
|
|
197
|
+
if (suite.suiteIds) {
|
|
198
|
+
childStatuses = suite.suiteIds.map((id) => tree.suites.byId[id].status);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (suite.browserIds) {
|
|
202
|
+
const suiteBrowsers = suite.browserIds
|
|
203
|
+
.map((id) => tree.browsers.byId[id])
|
|
204
|
+
.filter(({name, version}) => {
|
|
205
|
+
var res = filteredBrowsers.some(({id: filteredName, versions: filteredVersions}) => {
|
|
206
|
+
return filteredName === name && (filteredVersions.includes(version) || !filteredVersions.length);
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
return res;
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
const suiteBrowserStatuses = suiteBrowsers.map(({resultIds}) => tree.results.byId[_.last(resultIds)].status);
|
|
213
|
+
childStatuses = childStatuses.concat(suiteBrowserStatuses);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return determineStatus(childStatuses);
|
|
217
|
+
}
|
|
@@ -5,12 +5,13 @@ import {getViewQuery} from '../custom-queries';
|
|
|
5
5
|
import * as localStorageWrapper from '../local-storage-wrapper';
|
|
6
6
|
import actionNames from '../action-names';
|
|
7
7
|
import viewModes from '../../../constants/view-modes';
|
|
8
|
+
import {EXPAND_ALL, COLLAPSE_ALL, EXPAND_ERRORS, EXPAND_RETRIES} from '../../../constants/expand-modes';
|
|
8
9
|
|
|
9
10
|
export default produce((state, action) => {
|
|
10
11
|
switch (action.type) {
|
|
11
12
|
case actionNames.INIT_GUI_REPORT:
|
|
12
13
|
case actionNames.INIT_STATIC_REPORT: {
|
|
13
|
-
const {scaleImages,
|
|
14
|
+
const {scaleImages, baseHost, defaultView: viewMode} = state.config;
|
|
14
15
|
const viewQuery = getViewQuery(window.location.search);
|
|
15
16
|
const lsView = localStorageWrapper.getItem('view', {});
|
|
16
17
|
|
|
@@ -18,7 +19,7 @@ export default produce((state, action) => {
|
|
|
18
19
|
viewQuery.filteredBrowsers = state.browsers;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
state.view = {...state.view, scaleImages,
|
|
22
|
+
state.view = {...state.view, scaleImages, viewMode, baseHost, ...lsView, ...viewQuery};
|
|
22
23
|
|
|
23
24
|
break;
|
|
24
25
|
}
|
|
@@ -32,22 +33,22 @@ export default produce((state, action) => {
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
case actionNames.VIEW_EXPAND_ALL: {
|
|
35
|
-
state.view.expand =
|
|
36
|
+
state.view.expand = EXPAND_ALL;
|
|
36
37
|
break;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
case actionNames.VIEW_EXPAND_ERRORS: {
|
|
40
|
-
state.view.expand =
|
|
41
|
+
state.view.expand = EXPAND_ERRORS;
|
|
41
42
|
break;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
case actionNames.VIEW_EXPAND_RETRIES: {
|
|
45
|
-
state.view.expand =
|
|
46
|
+
state.view.expand = EXPAND_RETRIES;
|
|
46
47
|
break;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
case actionNames.VIEW_COLLAPSE_ALL: {
|
|
50
|
-
state.view.expand =
|
|
51
|
+
state.view.expand = COLLAPSE_ALL;
|
|
51
52
|
break;
|
|
52
53
|
}
|
|
53
54
|
|
|
@@ -76,11 +77,6 @@ export default produce((state, action) => {
|
|
|
76
77
|
break;
|
|
77
78
|
}
|
|
78
79
|
|
|
79
|
-
case actionNames.VIEW_TOGGLE_LAZY_LOAD_IMAGES: {
|
|
80
|
-
state.view.lazyLoadOffset = state.view.lazyLoadOffset ? 0 : state.config.lazyLoadOffset;
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
80
|
case actionNames.VIEW_UPDATE_BASE_HOST: {
|
|
85
81
|
const baseHost = action.host;
|
|
86
82
|
const parsedHost = parseHost(baseHost);
|
|
@@ -1,28 +1,40 @@
|
|
|
1
|
-
import {last,
|
|
1
|
+
import {last, identity, flatMap, compact, findLast} from 'lodash';
|
|
2
2
|
import {createSelector} from 'reselect';
|
|
3
|
-
import {
|
|
3
|
+
import {getViewMode} from './view';
|
|
4
4
|
import viewModes from '../../../constants/view-modes';
|
|
5
|
-
import {
|
|
6
|
-
import {isNodeFailed, isNodeSuccessful, isAcceptable} from '../utils';
|
|
5
|
+
import {isIdleStatus} from '../../../common-utils';
|
|
6
|
+
import {isNodeFailed, isNodeSuccessful, isAcceptable, iterateSuites} from '../utils';
|
|
7
7
|
|
|
8
8
|
const getSuites = (state) => state.tree.suites.byId;
|
|
9
|
+
const getSuitesStates = (state) => state.tree.suites.stateById;
|
|
9
10
|
const getBrowsers = (state) => state.tree.browsers.byId;
|
|
11
|
+
const getBrowsersStates = (state) => state.tree.browsers.stateById;
|
|
10
12
|
const getResults = (state) => state.tree.results.byId;
|
|
11
13
|
const getImages = (state) => state.tree.images.byId;
|
|
14
|
+
const getImagesStates = (state) => state.tree.images.stateById;
|
|
12
15
|
const getAllRootSuiteIds = (state) => state.tree.suites.allRootIds;
|
|
13
16
|
const getFailedRootSuiteIds = (state) => state.tree.suites.failedRootIds;
|
|
14
|
-
const getImagesStates = (state) => state.tree.images.stateById;
|
|
15
17
|
const getRootSuiteIds = (state) => {
|
|
16
18
|
const viewMode = getViewMode(state);
|
|
17
19
|
return viewMode === viewModes.FAILED ? state.tree.suites.failedRootIds : state.tree.suites.allRootIds;
|
|
18
20
|
};
|
|
19
|
-
const getBrowserIds = (state) => state.tree.browsers.allIds;
|
|
20
21
|
|
|
21
22
|
const getSuiteById = (state, {suiteId}) => state.tree.suites.byId[suiteId];
|
|
22
|
-
const getBrowserById = (state, {browserId}) => state.tree.browsers.byId[browserId];
|
|
23
23
|
const getImageById = (state, {imageId}) => state.tree.images.byId[imageId];
|
|
24
|
-
|
|
25
|
-
const
|
|
24
|
+
|
|
25
|
+
export const mkGetTestsBySuiteId = () => createSelector(
|
|
26
|
+
getSuiteById, getSuites, getBrowsers,
|
|
27
|
+
(suite, suites, browsers) => {
|
|
28
|
+
const suiteBrowsers = getSuiteBrowsers(suite, {suites, browsers});
|
|
29
|
+
|
|
30
|
+
return suiteBrowsers.map(({parentId, name}) => ({testName: parentId, browserName: name}));
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
export const mkGetLastImageByStateName = () => createSelector(
|
|
35
|
+
getImageById, getBrowsers, getResults, getImages,
|
|
36
|
+
getLastImageByStateName
|
|
37
|
+
);
|
|
26
38
|
|
|
27
39
|
export const getFailedTests = createSelector(
|
|
28
40
|
getSuites, getBrowsers, getResults, getFailedRootSuiteIds,
|
|
@@ -39,23 +51,9 @@ export const getFailedTests = createSelector(
|
|
|
39
51
|
}
|
|
40
52
|
);
|
|
41
53
|
|
|
42
|
-
export const mkGetTestsBySuiteId = () => createSelector(
|
|
43
|
-
getSuiteById, getSuites, getBrowsers,
|
|
44
|
-
(suite, suites, browsers) => {
|
|
45
|
-
const suiteBrowsers = getSuiteBrowsers(suite, {suites, browsers});
|
|
46
|
-
|
|
47
|
-
return suiteBrowsers.map(({parentId, name}) => ({testName: parentId, browserName: name}));
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
export const mkGetLastImageByStateName = () => createSelector(
|
|
52
|
-
getImageById, getBrowsers, getResults, getImages,
|
|
53
|
-
getLastImageByStateName
|
|
54
|
-
);
|
|
55
|
-
|
|
56
54
|
export const getAcceptableImagesByStateName = createSelector(
|
|
57
|
-
|
|
58
|
-
(
|
|
55
|
+
getBrowsersStates, getBrowsers, getResults, getImages,
|
|
56
|
+
(browsersStates, browsers, results, images) => {
|
|
59
57
|
const getImageInfo = (image) => {
|
|
60
58
|
const browser = getImageBrowser(image, browsers, results);
|
|
61
59
|
|
|
@@ -73,9 +71,9 @@ export const getAcceptableImagesByStateName = createSelector(
|
|
|
73
71
|
: compareSuiteIdsRes;
|
|
74
72
|
};
|
|
75
73
|
|
|
76
|
-
const matchedBrowsers =
|
|
77
|
-
.
|
|
78
|
-
.
|
|
74
|
+
const matchedBrowsers = Object.keys(browsersStates)
|
|
75
|
+
.filter((browserId) => browsersStates[browserId].shouldBeShown)
|
|
76
|
+
.map((browserId) => browsers[browserId]);
|
|
79
77
|
|
|
80
78
|
const preparedImages = flatMap(matchedBrowsers, (browser) => getBrowserImages(browser, {results, images}))
|
|
81
79
|
.filter(isAcceptable)
|
|
@@ -102,100 +100,93 @@ export const getAcceptableImagesByStateName = createSelector(
|
|
|
102
100
|
}
|
|
103
101
|
);
|
|
104
102
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
(
|
|
108
|
-
)
|
|
103
|
+
const getActiveTestSuites = createSelector(
|
|
104
|
+
getAllRootSuiteIds, getSuites, getSuitesStates,
|
|
105
|
+
(rootSuiteIds, suites, suitesStates) => {
|
|
106
|
+
const filterFn = (suite) => {
|
|
107
|
+
const {shouldBeShown, shouldBeOpened} = suitesStates[suite.id];
|
|
109
108
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
(openedImageIds, images) => {
|
|
113
|
-
return openedImageIds.map((imgId) => images[imgId]).filter(isAcceptable).map((image) => image.id);
|
|
114
|
-
}
|
|
115
|
-
);
|
|
109
|
+
return shouldBeShown && shouldBeOpened;
|
|
110
|
+
};
|
|
116
111
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
112
|
+
const activeRootSuites = rootSuiteIds
|
|
113
|
+
.map((rootSuiteId) => suites[rootSuiteId])
|
|
114
|
+
.filter(filterFn);
|
|
115
|
+
|
|
116
|
+
return flatMap(activeRootSuites, (rootSuite) => getTestSuites(rootSuite, {suites}, filterFn));
|
|
121
117
|
}
|
|
122
118
|
);
|
|
123
119
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
120
|
+
const getActiveBrowsers = createSelector(
|
|
121
|
+
getActiveTestSuites, getBrowsers, getBrowsersStates, getActiveTestSuites,
|
|
122
|
+
(activeYoungestSuites, browsers, browsersStates) => {
|
|
123
|
+
return flatMap(activeYoungestSuites, (suite) => suite.browserIds)
|
|
124
|
+
.filter((browserId) => {
|
|
125
|
+
const {shouldBeShown, shouldBeOpened} = browsersStates[browserId];
|
|
126
|
+
return shouldBeShown && shouldBeOpened;
|
|
127
|
+
})
|
|
128
|
+
.map((browserId) => browsers[browserId]);
|
|
129
129
|
}
|
|
130
130
|
);
|
|
131
131
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
(
|
|
135
|
-
|
|
132
|
+
const getActiveResults = createSelector(
|
|
133
|
+
getActiveBrowsers, getBrowsersStates, getResults,
|
|
134
|
+
(activeBrowsers, browsersStates, results) => {
|
|
135
|
+
return activeBrowsers.map((browser) => {
|
|
136
|
+
const {retryIndex} = browsersStates[browser.id];
|
|
137
|
+
const resultId = browser.resultIds[retryIndex];
|
|
136
138
|
|
|
137
|
-
|
|
139
|
+
return results[resultId];
|
|
140
|
+
});
|
|
138
141
|
}
|
|
139
142
|
);
|
|
140
143
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
const getActiveImages = createSelector(
|
|
145
|
+
getActiveResults, getImages, getImagesStates,
|
|
146
|
+
(activeResults, images, imagesStates) => {
|
|
147
|
+
return flatMap(activeResults, (result) => {
|
|
148
|
+
return result.imageIds
|
|
149
|
+
.filter((imageId) => imagesStates[imageId].shouldBeOpened)
|
|
150
|
+
.map((imageId) => images[imageId]);
|
|
151
|
+
});
|
|
147
152
|
}
|
|
148
153
|
);
|
|
149
154
|
|
|
150
|
-
export const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
shouldSuiteBeShown
|
|
155
|
+
export const getAcceptableOpenedImageIds = createSelector(
|
|
156
|
+
getActiveImages,
|
|
157
|
+
(activeImages) => activeImages.filter(isAcceptable).map((image) => image.id)
|
|
154
158
|
);
|
|
155
159
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
+
export const getFailedOpenedImageIds = createSelector(
|
|
161
|
+
getActiveImages,
|
|
162
|
+
(activeImages) => activeImages.filter(isNodeFailed).map((image) => image.id)
|
|
163
|
+
);
|
|
160
164
|
|
|
161
|
-
|
|
165
|
+
export const getVisibleRootSuiteIds = createSelector(
|
|
166
|
+
getRootSuiteIds, getSuitesStates,
|
|
167
|
+
(rootSuiteIds, suitesStates) => rootSuiteIds.filter((suiteId) => suitesStates[suiteId].shouldBeShown)
|
|
168
|
+
);
|
|
162
169
|
|
|
163
|
-
|
|
164
|
-
|
|
170
|
+
export function getSuiteResults(node, tree, filterFn = identity) {
|
|
171
|
+
const {suites, browsers, results} = tree;
|
|
165
172
|
|
|
166
|
-
|
|
167
|
-
|
|
173
|
+
return iterateSuites(node, {
|
|
174
|
+
suiteCb: (suiteId) => getSuiteResults(suites[suiteId], tree, filterFn),
|
|
175
|
+
browserCb: (browserId) => {
|
|
176
|
+
return [].concat(filterFn(browsers[browserId].resultIds)).map((resultId) => results[resultId]);
|
|
168
177
|
}
|
|
169
|
-
|
|
170
|
-
return shouldShowBrowser(browser, filteredBrowsers, errorGroupBrowserIds);
|
|
171
178
|
});
|
|
172
179
|
}
|
|
173
180
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
if (!isStatusMatchViewMode(lastResultStatus, viewMode)) {
|
|
178
|
-
return false;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return shouldShowBrowser(browser, filteredBrowsers, errorGroupBrowserIds);
|
|
181
|
+
function getTestSuites(suite, tree, filterFn = identity) {
|
|
182
|
+
if (!filterFn(suite)) {
|
|
183
|
+
return [];
|
|
182
184
|
}
|
|
183
|
-
);
|
|
184
185
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
return [].concat(filterFn(node.resultIds)).map((resultId) => results[resultId]);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if (node.browserIds) {
|
|
193
|
-
return flatMap(node.browserIds, (browserId) => {
|
|
194
|
-
return getSuiteResults(browsers[browserId], tree, filterFn);
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
return flatMap(node.suiteIds, (suiteId) => getSuiteResults(suites[suiteId], tree, filterFn));
|
|
186
|
+
return iterateSuites(suite, {
|
|
187
|
+
suiteCb: (suiteId) => getTestSuites(tree.suites[suiteId], tree, filterFn),
|
|
188
|
+
browserIdsCb: (_, parent) => [parent]
|
|
189
|
+
});
|
|
199
190
|
}
|
|
200
191
|
|
|
201
192
|
function getSuiteBrowsers(suite, tree) {
|
|
@@ -220,65 +211,27 @@ function getBrowserImages(node, tree) {
|
|
|
220
211
|
});
|
|
221
212
|
}
|
|
222
213
|
|
|
223
|
-
function isStatusMatchViewMode(status, viewMode) {
|
|
224
|
-
if (viewMode === viewModes.ALL) {
|
|
225
|
-
return true;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
if (viewMode === viewModes.FAILED && isFailStatus(status) || isErroredStatus(status)) {
|
|
229
|
-
return true;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
return false;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
function isTestNameMatchFilters(testName, testNameFilter, strictMatchFilter) {
|
|
236
|
-
if (!testNameFilter) {
|
|
237
|
-
return true;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
return strictMatchFilter ? testName === testNameFilter : testName.includes(testNameFilter);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
export function shouldShowBrowser(browser, filteredBrowsers, errorGroupBrowserIds = []) {
|
|
244
|
-
if (isEmpty(filteredBrowsers) && isEmpty(errorGroupBrowserIds)) {
|
|
245
|
-
return true;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
const browserToFilterBy = filteredBrowsers.length === 0 || find(filteredBrowsers, {id: browser.name});
|
|
249
|
-
const matchErrorGroup = errorGroupBrowserIds.length === 0 || errorGroupBrowserIds.includes(browser.id);
|
|
250
|
-
|
|
251
|
-
if (!browserToFilterBy || !matchErrorGroup) {
|
|
252
|
-
return false;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
const browserVersionsToFilterBy = [].concat(browserToFilterBy.versions).filter(Boolean);
|
|
256
|
-
|
|
257
|
-
if (isEmpty(browserVersionsToFilterBy)) {
|
|
258
|
-
return true;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
return browserVersionsToFilterBy.includes(browser.version);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
214
|
export function getFailedSuiteResults(tree) {
|
|
265
215
|
const failedRootSuites = tree.suites.failedRootIds.map((suiteId) => tree.suites.byId[suiteId]);
|
|
266
216
|
const failedTestSuites = compact(flatMap(failedRootSuites, (failedRootSuite) => getFailedTestSuites(failedRootSuite, tree.suites.byId)));
|
|
267
|
-
const preparedTree = {suites: tree.suites.byId, browsers: tree.browsers.byId, results: tree.results.byId};
|
|
268
217
|
|
|
269
|
-
return flatMap(failedTestSuites, (suite) =>
|
|
218
|
+
return flatMap(failedTestSuites, (suite) => iterateSuites(suite, {
|
|
219
|
+
browserCb: (browserId) => {
|
|
220
|
+
const browser = tree.browsers.byId[browserId];
|
|
221
|
+
return browser.resultIds.map((resultId) => tree.results.byId[resultId]);
|
|
222
|
+
}
|
|
223
|
+
}));
|
|
270
224
|
}
|
|
271
225
|
|
|
272
226
|
function getFailedTestSuites(suite, suites) {
|
|
273
227
|
if (!isNodeFailed(suite)) {
|
|
274
|
-
return;
|
|
228
|
+
return [];
|
|
275
229
|
}
|
|
276
230
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
return flatMap(suite.suiteIds, (suiteId) => getFailedTestSuites(suites[suiteId], suites));
|
|
231
|
+
return iterateSuites(suite, {
|
|
232
|
+
suiteCb: (suiteId) => getFailedTestSuites(suites[suiteId], suites),
|
|
233
|
+
browserIdsCb: (_, parent) => [parent]
|
|
234
|
+
});
|
|
282
235
|
}
|
|
283
236
|
|
|
284
237
|
function getLastImageByStateName(image, browsers, results, images) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import {flattenDeep} from 'lodash';
|
|
5
|
-
import {
|
|
5
|
+
import {mergeTables} from '../../common-utils';
|
|
6
6
|
|
|
7
7
|
function isRelativeUrl(url) {
|
|
8
8
|
try {
|
|
@@ -114,28 +114,33 @@ async function mergeDatabases(dataForDbs) {
|
|
|
114
114
|
const mergedDbConnection = new SQL.Database(undefined, sumOfChunkSizes);
|
|
115
115
|
const dbPaths = connections.map(db => db.filename);
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
mergedDbConnection.run(query);
|
|
120
|
-
} catch (err) {
|
|
121
|
-
// TODO: To be able to work with files that have been created before
|
|
122
|
-
// TODO: Remove in next versions
|
|
123
|
-
if (/no such table/.test(err)) {
|
|
124
|
-
console.warn(err);
|
|
125
|
-
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
117
|
+
mergeTables({db: mergedDbConnection, dbPaths, getExistingTables: (statement) => {
|
|
118
|
+
const tables = [];
|
|
128
119
|
|
|
129
|
-
|
|
120
|
+
while (statement.step()) {
|
|
121
|
+
tables.push(...statement.get());
|
|
130
122
|
}
|
|
131
|
-
|
|
123
|
+
|
|
124
|
+
return tables;
|
|
125
|
+
}});
|
|
132
126
|
|
|
133
127
|
connections.forEach(db => db.close());
|
|
134
128
|
|
|
135
129
|
return mergedDbConnection;
|
|
136
130
|
}
|
|
137
131
|
|
|
132
|
+
async function connectToDatabase(dbUrl) {
|
|
133
|
+
const mainDatabaseUrl = new URL(dbUrl);
|
|
134
|
+
const {data} = await fetchFile(mainDatabaseUrl.href, {
|
|
135
|
+
responseType: 'arraybuffer'
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
const SQL = await window.initSqlJs();
|
|
139
|
+
return new SQL.Database(new Uint8Array(data));
|
|
140
|
+
}
|
|
141
|
+
|
|
138
142
|
module.exports = {
|
|
139
143
|
fetchDatabases,
|
|
140
|
-
mergeDatabases
|
|
144
|
+
mergeDatabases,
|
|
145
|
+
connectToDatabase
|
|
141
146
|
};
|