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
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,54 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
<a name="7.4.0"></a>
|
|
6
|
+
# [7.4.0](https://github.com/gemini-testing/html-reporter/compare/v7.3.1...v7.4.0) (2021-10-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* merge all existing tables inside sqlite database ([#404](https://github.com/gemini-testing/html-reporter/issues/404)) ([5c727fd](https://github.com/gemini-testing/html-reporter/commit/5c727fd))
|
|
12
|
+
* **gui:** add ability to use db connection on client side ([#402](https://github.com/gemini-testing/html-reporter/issues/402)) ([8f445e3](https://github.com/gemini-testing/html-reporter/commit/8f445e3))
|
|
13
|
+
* add "result_meta" extension point for html-reporter plugins ([#401](https://github.com/gemini-testing/html-reporter/issues/401)) ([fb52a0a](https://github.com/gemini-testing/html-reporter/commit/fb52a0a))
|
|
14
|
+
* add API with ability to access the database from other plugins ([#400](https://github.com/gemini-testing/html-reporter/issues/400)) ([0e9e97c](https://github.com/gemini-testing/html-reporter/commit/0e9e97c))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
<a name="7.3.1"></a>
|
|
19
|
+
## [7.3.1](https://github.com/gemini-testing/html-reporter/compare/v7.3.0...v7.3.1) (2021-09-20)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* correct calculation of suites state ([#398](https://github.com/gemini-testing/html-reporter/issues/398)) ([465e293](https://github.com/gemini-testing/html-reporter/commit/465e293))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
<a name="7.3.0"></a>
|
|
29
|
+
# [7.3.0](https://github.com/gemini-testing/html-reporter/compare/v7.2.0...v7.3.0) (2021-09-16)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* **gui:** incorrect tests counting ([#396](https://github.com/gemini-testing/html-reporter/issues/396)) ([b9ae4d8](https://github.com/gemini-testing/html-reporter/commit/b9ae4d8))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Features
|
|
38
|
+
|
|
39
|
+
* use react-virtualized to speed up report ([#391](https://github.com/gemini-testing/html-reporter/issues/391)) ([59a2dde](https://github.com/gemini-testing/html-reporter/commit/59a2dde))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
<a name="7.2.0"></a>
|
|
44
|
+
# [7.2.0](https://github.com/gemini-testing/html-reporter/compare/v7.1.0...v7.2.0) (2021-09-13)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Features
|
|
48
|
+
|
|
49
|
+
* remember users choice of opened suites, browsers, images, retries ([#394](https://github.com/gemini-testing/html-reporter/issues/394)) ([0990530](https://github.com/gemini-testing/html-reporter/commit/0990530))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
5
53
|
<a name="7.1.0"></a>
|
|
6
54
|
# [7.1.0](https://github.com/gemini-testing/html-reporter/compare/v7.0.3...v7.1.0) (2021-08-18)
|
|
7
55
|
|
package/README.md
CHANGED
|
@@ -42,8 +42,7 @@ directory.
|
|
|
42
42
|
* `failed` - show only failed tests.
|
|
43
43
|
|
|
44
44
|
* **baseHost** (optional) - `String` - it changes original host for view in the browser; by default original host does not change
|
|
45
|
-
* **scaleImages** (optional) – `Boolean` – fit images into page width; `false` by default
|
|
46
|
-
* **lazyLoadOffset** (optional) - `Number` - allows you to specify how far above and below the viewport you want to begin loading images. Lazy loading would be disabled if you specify 0. `800` by default.
|
|
45
|
+
* **scaleImages** (optional) – `Boolean` – fit images into page width; `false` by default.
|
|
47
46
|
* **errorPatterns** (optional) - `Array` - error message patterns are used:
|
|
48
47
|
|
|
49
48
|
* to show more understandable information about matched error;
|
|
@@ -289,7 +288,8 @@ directory.
|
|
|
289
288
|
```
|
|
290
289
|
|
|
291
290
|
Currently, there are extension points:
|
|
292
|
-
* `result` - allows to extend each test result; adds `resultId` and `testName` props to the plugin component
|
|
291
|
+
* `result` - allows to extend each test result; adds `resultId` and `testName` props to the plugin component;
|
|
292
|
+
* `result_meta` - allows to extend meta information of each test result; adds `result` and `testName` props to the plugin component;
|
|
293
293
|
* `menu-bar` - allows to extend menu bar.
|
|
294
294
|
|
|
295
295
|
An extension point may be extended by more than one component. In that case order of components application is determined by `plugins` config order. Each following component is applied to all previously composed components at the extension point.
|
|
@@ -373,7 +373,7 @@ Files that will be created during test execution:
|
|
|
373
373
|
|
|
374
374
|
## Additional commands
|
|
375
375
|
|
|
376
|
-
Additional commands that are added to the
|
|
376
|
+
Additional commands that are added to the hermione.
|
|
377
377
|
|
|
378
378
|
### gui
|
|
379
379
|
|
|
@@ -429,9 +429,44 @@ npm run test-func
|
|
|
429
429
|
|
|
430
430
|
Integration tests run on Chromium in headless mode.
|
|
431
431
|
|
|
432
|
-
##
|
|
432
|
+
## API
|
|
433
433
|
|
|
434
|
-
Html-reporter adds to
|
|
434
|
+
Html-reporter adds to `hermione` object with its own API.
|
|
435
|
+
|
|
436
|
+
**Properties of the `hermione.htmlReporter` object**
|
|
437
|
+
|
|
438
|
+
Property name | Description
|
|
439
|
+
------------------------- | -------------
|
|
440
|
+
`events` | Events list for subscription.
|
|
441
|
+
`extraItems` | Items list which will be added to the menu bar.
|
|
442
|
+
`metaInfoExtenders` | Items list which will be added to the meta info.
|
|
443
|
+
`imagesSaver` | Interface to save image into user storage.
|
|
444
|
+
`reportsSaver` | Interface to save sqlite database into user storage.
|
|
445
|
+
|
|
446
|
+
**Available events which are triggered in the main process**
|
|
447
|
+
|
|
448
|
+
Event | Description
|
|
449
|
+
------------------------- | -------------
|
|
450
|
+
`DATABASE_CREATED` | Will be triggered after sqlite database is created. The handler accepts a database instance. The event is synchronous.
|
|
451
|
+
|
|
452
|
+
### events
|
|
453
|
+
|
|
454
|
+
Example of a subscription to an event `DATABASE_CREATED` from another hermione-plugin in the main process:
|
|
455
|
+
|
|
456
|
+
```js
|
|
457
|
+
module.exports = (hermione, opts) => {
|
|
458
|
+
if (!opts.enabled || hermione.isWorker()) {
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// `htmlreporter` field is guaranteed to be in the `hermione` object when `INIT` event is emitted
|
|
463
|
+
hermione.on(hermione.events.INIT, () => {
|
|
464
|
+
hermione.htmlReporter.on(hermione.htmlReporter.events.DATABASE_CREATED, (db) => {
|
|
465
|
+
db.prepare(`CREATE TABLE IF NOT EXISTS test1 (foo TEXT, bar TEXT)`).run();
|
|
466
|
+
});
|
|
467
|
+
});
|
|
468
|
+
};
|
|
469
|
+
```
|
|
435
470
|
|
|
436
471
|
### addExtraItem
|
|
437
472
|
|
|
@@ -441,7 +476,7 @@ Adds item to html report as link:
|
|
|
441
476
|
@param {String} text of link
|
|
442
477
|
@param {String} url of link
|
|
443
478
|
|
|
444
|
-
|
|
479
|
+
hermione.htmlReporter.addExtraItem('some-text', 'some-url')
|
|
445
480
|
```
|
|
446
481
|
|
|
447
482
|
In this case url with link 'some-url' and text 'some-text' will be added to the menu bar.
|
|
@@ -451,7 +486,7 @@ In this case url with link 'some-url' and text 'some-text' will be added to the
|
|
|
451
486
|
Extend meta-info of each test using passed data:
|
|
452
487
|
|
|
453
488
|
```js
|
|
454
|
-
|
|
489
|
+
hermione.htmlReporter.addMetaInfoExtender(name, value);
|
|
455
490
|
```
|
|
456
491
|
|
|
457
492
|
* **name** (required) `String` - name of meta info
|
|
@@ -459,14 +494,13 @@ tool.htmlReporter.addMetaInfoExtender(name, value);
|
|
|
459
494
|
|
|
460
495
|
Example:
|
|
461
496
|
```js
|
|
462
|
-
|
|
497
|
+
hermione.htmlReporter.addMetaInfoExtender('foo', (data, extraItems) => {
|
|
463
498
|
return data.testName + extraItems.platform;
|
|
464
499
|
});
|
|
465
500
|
```
|
|
466
501
|
|
|
467
502
|
In this case a line `suite full name: some-platform` will be added to the meta info of each test.
|
|
468
503
|
|
|
469
|
-
|
|
470
504
|
### externalStorage
|
|
471
505
|
|
|
472
506
|
You can redefine native api for images or sqlite dbs saving and use your own storage.
|
package/lib/common-utils.js
CHANGED
|
@@ -27,6 +27,7 @@ const statusPriority = [
|
|
|
27
27
|
exports.isSuccessStatus = (status) => status === SUCCESS;
|
|
28
28
|
exports.isFailStatus = (status) => status === FAIL;
|
|
29
29
|
exports.isIdleStatus = (status) => status === IDLE;
|
|
30
|
+
exports.isRunningStatus = (status) => status === RUNNING;
|
|
30
31
|
exports.isErroredStatus = (status) => status === ERROR;
|
|
31
32
|
exports.isSkippedStatus = (status) => status === SKIPPED;
|
|
32
33
|
exports.isUpdatedStatus = (status) => status === UPDATED;
|
|
@@ -82,23 +83,22 @@ function createTableQuery(tableName, columns) {
|
|
|
82
83
|
return `CREATE TABLE IF NOT EXISTS ${tableName} (${formattedColumns})`;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
exports.
|
|
86
|
-
|
|
87
|
-
DB_SUITES_TABLE_NAME
|
|
88
|
-
];
|
|
89
|
-
const mkMergeQuery = (table) => `INSERT OR IGNORE INTO ${table} SELECT * FROM attached.${table}`;
|
|
90
|
-
const queries = [].concat(
|
|
91
|
-
`PRAGMA page_size = ${DB_MAX_AVAILABLE_PAGE_SIZE}`,
|
|
92
|
-
exports.createTablesQuery(),
|
|
93
|
-
);
|
|
86
|
+
exports.mergeTables = ({db, dbPaths, getExistingTables = () => {}}) => {
|
|
87
|
+
db.prepare(`PRAGMA page_size = ${DB_MAX_AVAILABLE_PAGE_SIZE}`).run();
|
|
94
88
|
|
|
95
89
|
for (const dbPath of dbPaths) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
90
|
+
db.prepare(`ATTACH '${dbPath}' AS attached`).run();
|
|
91
|
+
|
|
92
|
+
const getTablesStatement = db.prepare(`SELECT name FROM attached.sqlite_master WHERE type='table'`);
|
|
93
|
+
const tables = getExistingTables(getTablesStatement);
|
|
100
94
|
|
|
101
|
-
|
|
95
|
+
for (const tableName of tables) {
|
|
96
|
+
db.prepare(`CREATE TABLE IF NOT EXISTS ${tableName} AS SELECT * FROM attached.${tableName} LIMIT 0`).run();
|
|
97
|
+
db.prepare(`INSERT OR IGNORE INTO ${tableName} SELECT * FROM attached.${tableName}`).run();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
db.prepare(`DETACH attached`).run();
|
|
101
|
+
}
|
|
102
102
|
};
|
|
103
103
|
|
|
104
104
|
exports.compareDatabaseRowsByTimestamp = (row1, row2) => {
|
package/lib/config/index.js
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
const _ = require('lodash');
|
|
4
4
|
const configParser = require('gemini-configparser');
|
|
5
|
+
const chalk = require('chalk');
|
|
6
|
+
|
|
7
|
+
const {logger} = require('../server-utils');
|
|
8
|
+
const {config: configDefaults} = require('../constants/defaults');
|
|
9
|
+
const saveFormats = require('../constants/save-formats');
|
|
10
|
+
const {assertCustomGui} = require('./custom-gui-asserts');
|
|
5
11
|
|
|
6
12
|
const root = configParser.root;
|
|
7
13
|
const section = configParser.section;
|
|
@@ -12,11 +18,6 @@ const CLI_PREFIX = '--html-reporter-';
|
|
|
12
18
|
|
|
13
19
|
const ALLOWED_PLUGIN_DESCRIPTION_FIELDS = new Set(['name', 'component', 'point', 'position', 'config']);
|
|
14
20
|
|
|
15
|
-
const {config: configDefaults} = require('../constants/defaults');
|
|
16
|
-
const saveFormats = require('../constants/save-formats');
|
|
17
|
-
|
|
18
|
-
const {assertCustomGui} = require('./custom-gui-asserts');
|
|
19
|
-
|
|
20
21
|
const assertType = (name, validationFn, type) => {
|
|
21
22
|
return (v) => {
|
|
22
23
|
if (!validationFn(v)) {
|
|
@@ -121,6 +122,10 @@ const mapErrorPatterns = (errorPatterns) => {
|
|
|
121
122
|
});
|
|
122
123
|
};
|
|
123
124
|
|
|
125
|
+
const deprecationWarning = (name) => {
|
|
126
|
+
logger.warn(chalk.red(`Warning: field "${name}" is deprecated and will be removed soon from html-reporter config.`));
|
|
127
|
+
};
|
|
128
|
+
|
|
124
129
|
const getParser = () => {
|
|
125
130
|
return root(section({
|
|
126
131
|
enabled: option({
|
|
@@ -163,8 +168,7 @@ const getParser = () => {
|
|
|
163
168
|
}),
|
|
164
169
|
lazyLoadOffset: option({
|
|
165
170
|
defaultValue: configDefaults.lazyLoadOffset,
|
|
166
|
-
|
|
167
|
-
validate: assertNumber('lazyLoadOffset')
|
|
171
|
+
validate: (value) => _.isNull(value) || deprecationWarning('lazyLoadOffset')
|
|
168
172
|
}),
|
|
169
173
|
errorPatterns: option({
|
|
170
174
|
defaultValue: configDefaults.errorPatterns,
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports = Object.assign(commonClientEvents, {
|
|
3
|
+
module.exports = {
|
|
6
4
|
BEGIN_SUITE: 'beginSuite',
|
|
7
5
|
BEGIN_STATE: 'beginState',
|
|
8
6
|
|
|
@@ -12,4 +10,4 @@ module.exports = Object.assign(commonClientEvents, {
|
|
|
12
10
|
ERROR: 'err',
|
|
13
11
|
|
|
14
12
|
END: 'end'
|
|
15
|
-
}
|
|
13
|
+
};
|
package/lib/gui/server.js
CHANGED
|
@@ -9,7 +9,6 @@ const {INTERNAL_SERVER_ERROR, OK} = require('http-codes');
|
|
|
9
9
|
|
|
10
10
|
const App = require('./app');
|
|
11
11
|
const {MAX_REQUEST_SIZE, KEEP_ALIVE_TIMEOUT, HEADERS_TIMEOUT} = require('./constants/server');
|
|
12
|
-
const {IMAGES_PATH, ERROR_DETAILS_PATH} = require('../constants/paths');
|
|
13
12
|
const {logger, initializeCustomGui, runCustomGuiAction} = require('../server-utils');
|
|
14
13
|
const initPluginsRoutes = require('./routes/plugins');
|
|
15
14
|
|
|
@@ -26,9 +25,7 @@ exports.start = async ({paths, hermione, guiApi, configs}) => {
|
|
|
26
25
|
server.use(initPluginsRoutes(express.Router(), pluginConfig));
|
|
27
26
|
|
|
28
27
|
server.use(express.static(path.join(__dirname, '../static'), {index: 'gui.html'}));
|
|
29
|
-
server.use(express.static(process.cwd()));
|
|
30
|
-
server.use(`/${IMAGES_PATH}`, express.static(path.join(process.cwd(), pluginConfig.path, IMAGES_PATH)));
|
|
31
|
-
server.use(`/${ERROR_DETAILS_PATH}`, express.static(path.join(process.cwd(), pluginConfig.path, ERROR_DETAILS_PATH)));
|
|
28
|
+
server.use(express.static(path.join(process.cwd(), pluginConfig.path)));
|
|
32
29
|
|
|
33
30
|
server.get('/', (req, res) => res.sendFile(path.join(__dirname, '../static', 'gui.html')));
|
|
34
31
|
|
|
@@ -60,12 +60,14 @@ module.exports = class ToolRunner {
|
|
|
60
60
|
await mergeDatabasesForReuse(this._reportPath);
|
|
61
61
|
|
|
62
62
|
this._reportBuilder = GuiReportBuilder.create(this._hermione, this._pluginConfig, {reuse: true});
|
|
63
|
+
this._subscribeOnEvents();
|
|
64
|
+
|
|
65
|
+
this._collection = await this._readTests();
|
|
66
|
+
|
|
63
67
|
await this._reportBuilder.init();
|
|
64
68
|
await this._reportBuilder.saveStaticFiles();
|
|
65
69
|
|
|
66
|
-
this._subscribeOnEvents();
|
|
67
70
|
this._reportBuilder.setApiValues(this._hermione.htmlReporter.values);
|
|
68
|
-
this._collection = await this._readTests();
|
|
69
71
|
await this._handleRunnableCollection();
|
|
70
72
|
}
|
|
71
73
|
|
|
@@ -11,8 +11,7 @@ const NestedError = require('nested-error-stacks');
|
|
|
11
11
|
const StaticTestsTreeBuilder = require('../../tests-tree-builder/static');
|
|
12
12
|
const {logger} = require('../../server-utils');
|
|
13
13
|
const constantFileNames = require('../../constants/file-names');
|
|
14
|
-
const {
|
|
15
|
-
const {writeDatabaseUrlsFile} = require('../../server-utils');
|
|
14
|
+
const {mergeTables, selectAllSuitesQuery, compareDatabaseRowsByTimestamp} = require('../../common-utils');
|
|
16
15
|
|
|
17
16
|
exports.formatId = (hash, browserId) => `${hash}/${browserId}`;
|
|
18
17
|
|
|
@@ -48,26 +47,11 @@ exports.mergeDatabasesForReuse = async (reportPath) => {
|
|
|
48
47
|
logger.warn(chalk.yellow(`Merge databases to ${constantFileNames.LOCAL_DATABASE_NAME}`));
|
|
49
48
|
|
|
50
49
|
const mergedDatabase = new Database(mergedDbPath);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
mergedDatabase.prepare(query).run();
|
|
55
|
-
} catch (err) {
|
|
56
|
-
// TODO: To be able to work with files that have been created before
|
|
57
|
-
// TODO: Remove in next versions
|
|
58
|
-
if (/no such table/.test(err)) {
|
|
59
|
-
console.warn(err);
|
|
60
|
-
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
throw err;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
50
|
+
mergeTables({db: mergedDatabase, dbPaths, getExistingTables: (statement) => {
|
|
51
|
+
return statement.all().map((table) => table.name);
|
|
52
|
+
}});
|
|
68
53
|
mergedDatabase.close();
|
|
69
54
|
|
|
70
|
-
await writeDatabaseUrlsFile(reportPath, [constantFileNames.LOCAL_DATABASE_NAME]);
|
|
71
55
|
await Promise.all(dbPaths.map(p => fs.remove(p)));
|
|
72
56
|
};
|
|
73
57
|
|
package/lib/plugin-api.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const AsyncEmitter = require('gemini-core').events.AsyncEmitter;
|
|
4
|
+
const pluginEvents = require('./constants/plugin-events');
|
|
5
|
+
|
|
6
|
+
module.exports = class HtmlReporter extends AsyncEmitter {
|
|
7
|
+
static create() {
|
|
8
|
+
return new this();
|
|
9
|
+
}
|
|
10
|
+
|
|
4
11
|
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
|
|
5
14
|
this._values = {
|
|
6
15
|
extraItems: {},
|
|
7
16
|
metaInfoExtenders: {},
|
|
@@ -10,6 +19,10 @@ module.exports = class HtmlReporter {
|
|
|
10
19
|
};
|
|
11
20
|
}
|
|
12
21
|
|
|
22
|
+
get events() {
|
|
23
|
+
return pluginEvents;
|
|
24
|
+
}
|
|
25
|
+
|
|
13
26
|
addExtraItem(key, value) {
|
|
14
27
|
this._values.extraItems[key] = value;
|
|
15
28
|
}
|
package/lib/server-utils.js
CHANGED
package/lib/sqlite-adapter.js
CHANGED
|
@@ -15,7 +15,8 @@ module.exports = class SqliteAdapter {
|
|
|
15
15
|
return new SqliteAdapter(...args);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
constructor({reportPath, reuse = false}) {
|
|
18
|
+
constructor({hermione, reportPath, reuse = false}) {
|
|
19
|
+
this._hermione = hermione;
|
|
19
20
|
this._reportPath = reportPath;
|
|
20
21
|
this._reuse = reuse;
|
|
21
22
|
this._db = null;
|
|
@@ -39,6 +40,8 @@ module.exports = class SqliteAdapter {
|
|
|
39
40
|
debug('db connection opened');
|
|
40
41
|
|
|
41
42
|
createTablesQuery().forEach((query) => this._db.prepare(query).run());
|
|
43
|
+
|
|
44
|
+
this._hermione.htmlReporter.emit(this._hermione.htmlReporter.events.DATABASE_CREATED, this._db);
|
|
42
45
|
} catch (err) {
|
|
43
46
|
throw new NestedError(`Error creating database at "${dbPath}"`, err);
|
|
44
47
|
}
|
|
@@ -8,6 +8,7 @@ import ViewSelect from './view-select';
|
|
|
8
8
|
import BaseHostInput from './base-host-input';
|
|
9
9
|
import MenuBar from './menu-bar';
|
|
10
10
|
import viewModes from '../../../constants/view-modes';
|
|
11
|
+
import {EXPAND_ALL, COLLAPSE_ALL, EXPAND_ERRORS, EXPAND_RETRIES} from '../../../constants/expand-modes';
|
|
11
12
|
|
|
12
13
|
class ControlButtons extends Component {
|
|
13
14
|
render() {
|
|
@@ -23,25 +24,25 @@ class ControlButtons extends Component {
|
|
|
23
24
|
<ControlButton
|
|
24
25
|
label="Expand all"
|
|
25
26
|
isControlGroup={true}
|
|
26
|
-
isActive={view.expand ===
|
|
27
|
+
isActive={view.expand === EXPAND_ALL}
|
|
27
28
|
handler={actions.expandAll}
|
|
28
29
|
/>
|
|
29
30
|
<ControlButton
|
|
30
31
|
label="Collapse all"
|
|
31
32
|
isControlGroup={true}
|
|
32
|
-
isActive={view.expand ===
|
|
33
|
+
isActive={view.expand === COLLAPSE_ALL}
|
|
33
34
|
handler={actions.collapseAll}
|
|
34
35
|
/>
|
|
35
36
|
<ControlButton
|
|
36
37
|
label="Expand errors"
|
|
37
38
|
isControlGroup={true}
|
|
38
|
-
isActive={view.expand ===
|
|
39
|
+
isActive={view.expand === EXPAND_ERRORS}
|
|
39
40
|
handler={actions.expandErrors}
|
|
40
41
|
/>
|
|
41
42
|
<ControlButton
|
|
42
43
|
label="Expand retries"
|
|
43
44
|
isControlGroup={true}
|
|
44
|
-
isActive={view.expand ===
|
|
45
|
+
isActive={view.expand === EXPAND_RETRIES}
|
|
45
46
|
handler={actions.expandRetries}
|
|
46
47
|
/>
|
|
47
48
|
</div>
|
|
@@ -60,11 +61,6 @@ class ControlButtons extends Component {
|
|
|
60
61
|
isActive={view.scaleImages}
|
|
61
62
|
handler={actions.toggleScaleImages}
|
|
62
63
|
/>
|
|
63
|
-
<ControlButton
|
|
64
|
-
label="Lazy load"
|
|
65
|
-
isActive={Boolean(view.lazyLoadOffset)}
|
|
66
|
-
handler={actions.toggleLazyLoad}
|
|
67
|
-
/>
|
|
68
64
|
<ControlButton
|
|
69
65
|
label="Group by error"
|
|
70
66
|
isActive={Boolean(view.groupByError)}
|
|
@@ -5,35 +5,30 @@ import classNames from 'classnames';
|
|
|
5
5
|
import Suites from '../suites';
|
|
6
6
|
|
|
7
7
|
export default class ErrorGroupsItem extends Component {
|
|
8
|
-
state = {
|
|
9
|
-
collapsed: true
|
|
10
|
-
};
|
|
11
|
-
|
|
12
8
|
static propTypes = {
|
|
13
|
-
group: PropTypes.object.isRequired
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
_toggleState = () => {
|
|
17
|
-
this.setState({collapsed: !this.state.collapsed});
|
|
9
|
+
group: PropTypes.object.isRequired,
|
|
10
|
+
isActive: PropTypes.bool.isRequired,
|
|
11
|
+
onClick: PropTypes.func.isRequired
|
|
18
12
|
}
|
|
19
13
|
|
|
20
14
|
render() {
|
|
21
|
-
const {
|
|
15
|
+
const {group, isActive, onClick} = this.props;
|
|
16
|
+
const {name, pattern, count} = group;
|
|
22
17
|
|
|
23
|
-
const body =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
const body = isActive ? (
|
|
19
|
+
<div className="error-group__body">
|
|
20
|
+
<Suites />
|
|
21
|
+
</div>
|
|
22
|
+
) : null;
|
|
28
23
|
|
|
29
24
|
const className = classNames(
|
|
30
25
|
'error-group',
|
|
31
|
-
{'error-group_collapsed':
|
|
26
|
+
{'error-group_collapsed': !isActive}
|
|
32
27
|
);
|
|
33
28
|
|
|
34
29
|
return (
|
|
35
30
|
<div className={className}>
|
|
36
|
-
<div className="error-group__title" onClick={
|
|
31
|
+
<div className="error-group__title" onClick={onClick} title={pattern}>
|
|
37
32
|
<span className="error-group__name">{name}</span>
|
|
38
33
|
<span className="error-group__count"> ({count})</span>
|
|
39
34
|
</div>
|
|
@@ -1,29 +1,56 @@
|
|
|
1
1
|
import React, {Component} from 'react';
|
|
2
2
|
import {connect} from 'react-redux';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
+
import {bindActionCreators} from 'redux';
|
|
4
5
|
|
|
5
6
|
import ErrorGroupsItem from './item';
|
|
7
|
+
import * as actions from '../../modules/actions';
|
|
6
8
|
|
|
7
9
|
class ErrorGroupsList extends Component {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
10
|
+
static propTypes = {
|
|
11
|
+
groupedErrors: PropTypes.array.isRequired
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
state = {
|
|
15
|
+
errorGroupIndex: null
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
onErrorGroupChange = (index) => {
|
|
19
|
+
const errorGroupIndex = this.state.errorGroupIndex === index ? null : index;
|
|
20
|
+
const isActive = errorGroupIndex !== null;
|
|
21
|
+
|
|
22
|
+
this.setState({errorGroupIndex}, () => {
|
|
23
|
+
const browserIds = isActive ? this.props.groupedErrors[index].browserIds : [];
|
|
24
|
+
this.props.actions.toggleErrorGroup({browserIds, isActive});
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
render() {
|
|
29
|
+
const {groupedErrors} = this.props;
|
|
30
|
+
const {errorGroupIndex} = this.state;
|
|
31
|
+
|
|
32
|
+
if (groupedErrors.length === 0) {
|
|
33
|
+
return <div className="groupedErrors">
|
|
34
|
+
There are no failed tests. To see passed tests disable "Group by error" mode.
|
|
35
|
+
</div>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return <div className="groupedErrors">
|
|
39
|
+
{groupedErrors.map((group, ind) => {
|
|
40
|
+
const isActive = ind === errorGroupIndex;
|
|
41
|
+
|
|
42
|
+
return <ErrorGroupsItem
|
|
43
|
+
key={group.name}
|
|
44
|
+
group={group}
|
|
45
|
+
isActive={isActive}
|
|
46
|
+
onClick={() => this.onErrorGroupChange(ind)}
|
|
47
|
+
/>;
|
|
48
|
+
})}
|
|
49
|
+
</div>;
|
|
50
|
+
}
|
|
25
51
|
}
|
|
26
52
|
|
|
27
53
|
export default connect(
|
|
28
|
-
({groupedErrors}) => ({groupedErrors})
|
|
54
|
+
({groupedErrors}) => ({groupedErrors}),
|
|
55
|
+
(dispatch) => ({actions: bindActionCreators(actions, dispatch)})
|
|
29
56
|
)(ErrorGroupsList);
|
|
@@ -30,6 +30,10 @@ class Gui extends Component {
|
|
|
30
30
|
this._subscribeToEvents();
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
componentWillUnmount() {
|
|
34
|
+
this.props.actions.finGuiReport();
|
|
35
|
+
}
|
|
36
|
+
|
|
33
37
|
_subscribeToEvents() {
|
|
34
38
|
const {actions} = this.props;
|
|
35
39
|
const eventSource = new EventSource('/events');
|
|
@@ -60,7 +64,12 @@ class Gui extends Component {
|
|
|
60
64
|
const {allRootSuiteIds, loading, customScripts} = this.props;
|
|
61
65
|
|
|
62
66
|
if (!allRootSuiteIds.length) {
|
|
63
|
-
return (
|
|
67
|
+
return (
|
|
68
|
+
<Fragment>
|
|
69
|
+
<Notifications theme={wybo}/>
|
|
70
|
+
<Loading active={true} />
|
|
71
|
+
</Fragment>
|
|
72
|
+
);
|
|
64
73
|
}
|
|
65
74
|
|
|
66
75
|
return (
|