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
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
export default {
|
|
4
4
|
INIT_GUI_REPORT: 'INIT_GUI_REPORT',
|
|
5
5
|
INIT_STATIC_REPORT: 'INIT_STATIC_REPORT',
|
|
6
|
+
FIN_GUI_REPORT: 'FIN_GUI_REPORT',
|
|
6
7
|
FIN_STATIC_REPORT: 'FIN_STATIC_REPORT',
|
|
7
8
|
RUN_ALL_TESTS: 'RUN_ALL_TESTS',
|
|
8
9
|
RUN_FAILED_TESTS: 'RUN_FAILED_TESTS',
|
|
@@ -33,7 +34,6 @@ export default {
|
|
|
33
34
|
VIEW_SET_STRICT_MATCH_FILTER: 'VIEW_SET_STRICT_MATCH_FILTER',
|
|
34
35
|
VIEW_TOGGLE_GROUP_BY_ERROR: 'VIEW_TOGGLE_GROUP_BY_ERROR',
|
|
35
36
|
VIEW_TOGGLE_SCALE_IMAGES: 'VIEW_TOGGLE_SCALE_IMAGES',
|
|
36
|
-
VIEW_TOGGLE_LAZY_LOAD_IMAGES: 'VIEW_TOGGLE_LAZY_LOAD_IMAGES',
|
|
37
37
|
PROCESS_BEGIN: 'PROCESS_BEGIN',
|
|
38
38
|
PROCESS_END: 'PROCESS_END',
|
|
39
39
|
RUN_CUSTOM_GUI_ACTION: 'RUN_CUSTOM_GUI_ACTION',
|
|
@@ -44,5 +44,6 @@ export default {
|
|
|
44
44
|
TOGGLE_SUITE_SECTION: 'TOGGLE_SUITE_SECTION',
|
|
45
45
|
TOGGLE_BROWSER_SECTION: 'TOGGLE_BROWSER_SECTION',
|
|
46
46
|
TOGGLE_META_INFO: 'TOGGLE_META_INFO',
|
|
47
|
-
TOGGLE_PAGE_SCREENSHOT: 'TOGGLE_PAGE_SCREENSHOT'
|
|
47
|
+
TOGGLE_PAGE_SCREENSHOT: 'TOGGLE_PAGE_SCREENSHOT',
|
|
48
|
+
TOGGLE_ERROR_GROUP: 'TOGGLE_ERROR_GROUP'
|
|
48
49
|
};
|
|
@@ -5,9 +5,9 @@ import StaticTestsTreeBuilder from '../../tests-tree-builder/static';
|
|
|
5
5
|
import actionNames from './action-names';
|
|
6
6
|
import {types as modalTypes} from '../components/modals';
|
|
7
7
|
import {QUEUED} from '../../constants/test-statuses';
|
|
8
|
-
import {
|
|
8
|
+
import {LOCAL_DATABASE_NAME} from '../../constants/file-names';
|
|
9
9
|
import {getHttpErrorMessage} from './utils';
|
|
10
|
-
import {fetchDatabases, mergeDatabases} from './sqlite';
|
|
10
|
+
import {fetchDatabases, mergeDatabases, connectToDatabase} from './sqlite';
|
|
11
11
|
import {getSuitesTableRows} from './database-utils';
|
|
12
12
|
import {setFilteredBrowsers} from './query-params';
|
|
13
13
|
import plugins from './plugins';
|
|
@@ -23,11 +23,14 @@ export const initGuiReport = () => {
|
|
|
23
23
|
try {
|
|
24
24
|
const appState = await axios.get('/init');
|
|
25
25
|
|
|
26
|
+
const mainDatabaseUrl = new URL(LOCAL_DATABASE_NAME, window.location.href);
|
|
27
|
+
const db = await connectToDatabase(mainDatabaseUrl.href);
|
|
28
|
+
|
|
26
29
|
await plugins.loadAll(appState.data.config);
|
|
27
30
|
|
|
28
31
|
dispatch({
|
|
29
32
|
type: actionNames.INIT_GUI_REPORT,
|
|
30
|
-
payload: appState.data
|
|
33
|
+
payload: {...appState.data, db}
|
|
31
34
|
});
|
|
32
35
|
|
|
33
36
|
const {customGuiError} = appState.data;
|
|
@@ -81,6 +84,7 @@ export const initStaticReport = () => {
|
|
|
81
84
|
};
|
|
82
85
|
};
|
|
83
86
|
|
|
87
|
+
export const finGuiReport = () => ({type: actionNames.FIN_GUI_REPORT});
|
|
84
88
|
export const finStaticReport = () => ({type: actionNames.FIN_STATIC_REPORT});
|
|
85
89
|
|
|
86
90
|
const runTests = ({tests = [], action = {}} = {}) => {
|
|
@@ -122,7 +126,6 @@ export const acceptOpened = (imageIds, type = actionNames.ACCEPT_OPENED_SCREENSH
|
|
|
122
126
|
try {
|
|
123
127
|
const {data} = await axios.post('/get-update-reference-data', imageIds);
|
|
124
128
|
const {data: updatedData} = await axios.post('/update-reference', data);
|
|
125
|
-
window.dispatchEvent(new Event(VIEW_CHANGED));
|
|
126
129
|
dispatch({type, payload: updatedData});
|
|
127
130
|
} catch (e) {
|
|
128
131
|
console.error('Error while updating references of failed tests:', e);
|
|
@@ -142,20 +145,19 @@ export const testResult = (result) => ({type: actionNames.TEST_RESULT, payload:
|
|
|
142
145
|
export const toggleStateResult = (result) => ({type: actionNames.TOGGLE_STATE_RESULT, payload: result});
|
|
143
146
|
export const changeTestRetry = (result) => ({type: actionNames.CHANGE_TEST_RETRY, payload: result});
|
|
144
147
|
export const toggleLoading = (payload) => ({type: actionNames.TOGGLE_LOADING, payload});
|
|
145
|
-
export const closeSections = (payload) =>
|
|
148
|
+
export const closeSections = (payload) => ({type: actionNames.CLOSE_SECTIONS, payload});
|
|
146
149
|
export const openModal = (payload) => ({type: actionNames.OPEN_MODAL, payload});
|
|
147
150
|
export const closeModal = (payload) => ({type: actionNames.CLOSE_MODAL, payload});
|
|
148
151
|
export const testsEnd = () => ({type: actionNames.TESTS_END});
|
|
149
152
|
export const runFailed = () => ({type: actionNames.RUN_FAILED_TESTS});
|
|
150
|
-
export const expandAll = () =>
|
|
151
|
-
export const expandErrors = () =>
|
|
152
|
-
export const expandRetries = () =>
|
|
153
|
-
export const collapseAll = () =>
|
|
154
|
-
export const toggleSkipped = () =>
|
|
155
|
-
export const toggleOnlyDiff = () =>
|
|
156
|
-
export const toggleScaleImages = () =>
|
|
153
|
+
export const expandAll = () => ({type: actionNames.VIEW_EXPAND_ALL});
|
|
154
|
+
export const expandErrors = () => ({type: actionNames.VIEW_EXPAND_ERRORS});
|
|
155
|
+
export const expandRetries = () => ({type: actionNames.VIEW_EXPAND_RETRIES});
|
|
156
|
+
export const collapseAll = () => ({type: actionNames.VIEW_COLLAPSE_ALL});
|
|
157
|
+
export const toggleSkipped = () => ({type: actionNames.VIEW_TOGGLE_SKIPPED});
|
|
158
|
+
export const toggleOnlyDiff = () => ({type: actionNames.VIEW_TOGGLE_ONLY_DIFF});
|
|
159
|
+
export const toggleScaleImages = () => ({type: actionNames.VIEW_TOGGLE_SCALE_IMAGES});
|
|
157
160
|
export const toggleGroupByError = () => ({type: actionNames.VIEW_TOGGLE_GROUP_BY_ERROR});
|
|
158
|
-
export const toggleLazyLoad = () => ({type: actionNames.VIEW_TOGGLE_LAZY_LOAD_IMAGES});
|
|
159
161
|
export const processBegin = () => ({type: actionNames.PROCESS_BEGIN});
|
|
160
162
|
export const processEnd = () => ({type: actionNames.PROCESS_END});
|
|
161
163
|
export const updateBaseHost = (host) => ({type: actionNames.VIEW_UPDATE_BASE_HOST, host});
|
|
@@ -166,6 +168,7 @@ export const toggleSuiteSection = (payload) => ({type: actionNames.TOGGLE_SUITE_
|
|
|
166
168
|
export const toggleBrowserSection = (payload) => ({type: actionNames.TOGGLE_BROWSER_SECTION, payload});
|
|
167
169
|
export const toggleMetaInfo = () => ({type: actionNames.TOGGLE_META_INFO});
|
|
168
170
|
export const togglePageScreenshot = () => ({type: actionNames.TOGGLE_PAGE_SCREENSHOT});
|
|
171
|
+
export const toggleErrorGroup = (payload) => ({type: actionNames.TOGGLE_ERROR_GROUP, payload});
|
|
169
172
|
|
|
170
173
|
export const runCustomGuiAction = (payload) => {
|
|
171
174
|
return async (dispatch) => {
|
|
@@ -182,16 +185,14 @@ export const runCustomGuiAction = (payload) => {
|
|
|
182
185
|
};
|
|
183
186
|
|
|
184
187
|
export const updateTestNameFilter = (testNameFilter) => {
|
|
185
|
-
return
|
|
188
|
+
return {type: actionNames.VIEW_UPDATE_FILTER_BY_NAME, testNameFilter};
|
|
186
189
|
};
|
|
187
190
|
|
|
188
191
|
export const setStrictMatchFilter = (strictMatchFilter) => {
|
|
189
|
-
return
|
|
192
|
+
return {type: actionNames.VIEW_SET_STRICT_MATCH_FILTER, strictMatchFilter};
|
|
190
193
|
};
|
|
191
194
|
|
|
192
195
|
export function changeViewMode(mode) {
|
|
193
|
-
window.dispatchEvent(new Event(VIEW_CHANGED));
|
|
194
|
-
|
|
195
196
|
switch (mode) {
|
|
196
197
|
case 'failed':
|
|
197
198
|
return {type: actionNames.VIEW_SHOW_FAILED};
|
|
@@ -241,20 +242,8 @@ export const findSameDiffs = (selectedImageId, openedImageIds, browserName) => {
|
|
|
241
242
|
export const selectBrowsers = (browsers) => {
|
|
242
243
|
setFilteredBrowsers(browsers);
|
|
243
244
|
|
|
244
|
-
return
|
|
245
|
+
return {
|
|
245
246
|
type: actionNames.BROWSERS_SELECTED,
|
|
246
247
|
payload: {browsers}
|
|
247
|
-
}
|
|
248
|
+
};
|
|
248
249
|
};
|
|
249
|
-
|
|
250
|
-
function triggerViewChanges(payload) {
|
|
251
|
-
window.dispatchEvent(new Event(VIEW_CHANGED));
|
|
252
|
-
|
|
253
|
-
return payload;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
function triggerSuitesVisibilityChanges(payload) {
|
|
257
|
-
window.dispatchEvent(new Event(SUITES_VISIBILITY_CHANGED));
|
|
258
|
-
|
|
259
|
-
return payload;
|
|
260
|
-
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const defaults = require('../../constants/defaults');
|
|
4
4
|
const viewModes = require('../../constants/view-modes');
|
|
5
|
+
const {EXPAND_ERRORS} = require('../../constants/expand-modes');
|
|
5
6
|
|
|
6
7
|
export default Object.assign(defaults, {
|
|
7
8
|
gui: true,
|
|
@@ -54,7 +55,7 @@ export default Object.assign(defaults, {
|
|
|
54
55
|
},
|
|
55
56
|
view: {
|
|
56
57
|
viewMode: viewModes.ALL,
|
|
57
|
-
expand:
|
|
58
|
+
expand: EXPAND_ERRORS,
|
|
58
59
|
showSkipped: false,
|
|
59
60
|
showOnlyDiff: false,
|
|
60
61
|
scaleImages: false,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {get} from 'lodash';
|
|
2
|
-
import {isTestNameMatchFilters, isAssertViewError} from './utils';
|
|
3
|
-
import {
|
|
2
|
+
import {isTestNameMatchFilters, isAssertViewError, shouldShowBrowser} from './utils';
|
|
3
|
+
import {getFailedSuiteResults} from './selectors/tree';
|
|
4
4
|
import viewModes from '../../constants/view-modes';
|
|
5
5
|
|
|
6
6
|
const imageComparisonErrorMessage = 'image comparison failed';
|
|
@@ -56,7 +56,7 @@ function groupErrors({tree = {}, viewMode = viewModes.ALL, errorPatterns = [], f
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
return Object.values(errorGroups);
|
|
59
|
+
return Object.values(errorGroups).sort((err1, err2) => err2.count - err1.count);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
function extractErrors(result, images) {
|
|
@@ -15,8 +15,6 @@ export default store => next => action => {
|
|
|
15
15
|
showSkipped: view.showSkipped,
|
|
16
16
|
showOnlyDiff: view.showOnlyDiff,
|
|
17
17
|
scaleImages: view.scaleImages,
|
|
18
|
-
// TODO: Uncomment when issues with rendering speed will fixed
|
|
19
|
-
// lazyLoadOffset: view.lazyLoadOffset,
|
|
20
18
|
groupByError: view.groupByError,
|
|
21
19
|
strictMatchFilter: view.strictMatchFilter
|
|
22
20
|
});
|
|
@@ -70,7 +70,6 @@ export default metrikaClass => store => next => action => {
|
|
|
70
70
|
case actionNames.VIEW_TOGGLE_SKIPPED:
|
|
71
71
|
case actionNames.VIEW_TOGGLE_ONLY_DIFF:
|
|
72
72
|
case actionNames.VIEW_TOGGLE_SCALE_IMAGES:
|
|
73
|
-
case actionNames.VIEW_TOGGLE_LAZY_LOAD_IMAGES:
|
|
74
73
|
case actionNames.VIEW_TOGGLE_GROUP_BY_ERROR:
|
|
75
74
|
case actionNames.VIEW_UPDATE_BASE_HOST:
|
|
76
75
|
case actionNames.BROWSERS_SELECTED:
|
|
@@ -102,11 +101,7 @@ export default metrikaClass => store => next => action => {
|
|
|
102
101
|
case actionNames.TOGGLE_STATE_RESULT:
|
|
103
102
|
case actionNames.CHANGE_TEST_RETRY: {
|
|
104
103
|
execOnMetrikaEnabled(() => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (isUserClick) {
|
|
108
|
-
sendCounterId(action.type);
|
|
109
|
-
}
|
|
104
|
+
sendCounterId(action.type);
|
|
110
105
|
});
|
|
111
106
|
|
|
112
107
|
return next(action);
|
|
@@ -3,12 +3,14 @@ import actionNames from '../action-names';
|
|
|
3
3
|
|
|
4
4
|
export default (state, action) => {
|
|
5
5
|
switch (action.type) {
|
|
6
|
-
case actionNames.INIT_STATIC_REPORT:
|
|
6
|
+
case actionNames.INIT_STATIC_REPORT:
|
|
7
|
+
case actionNames.INIT_GUI_REPORT: {
|
|
7
8
|
const {db} = action.payload;
|
|
8
9
|
return {...state, db};
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
case actionNames.FIN_STATIC_REPORT:
|
|
12
|
+
case actionNames.FIN_STATIC_REPORT:
|
|
13
|
+
case actionNames.FIN_GUI_REPORT: {
|
|
12
14
|
closeDatabase(state.db);
|
|
13
15
|
|
|
14
16
|
return state;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {get, set} from 'lodash';
|
|
2
|
+
import {EXPAND_ALL, EXPAND_ERRORS, EXPAND_RETRIES} from '../../../../constants/expand-modes';
|
|
3
|
+
|
|
4
|
+
export function changeNodeState(nodesStateById, nodeId, state) {
|
|
5
|
+
Object.keys(state).forEach((stateName) => {
|
|
6
|
+
const prevStateValue = get(nodesStateById[nodeId], stateName);
|
|
7
|
+
|
|
8
|
+
if (prevStateValue !== state[stateName]) {
|
|
9
|
+
set(nodesStateById, [nodeId, stateName], state[stateName]);
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function shouldNodeBeOpened(expand, {errorsCb, retriesCb}) {
|
|
15
|
+
if (expand === EXPAND_ERRORS) {
|
|
16
|
+
return errorsCb();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (expand === EXPAND_RETRIES) {
|
|
20
|
+
return retriesCb();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (expand === EXPAND_ALL) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import {produce} from 'immer';
|
|
2
|
+
import actionNames from '../../action-names';
|
|
3
|
+
import {
|
|
4
|
+
initSuitesState, changeAllSuitesState, changeSuiteState, updateSuitesStatus,
|
|
5
|
+
getFailedRootSuiteIds, updateAllSuitesStatus, calcSuitesShowness, calcSuitesOpenness
|
|
6
|
+
} from './nodes/suites';
|
|
7
|
+
import {
|
|
8
|
+
initBrowsersState, changeAllBrowsersState, changeBrowserState,
|
|
9
|
+
calcBrowsersShowness, calcBrowsersOpenness, setBrowsersLastRetry
|
|
10
|
+
} from './nodes/browsers';
|
|
11
|
+
import {addResult} from './nodes/results';
|
|
12
|
+
import {
|
|
13
|
+
initImagesState, changeAllImagesState, changeImageState, addImages, calcImagesOpenness
|
|
14
|
+
} from './nodes/images';
|
|
15
|
+
import viewModes from '../../../../constants/view-modes';
|
|
16
|
+
import {EXPAND_RETRIES} from '../../../../constants/expand-modes';
|
|
17
|
+
|
|
18
|
+
export default produce((state, action) => {
|
|
19
|
+
switch (action.type) {
|
|
20
|
+
case actionNames.INIT_GUI_REPORT:
|
|
21
|
+
case actionNames.INIT_STATIC_REPORT: {
|
|
22
|
+
const {tree} = action.payload;
|
|
23
|
+
const {filteredBrowsers} = state.view;
|
|
24
|
+
|
|
25
|
+
state.tree = tree;
|
|
26
|
+
state.tree.suites.failedRootIds = getFailedRootSuiteIds(tree.suites);
|
|
27
|
+
|
|
28
|
+
state.tree.suites.stateById = {};
|
|
29
|
+
state.tree.browsers.stateById = {};
|
|
30
|
+
state.tree.images.stateById = {};
|
|
31
|
+
|
|
32
|
+
updateAllSuitesStatus(state.tree, filteredBrowsers);
|
|
33
|
+
initNodesStates(state);
|
|
34
|
+
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
case actionNames.RUN_ALL_TESTS: {
|
|
39
|
+
const {status} = action.payload;
|
|
40
|
+
const {tree} = state;
|
|
41
|
+
|
|
42
|
+
tree.suites.allIds.forEach((suiteId) => {
|
|
43
|
+
tree.suites.byId[suiteId].status = status;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
case actionNames.TEST_BEGIN: {
|
|
50
|
+
[].concat(action.payload).forEach(({result, suites}) => {
|
|
51
|
+
addResult(state.tree, result);
|
|
52
|
+
setBrowsersLastRetry(state.tree, result.parentId);
|
|
53
|
+
updateSuitesStatus(state.tree, suites);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
case actionNames.TEST_RESULT:
|
|
60
|
+
case actionNames.ACCEPT_OPENED_SCREENSHOTS:
|
|
61
|
+
case actionNames.ACCEPT_SCREENSHOT: {
|
|
62
|
+
addNodesToTree(state, action.payload);
|
|
63
|
+
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
case actionNames.TOGGLE_SUITE_SECTION: {
|
|
68
|
+
const {suiteId, shouldBeOpened} = action.payload;
|
|
69
|
+
|
|
70
|
+
changeSuiteState(state.tree, suiteId, {shouldBeOpened});
|
|
71
|
+
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
case actionNames.TOGGLE_BROWSER_SECTION: {
|
|
76
|
+
const {browserId, shouldBeOpened} = action.payload;
|
|
77
|
+
|
|
78
|
+
changeBrowserState(state.tree, browserId, {shouldBeOpened});
|
|
79
|
+
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
case actionNames.TOGGLE_STATE_RESULT: {
|
|
84
|
+
const {imageId, shouldBeOpened} = action.payload;
|
|
85
|
+
|
|
86
|
+
changeImageState(state.tree, imageId, {shouldBeOpened});
|
|
87
|
+
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
case actionNames.CHANGE_TEST_RETRY: {
|
|
92
|
+
const {browserId, retryIndex} = action.payload;
|
|
93
|
+
|
|
94
|
+
changeBrowserState(state.tree, browserId, {retryIndex});
|
|
95
|
+
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
case actionNames.BROWSERS_SELECTED: {
|
|
100
|
+
const {tree, view} = state;
|
|
101
|
+
|
|
102
|
+
updateAllSuitesStatus(tree, view.filteredBrowsers);
|
|
103
|
+
calcBrowsersShowness(tree, view);
|
|
104
|
+
calcSuitesShowness(tree);
|
|
105
|
+
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
case actionNames.VIEW_SHOW_ALL:
|
|
110
|
+
case actionNames.VIEW_SHOW_FAILED:
|
|
111
|
+
case actionNames.VIEW_UPDATE_FILTER_BY_NAME:
|
|
112
|
+
case actionNames.VIEW_SET_STRICT_MATCH_FILTER: {
|
|
113
|
+
const {tree, view} = state;
|
|
114
|
+
|
|
115
|
+
calcBrowsersShowness(tree, view);
|
|
116
|
+
calcSuitesShowness(tree);
|
|
117
|
+
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
case actionNames.VIEW_EXPAND_ALL: {
|
|
122
|
+
changeAllNodesState(state.tree, {shouldBeOpened: true});
|
|
123
|
+
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
case actionNames.VIEW_COLLAPSE_ALL: {
|
|
128
|
+
changeAllNodesState(state.tree, {shouldBeOpened: false});
|
|
129
|
+
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
case actionNames.VIEW_EXPAND_ERRORS:
|
|
134
|
+
case actionNames.VIEW_EXPAND_RETRIES: {
|
|
135
|
+
const {tree, view} = state;
|
|
136
|
+
|
|
137
|
+
calcSuitesOpenness(tree, view.expand);
|
|
138
|
+
calcBrowsersOpenness(tree, view.expand);
|
|
139
|
+
calcImagesOpenness(tree, view.expand);
|
|
140
|
+
|
|
141
|
+
setBrowsersLastRetry(tree);
|
|
142
|
+
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
case actionNames.CLOSE_SECTIONS: {
|
|
147
|
+
const closeImageIds = action.payload;
|
|
148
|
+
|
|
149
|
+
closeImageIds.forEach((imageId) => {
|
|
150
|
+
changeImageState(state.tree, imageId, {shouldBeOpened: false});
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
case actionNames.TOGGLE_ERROR_GROUP: {
|
|
157
|
+
const {browserIds, isActive} = action.payload;
|
|
158
|
+
const {tree, view} = state;
|
|
159
|
+
|
|
160
|
+
if (!isActive) {
|
|
161
|
+
changeAllBrowsersState(tree, {shouldBeShown: false});
|
|
162
|
+
changeAllSuitesState(tree, {shouldBeShown: false});
|
|
163
|
+
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
calcBrowsersShowness(tree, view, browserIds);
|
|
168
|
+
|
|
169
|
+
tree.browsers.allIds.forEach((browserId) => {
|
|
170
|
+
const {shouldBeShown} = tree.browsers.stateById[browserId];
|
|
171
|
+
|
|
172
|
+
if (browserIds.includes(browserId) || !shouldBeShown) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
changeBrowserState(tree, browserId, {shouldBeShown: false});
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
calcSuitesShowness(tree);
|
|
180
|
+
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
case actionNames.VIEW_TOGGLE_GROUP_BY_ERROR: {
|
|
185
|
+
const {tree, view} = state;
|
|
186
|
+
|
|
187
|
+
if (view.groupByError) {
|
|
188
|
+
changeAllBrowsersState(tree, {shouldBeShown: false});
|
|
189
|
+
changeAllSuitesState(tree, {shouldBeShown: false});
|
|
190
|
+
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
calcBrowsersShowness(tree, view);
|
|
195
|
+
calcSuitesShowness(tree);
|
|
196
|
+
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
function initNodesStates(state) {
|
|
203
|
+
const {tree, view} = state;
|
|
204
|
+
|
|
205
|
+
initBrowsersState(tree, view);
|
|
206
|
+
initSuitesState(tree, view);
|
|
207
|
+
initImagesState(tree, view.expand);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function addNodesToTree(state, payload) {
|
|
211
|
+
const {tree, view} = state;
|
|
212
|
+
|
|
213
|
+
[].concat(payload).forEach(({result, images, suites}) => {
|
|
214
|
+
addResult(tree, result);
|
|
215
|
+
setBrowsersLastRetry(tree, result.parentId);
|
|
216
|
+
addImages(tree, images, view.expand);
|
|
217
|
+
updateSuitesStatus(tree, suites);
|
|
218
|
+
|
|
219
|
+
const browserId = result.parentId;
|
|
220
|
+
const youngestSuiteId = tree.browsers.byId[browserId].parentId;
|
|
221
|
+
const suiteIds = view.expand === EXPAND_RETRIES ? youngestSuiteId : suites.map(({id}) => id);
|
|
222
|
+
const imageIds = images.map(({id}) => id);
|
|
223
|
+
|
|
224
|
+
calcSuitesOpenness(tree, view.expand, suiteIds);
|
|
225
|
+
calcBrowsersOpenness(tree, view.expand, browserId);
|
|
226
|
+
calcImagesOpenness(tree, view.expand, imageIds);
|
|
227
|
+
|
|
228
|
+
if (view.viewMode === viewModes.FAILED) {
|
|
229
|
+
calcBrowsersShowness(tree, view, browserId);
|
|
230
|
+
calcSuitesShowness(tree, youngestSuiteId);
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
tree.suites.failedRootIds = getFailedRootSuiteIds(tree.suites);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function changeAllNodesState(tree, state) {
|
|
238
|
+
changeAllSuitesState(tree, state);
|
|
239
|
+
changeAllBrowsersState(tree, state);
|
|
240
|
+
changeAllImagesState(tree, state);
|
|
241
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import {isStatusMatchViewMode, isTestNameMatchFilters, shouldShowBrowser} from '../../../utils';
|
|
3
|
+
import {isNodeFailed} from '../../../utils';
|
|
4
|
+
import {changeNodeState, shouldNodeBeOpened} from '../helpers';
|
|
5
|
+
|
|
6
|
+
export function initBrowsersState(tree, view) {
|
|
7
|
+
tree.browsers.allIds.forEach((browserId) => {
|
|
8
|
+
setBrowsersLastRetry(tree, browserId);
|
|
9
|
+
|
|
10
|
+
if (view.groupByError) {
|
|
11
|
+
changeBrowserState(tree, browserId, {shouldBeShown: false});
|
|
12
|
+
} else {
|
|
13
|
+
calcBrowsersShowness(tree, view, browserId);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
calcBrowsersOpenness(tree, view.expand, browserId);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function changeAllBrowsersState(tree, state) {
|
|
21
|
+
tree.browsers.allIds.forEach((browserId) => {
|
|
22
|
+
const retryIndex = getLastRetryIndex(tree, browserId);
|
|
23
|
+
changeBrowserState(tree, browserId, {retryIndex, ...state});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function changeBrowserState(tree, browserId, state) {
|
|
28
|
+
changeNodeState(tree.browsers.stateById, browserId, state);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function setBrowsersLastRetry(tree, browserIds) {
|
|
32
|
+
if (_.isEmpty(browserIds)) {
|
|
33
|
+
browserIds = tree.browsers.allIds;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
[].concat(browserIds).forEach((browserId) => {
|
|
37
|
+
const retryIndex = getLastRetryIndex(tree, browserId);
|
|
38
|
+
changeBrowserState(tree, browserId, {retryIndex});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function calcBrowsersShowness(tree, view, browserIds) {
|
|
43
|
+
if (_.isEmpty(browserIds)) {
|
|
44
|
+
browserIds = tree.browsers.allIds;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
[].concat(browserIds).forEach((browserId) => {
|
|
48
|
+
const browser = tree.browsers.byId[browserId];
|
|
49
|
+
const lastResult = tree.results.byId[_.last(browser.resultIds)];
|
|
50
|
+
const shouldBeShown = calcBrowserShowness(browser, lastResult, view);
|
|
51
|
+
|
|
52
|
+
changeBrowserState(tree, browserId, {shouldBeShown});
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function calcBrowsersOpenness(tree, expand, browserIds) {
|
|
57
|
+
if (_.isEmpty(browserIds)) {
|
|
58
|
+
browserIds = tree.browsers.allIds;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
[].concat(browserIds).forEach((browserId) => {
|
|
62
|
+
const browser = tree.browsers.byId[browserId];
|
|
63
|
+
const lastResult = tree.results.byId[_.last(browser.resultIds)];
|
|
64
|
+
const shouldBeOpened = calcBrowserOpenness(browser, lastResult, expand, tree);
|
|
65
|
+
|
|
66
|
+
changeBrowserState(tree, browserId, {shouldBeOpened});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function getLastRetryIndex(tree, browserId) {
|
|
71
|
+
return tree.browsers.byId[browserId].resultIds.length - 1;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function calcBrowserOpenness(browser, lastResult, expand, tree) {
|
|
75
|
+
const errorsCb = () => isNodeFailed(lastResult);
|
|
76
|
+
const retriesCb = () => {
|
|
77
|
+
const retries = [].concat(_.initial(browser.resultIds)).map((resultId) => tree.results.byId[resultId]);
|
|
78
|
+
|
|
79
|
+
return retries.some((retry) => isNodeFailed(retry));
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
return shouldNodeBeOpened(expand, {errorsCb, retriesCb});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function calcBrowserShowness(browser, lastResult, view) {
|
|
86
|
+
const {viewMode, filteredBrowsers, testNameFilter, strictMatchFilter} = view;
|
|
87
|
+
|
|
88
|
+
if (!isStatusMatchViewMode(lastResult.status, viewMode)) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const testName = browser.parentId;
|
|
93
|
+
|
|
94
|
+
if (!isTestNameMatchFilters(testName, testNameFilter, strictMatchFilter)) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return shouldShowBrowser(browser, filteredBrowsers);
|
|
99
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import {isNodeFailed} from '../../../utils';
|
|
3
|
+
import {changeNodeState, shouldNodeBeOpened} from '../helpers';
|
|
4
|
+
|
|
5
|
+
export function initImagesState(tree, expand) {
|
|
6
|
+
calcImagesOpenness(tree, expand);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function calcImagesOpenness(tree, expand, imageIds) {
|
|
10
|
+
if (_.isEmpty(imageIds)) {
|
|
11
|
+
imageIds = tree.images.allIds;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
[].concat(imageIds).forEach((imageId) => {
|
|
15
|
+
const image = tree.images.byId[imageId];
|
|
16
|
+
const shouldBeOpened = calcImageOpenness(image, expand);
|
|
17
|
+
|
|
18
|
+
changeImageState(tree, imageId, {shouldBeOpened});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function changeAllImagesState(tree, state) {
|
|
23
|
+
tree.images.allIds.forEach((imageId) => {
|
|
24
|
+
changeImageState(tree, imageId, state);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function changeImageState(tree, imageId, state) {
|
|
29
|
+
changeNodeState(tree.images.stateById, imageId, state);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function addImages(tree, images, expand) {
|
|
33
|
+
images.forEach((image) => {
|
|
34
|
+
tree.images.byId[image.id] = image;
|
|
35
|
+
|
|
36
|
+
if (!tree.images.allIds.includes(image.id)) {
|
|
37
|
+
tree.images.allIds.push(image.id);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const shouldBeOpened = calcImageOpenness(image, expand);
|
|
41
|
+
changeImageState(tree, image.id, {shouldBeOpened});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function calcImageOpenness(image, expand) {
|
|
46
|
+
const errorsCb = () => isNodeFailed(image);
|
|
47
|
+
const retriesCb = errorsCb;
|
|
48
|
+
|
|
49
|
+
return shouldNodeBeOpened(expand, {errorsCb, retriesCb});
|
|
50
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function addResult(tree, result) {
|
|
2
|
+
tree.results.byId[result.id] = result;
|
|
3
|
+
|
|
4
|
+
if (!tree.results.allIds.includes(result.id)) {
|
|
5
|
+
tree.results.allIds.push(result.id);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const browserId = result.parentId;
|
|
9
|
+
|
|
10
|
+
if (!tree.browsers.byId[browserId].resultIds.includes(result.id)) {
|
|
11
|
+
tree.browsers.byId[browserId].resultIds.push(result.id);
|
|
12
|
+
}
|
|
13
|
+
}
|