html-reporter 7.7.0 → 7.7.1

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.
@@ -13,7 +13,7 @@ export default {
13
13
  SUITE_BEGIN: 'SUITE_BEGIN',
14
14
  TEST_BEGIN: 'TEST_BEGIN',
15
15
  TEST_RESULT: 'TEST_RESULT',
16
- TESTS_END: 'TEST_END',
16
+ TESTS_END: 'TESTS_END',
17
17
  ACCEPT_SCREENSHOT: 'ACCEPT_SCREENSHOT',
18
18
  ACCEPT_OPENED_SCREENSHOTS: 'ACCEPT_OPENED_SCREENSHOTS',
19
19
  CLOSE_SECTIONS: 'CLOSE_SECTIONS',
@@ -5,9 +5,8 @@ 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';
9
8
  import {getHttpErrorMessage} from './utils';
10
- import {fetchDatabases, mergeDatabases, connectToDatabase} from './sqlite';
9
+ import {fetchDatabases, mergeDatabases, connectToDatabase, getMainDatabaseUrl} from './sqlite';
11
10
  import {getSuitesTableRows} from './database-utils';
12
11
  import {setFilteredBrowsers} from './query-params';
13
12
  import plugins from './plugins';
@@ -23,7 +22,7 @@ export const initGuiReport = () => {
23
22
  try {
24
23
  const appState = await axios.get('/init');
25
24
 
26
- const mainDatabaseUrl = new URL(LOCAL_DATABASE_NAME, window.location.href);
25
+ const mainDatabaseUrl = getMainDatabaseUrl();
27
26
  const db = await connectToDatabase(mainDatabaseUrl.href);
28
27
 
29
28
  await plugins.loadAll(appState.data.config);
@@ -148,6 +147,20 @@ export const stopTests = () => async dispatch => {
148
147
  }
149
148
  };
150
149
 
150
+ export const testsEnd = () => async dispatch => {
151
+ try {
152
+ const mainDatabaseUrl = getMainDatabaseUrl();
153
+ const db = await connectToDatabase(mainDatabaseUrl.href);
154
+
155
+ dispatch({
156
+ type: actionNames.TESTS_END,
157
+ payload: {db}
158
+ });
159
+ } catch (e) {
160
+ dispatch(createNotificationError('testsEnd', e));
161
+ }
162
+ };
163
+
151
164
  export const suiteBegin = (suite) => ({type: actionNames.SUITE_BEGIN, payload: suite});
152
165
  export const testBegin = (test) => ({type: actionNames.TEST_BEGIN, payload: test});
153
166
  export const testResult = (result) => ({type: actionNames.TEST_RESULT, payload: result});
@@ -157,7 +170,6 @@ export const toggleLoading = (payload) => ({type: actionNames.TOGGLE_LOADING, pa
157
170
  export const closeSections = (payload) => ({type: actionNames.CLOSE_SECTIONS, payload});
158
171
  export const openModal = (payload) => ({type: actionNames.OPEN_MODAL, payload});
159
172
  export const closeModal = (payload) => ({type: actionNames.CLOSE_MODAL, payload});
160
- export const testsEnd = () => ({type: actionNames.TESTS_END});
161
173
  export const runFailed = () => ({type: actionNames.RUN_FAILED_TESTS});
162
174
  export const expandAll = () => ({type: actionNames.VIEW_EXPAND_ALL});
163
175
  export const expandErrors = () => ({type: actionNames.VIEW_EXPAND_ERRORS});
@@ -11,6 +11,7 @@ import immer from 'immer';
11
11
  import * as reselect from 'reselect';
12
12
  import axios from 'axios';
13
13
  import * as selectors from './selectors';
14
+ import actionNames from './action-names';
14
15
  import Details from '../components/details';
15
16
 
16
17
  const whitelistedDeps = {
@@ -85,7 +86,7 @@ async function initPlugin(plugin, pluginName, pluginConfig) {
85
86
  const depArgs = deps.map(dep => whitelistedDeps[dep]);
86
87
  // cyclic dep, resolve it dynamically
87
88
  const actions = await import('./actions');
88
- return plugin(...depArgs, {pluginName, pluginConfig, actions, selectors});
89
+ return plugin(...depArgs, {pluginName, pluginConfig, actions, actionNames, selectors});
89
90
  }
90
91
 
91
92
  return plugin;
@@ -6,6 +6,14 @@ export default (state, action) => {
6
6
  case actionNames.INIT_STATIC_REPORT:
7
7
  case actionNames.INIT_GUI_REPORT: {
8
8
  const {db} = action.payload;
9
+
10
+ return {...state, db};
11
+ }
12
+
13
+ case actionNames.TESTS_END: {
14
+ closeDatabase(state.db); // close previous connection in order to free memory
15
+ const {db} = action.payload;
16
+
9
17
  return {...state, db};
10
18
  }
11
19
 
@@ -3,6 +3,7 @@
3
3
  import axios from 'axios';
4
4
  import {flattenDeep} from 'lodash';
5
5
  import {mergeTables} from '../../common-utils';
6
+ import {LOCAL_DATABASE_NAME} from '../../constants/file-names';
6
7
 
7
8
  function isRelativeUrl(url) {
8
9
  try {
@@ -139,8 +140,13 @@ async function connectToDatabase(dbUrl) {
139
140
  return new SQL.Database(new Uint8Array(data));
140
141
  }
141
142
 
143
+ function getMainDatabaseUrl() {
144
+ return new URL(LOCAL_DATABASE_NAME, window.location.href);
145
+ }
146
+
142
147
  module.exports = {
143
148
  fetchDatabases,
144
149
  mergeDatabases,
145
- connectToDatabase
150
+ connectToDatabase,
151
+ getMainDatabaseUrl
146
152
  };