html-reporter 7.3.0 → 7.6.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 +43 -0
- package/README.md +44 -8
- package/lib/common-utils.js +13 -14
- package/lib/constants/extension-points.js +2 -0
- package/lib/constants/plugin-events.js +10 -0
- package/lib/gui/server.js +11 -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/sqlite-adapter.js +4 -1
- package/lib/static/components/controls/gui-controls.js +8 -2
- package/lib/static/components/gui.js +24 -11
- package/lib/static/components/report.js +19 -10
- package/lib/static/components/section/body/result.js +5 -1
- package/lib/static/data.js +2 -0
- package/lib/static/databaseUrls.json +1 -0
- package/lib/static/gui.html +1 -1
- package/lib/static/gui.min.js +15 -15
- package/lib/static/modules/action-names.js +2 -0
- package/lib/static/modules/actions.js +16 -2
- package/lib/static/modules/default-state.js +1 -0
- package/lib/static/modules/reducers/db.js +4 -2
- package/lib/static/modules/reducers/index.js +2 -0
- package/lib/static/modules/reducers/stopping.js +16 -0
- package/lib/static/modules/reducers/tree/nodes/suites.js +19 -9
- package/lib/static/modules/sqlite.js +20 -15
- package/lib/static/report.min.js +15 -15
- package/lib/static/sql-wasm.js +215 -0
- package/package.json +4 -4
- package/sqlite.db +0 -0
- package/webpack.common.js +5 -0
- package/lib/static/0.min.js +0 -16
- package/lib/static/2.min.js +0 -16
|
@@ -3,9 +3,11 @@
|
|
|
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',
|
|
10
|
+
STOP_TESTS: 'STOP_TESTS',
|
|
9
11
|
RETRY_SUITE: 'RETRY_SUITE',
|
|
10
12
|
RETRY_TEST: 'RETRY_TEST',
|
|
11
13
|
SUITE_BEGIN: 'SUITE_BEGIN',
|
|
@@ -5,8 +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 {LOCAL_DATABASE_NAME} from '../../constants/file-names';
|
|
8
9
|
import {getHttpErrorMessage} from './utils';
|
|
9
|
-
import {fetchDatabases, mergeDatabases} from './sqlite';
|
|
10
|
+
import {fetchDatabases, mergeDatabases, connectToDatabase} from './sqlite';
|
|
10
11
|
import {getSuitesTableRows} from './database-utils';
|
|
11
12
|
import {setFilteredBrowsers} from './query-params';
|
|
12
13
|
import plugins from './plugins';
|
|
@@ -22,11 +23,14 @@ export const initGuiReport = () => {
|
|
|
22
23
|
try {
|
|
23
24
|
const appState = await axios.get('/init');
|
|
24
25
|
|
|
26
|
+
const mainDatabaseUrl = new URL(LOCAL_DATABASE_NAME, window.location.href);
|
|
27
|
+
const db = await connectToDatabase(mainDatabaseUrl.href);
|
|
28
|
+
|
|
25
29
|
await plugins.loadAll(appState.data.config);
|
|
26
30
|
|
|
27
31
|
dispatch({
|
|
28
32
|
type: actionNames.INIT_GUI_REPORT,
|
|
29
|
-
payload: appState.data
|
|
33
|
+
payload: {...appState.data, db}
|
|
30
34
|
});
|
|
31
35
|
|
|
32
36
|
const {customGuiError} = appState.data;
|
|
@@ -80,6 +84,7 @@ export const initStaticReport = () => {
|
|
|
80
84
|
};
|
|
81
85
|
};
|
|
82
86
|
|
|
87
|
+
export const finGuiReport = () => ({type: actionNames.FIN_GUI_REPORT});
|
|
83
88
|
export const finStaticReport = () => ({type: actionNames.FIN_STATIC_REPORT});
|
|
84
89
|
|
|
85
90
|
const runTests = ({tests = [], action = {}} = {}) => {
|
|
@@ -134,6 +139,15 @@ export const acceptTest = (imageId) => {
|
|
|
134
139
|
return acceptOpened([imageId], actionNames.ACCEPT_SCREENSHOT);
|
|
135
140
|
};
|
|
136
141
|
|
|
142
|
+
export const stopTests = () => async dispatch => {
|
|
143
|
+
try {
|
|
144
|
+
await axios.post('/stop');
|
|
145
|
+
dispatch({type: actionNames.STOP_TESTS});
|
|
146
|
+
} catch (e) {
|
|
147
|
+
console.error(`Error while stopping tests: {e}`);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
137
151
|
export const suiteBegin = (suite) => ({type: actionNames.SUITE_BEGIN, payload: suite});
|
|
138
152
|
export const testBegin = (test) => ({type: actionNames.TEST_BEGIN, payload: test});
|
|
139
153
|
export const testResult = (result) => ({type: actionNames.TEST_RESULT, payload: result});
|
|
@@ -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;
|
|
@@ -22,6 +22,7 @@ import skips from './skips';
|
|
|
22
22
|
import view from './view';
|
|
23
23
|
import plugins from './plugins';
|
|
24
24
|
import groupedErrors from './grouped-errors';
|
|
25
|
+
import stopping from './stopping';
|
|
25
26
|
|
|
26
27
|
// The order of specifying reducers is important.
|
|
27
28
|
// At the top specify reducers that does not depend on other state fields.
|
|
@@ -31,6 +32,7 @@ export default reduceReducers(
|
|
|
31
32
|
notifications,
|
|
32
33
|
running,
|
|
33
34
|
processing,
|
|
35
|
+
stopping,
|
|
34
36
|
loading,
|
|
35
37
|
gui,
|
|
36
38
|
date,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import actionNames from '../action-names';
|
|
2
|
+
|
|
3
|
+
export default (state = {}, action) => {
|
|
4
|
+
switch (action.type) {
|
|
5
|
+
case actionNames.STOP_TESTS: {
|
|
6
|
+
return {...state, stopping: true};
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
case actionNames.TESTS_END: {
|
|
10
|
+
return {...state, stopping: false};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
default:
|
|
14
|
+
return state;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -61,10 +61,7 @@ export function calcSuitesShowness(tree, suiteIds) {
|
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
const changeParentSuiteCb = (parentSuite) => {
|
|
64
|
-
|
|
65
|
-
.some((suiteId) => tree.suites.stateById[suiteId].shouldBeShown);
|
|
66
|
-
|
|
67
|
-
changeSuiteState(tree, parentSuite.id, {shouldBeShown});
|
|
64
|
+
changeSuiteState(tree, parentSuite.id, {shouldBeShown: shouldSuiteBeShown(parentSuite, tree)});
|
|
68
65
|
};
|
|
69
66
|
|
|
70
67
|
calcParentSuitesState(youngestSuites, tree, changeParentSuiteCb);
|
|
@@ -96,10 +93,7 @@ export function calcSuitesOpenness(tree, expand, suiteIds) {
|
|
|
96
93
|
});
|
|
97
94
|
|
|
98
95
|
const changeParentSuiteCb = (parentSuite) => {
|
|
99
|
-
|
|
100
|
-
.some((suiteId) => tree.suites.stateById[suiteId].shouldBeOpened);
|
|
101
|
-
|
|
102
|
-
changeSuiteState(tree, parentSuite.id, {shouldBeOpened});
|
|
96
|
+
changeSuiteState(tree, parentSuite.id, {shouldBeOpened: shouldSuiteBeOpened(parentSuite, tree)});
|
|
103
97
|
};
|
|
104
98
|
|
|
105
99
|
calcParentSuitesState(youngestSuites, tree, changeParentSuiteCb);
|
|
@@ -142,7 +136,10 @@ function sortSuitesByNesting(suites) {
|
|
|
142
136
|
|
|
143
137
|
function getYoungestSuites(tree) {
|
|
144
138
|
return tree.suites.allIds
|
|
145
|
-
.filter((suiteId) =>
|
|
139
|
+
.filter((suiteId) => {
|
|
140
|
+
const suite = tree.suites.byId[suiteId];
|
|
141
|
+
return _.isEmpty(suite.suiteIds) && !_.isEmpty(suite.browserIds);
|
|
142
|
+
})
|
|
146
143
|
.map((suiteId) => tree.suites.byId[suiteId]);
|
|
147
144
|
}
|
|
148
145
|
|
|
@@ -158,6 +155,19 @@ function calcSuiteOpenness(suite, expand, tree) {
|
|
|
158
155
|
return shouldNodeBeOpened(expand, {errorsCb, retriesCb});
|
|
159
156
|
}
|
|
160
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
|
+
|
|
161
171
|
function updateParentSuitesStatus(tree, suitesIds = [], filteredBrowsers) {
|
|
162
172
|
if (!suitesIds || !suitesIds.length) {
|
|
163
173
|
return;
|
|
@@ -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
|
};
|