html-reporter 9.7.5 → 9.8.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 +38 -0
- package/README.md +4 -681
- package/docs/en/html-reporter-api.md +198 -0
- package/docs/en/html-reporter-commands.md +96 -0
- package/docs/en/html-reporter-custom-gui.md +99 -0
- package/docs/en/html-reporter-events.md +125 -0
- package/docs/en/html-reporter-plugins.md +265 -0
- package/docs/en/html-reporter-setup.md +378 -0
- package/docs/en/html-reporter.md +8 -0
- package/docs/ru/html-reporter-api.md +198 -0
- package/docs/ru/html-reporter-commands.md +96 -0
- package/docs/ru/html-reporter-custom-gui.md +99 -0
- package/docs/ru/html-reporter-events.md +125 -0
- package/docs/ru/html-reporter-plugins.md +265 -0
- package/docs/ru/html-reporter-setup.md +378 -0
- package/docs/ru/html-reporter.md +8 -0
- package/lib/common-utils.js +6 -0
- package/lib/constants/database.js +32 -13
- package/lib/gui/tool-runner/index.js +11 -4
- package/lib/history-utils.js +32 -14
- package/lib/report-builder/static.js +9 -4
- package/lib/sqlite-adapter.js +40 -0
- package/lib/static/components/header/summary/dbBtn.js +36 -0
- package/lib/static/components/header/summary/dbSummary.js +3 -22
- package/lib/static/components/icons/view-in-browser/index.js +2 -8
- package/lib/static/components/modals/screenshot-accepter/header.js +8 -1
- package/lib/static/components/modals/screenshot-accepter/index.js +56 -29
- package/lib/static/components/modals/screenshot-accepter/style.css +11 -0
- package/lib/static/components/progress-bar/index.js +13 -0
- package/lib/static/components/progress-bar/index.styl +24 -0
- package/lib/static/components/section/body/history/index.js +29 -0
- package/lib/static/components/section/body/history/index.styl +4 -0
- package/lib/static/components/section/body/meta-info/content.js +24 -9
- package/lib/static/components/section/body/result.js +2 -0
- package/lib/static/gui.html +13 -1
- package/lib/static/gui.min.css +691 -1
- package/lib/static/gui.min.js +47 -61
- package/lib/static/index.html +13 -1
- package/lib/static/modules/action-names.js +2 -0
- package/lib/static/modules/actions.js +13 -0
- package/lib/static/modules/middlewares/metrika.js +4 -2
- package/lib/static/modules/reducers/grouped-tests/index.js +2 -1
- package/lib/static/modules/reducers/tree/index.js +2 -1
- package/lib/static/modules/reducers/tree/nodes/results.js +1 -5
- package/lib/static/modules/reducers/view.js +34 -61
- package/lib/static/report.min.css +691 -1
- package/lib/static/report.min.js +47 -61
- package/lib/static/styles.css +16 -0
- package/lib/test-adapter.js +62 -19
- package/lib/tests-tree-builder/static.js +1 -0
- package/package.json +1 -1
package/lib/static/styles.css
CHANGED
|
@@ -423,6 +423,7 @@ details[open] > .details__summary:before {
|
|
|
423
423
|
border: none;
|
|
424
424
|
opacity: 0.3;
|
|
425
425
|
cursor: pointer;
|
|
426
|
+
background: transparent;
|
|
426
427
|
}
|
|
427
428
|
|
|
428
429
|
.section_root > .section__title > .custom-icon {
|
|
@@ -456,6 +457,7 @@ details[open] > .details__summary:before {
|
|
|
456
457
|
}
|
|
457
458
|
|
|
458
459
|
.meta-info__item {
|
|
460
|
+
display: flex;
|
|
459
461
|
word-wrap: break-word;
|
|
460
462
|
margin-bottom: 5px;
|
|
461
463
|
}
|
|
@@ -465,7 +467,21 @@ details[open] > .details__summary:before {
|
|
|
465
467
|
}
|
|
466
468
|
|
|
467
469
|
.meta-info__item-key {
|
|
470
|
+
white-space: pre;
|
|
468
471
|
font-weight: bold;
|
|
472
|
+
flex-shrink: 0;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.meta-info__item-value {
|
|
476
|
+
display: grid;
|
|
477
|
+
grid-template-columns: repeat(2, auto);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
.custom-icon_view-local{
|
|
481
|
+
display: block;
|
|
482
|
+
overflow: hidden;
|
|
483
|
+
white-space: nowrap;
|
|
484
|
+
text-overflow: ellipsis;
|
|
469
485
|
}
|
|
470
486
|
|
|
471
487
|
.error {
|
package/lib/test-adapter.js
CHANGED
|
@@ -7,6 +7,7 @@ const tmp = require('tmp');
|
|
|
7
7
|
const crypto = require('crypto');
|
|
8
8
|
|
|
9
9
|
const SuiteAdapter = require('./suite-adapter');
|
|
10
|
+
const {DB_COLUMNS} = require('./constants/database');
|
|
10
11
|
const {getSuitePath} = require('./plugin-utils').getHermioneUtils();
|
|
11
12
|
const {getCommandsHistory} = require('./history-utils');
|
|
12
13
|
const {SUCCESS, FAIL, ERROR, UPDATED} = require('./constants/test-statuses');
|
|
@@ -15,6 +16,9 @@ const utils = require('./server-utils');
|
|
|
15
16
|
const {logger} = require('./common-utils');
|
|
16
17
|
|
|
17
18
|
const globalCacheAllImages = new Map();
|
|
19
|
+
const globalCacheExpectedPaths = new Map();
|
|
20
|
+
const globalCacheDiffImages = new Map();
|
|
21
|
+
const testsAttempts = new Map();
|
|
18
22
|
|
|
19
23
|
function createHash(buffer) {
|
|
20
24
|
return crypto
|
|
@@ -23,18 +27,15 @@ function createHash(buffer) {
|
|
|
23
27
|
.digest('base64');
|
|
24
28
|
}
|
|
25
29
|
|
|
26
|
-
const globalCacheDiffImages = new Map();
|
|
27
|
-
const testsAttempts = new Map();
|
|
28
|
-
|
|
29
30
|
module.exports = class TestAdapter {
|
|
30
|
-
static create(testResult = {}, hermione,
|
|
31
|
-
return new this(testResult, hermione,
|
|
31
|
+
static create(testResult = {}, {hermione, sqliteAdapter, status}) {
|
|
32
|
+
return new this(testResult, {hermione, sqliteAdapter, status});
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
constructor(testResult, hermione,
|
|
35
|
+
constructor(testResult, {hermione, sqliteAdapter, status}) {
|
|
35
36
|
this._testResult = testResult;
|
|
36
37
|
this._hermione = hermione;
|
|
37
|
-
this.
|
|
38
|
+
this._sqliteAdapter = sqliteAdapter;
|
|
38
39
|
this._errors = this._hermione.errors;
|
|
39
40
|
this._suite = SuiteAdapter.create(this._testResult);
|
|
40
41
|
this._imagesSaver = this._hermione.htmlReporter.imagesSaver;
|
|
@@ -78,12 +79,57 @@ module.exports = class TestAdapter {
|
|
|
78
79
|
return globalCacheAllImages.get(imgPath) || imgPath;
|
|
79
80
|
}
|
|
80
81
|
|
|
82
|
+
_getLastImageInfoFromDB(stateName) {
|
|
83
|
+
const browserName = this._testResult.browserId;
|
|
84
|
+
const suitePath = getSuitePath(this._testResult);
|
|
85
|
+
const suitePathString = JSON.stringify(suitePath);
|
|
86
|
+
|
|
87
|
+
const imagesInfoResult = this._sqliteAdapter.query({
|
|
88
|
+
select: DB_COLUMNS.IMAGES_INFO,
|
|
89
|
+
where: `${DB_COLUMNS.SUITE_PATH} = ? AND ${DB_COLUMNS.NAME} = ?`,
|
|
90
|
+
orderBy: DB_COLUMNS.TIMESTAMP,
|
|
91
|
+
orderDescending: true
|
|
92
|
+
}, suitePathString, browserName);
|
|
93
|
+
|
|
94
|
+
const imagesInfo = imagesInfoResult && JSON.parse(imagesInfoResult[DB_COLUMNS.IMAGES_INFO]) || [];
|
|
95
|
+
return imagesInfo.find(info => info.stateName === stateName);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
_getExpectedKey(stateName) {
|
|
99
|
+
// TODO: remove toString after publish major version
|
|
100
|
+
return this._testResult.id.toString() + '#' + stateName;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
_getExpectedPath(stateName, status) {
|
|
104
|
+
const key = this._getExpectedKey(stateName);
|
|
105
|
+
|
|
106
|
+
if (status === UPDATED) {
|
|
107
|
+
const expectedPath = utils.getReferencePath(this, stateName);
|
|
108
|
+
globalCacheExpectedPaths.set(key, expectedPath);
|
|
109
|
+
|
|
110
|
+
return expectedPath;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (globalCacheExpectedPaths.has(key)) {
|
|
114
|
+
return globalCacheExpectedPaths.get(key);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const imageInfo = this._getLastImageInfoFromDB(stateName);
|
|
118
|
+
const expectedPath = imageInfo && imageInfo.expectedImg
|
|
119
|
+
? imageInfo.expectedImg.path
|
|
120
|
+
: utils.getReferencePath(this, stateName);
|
|
121
|
+
|
|
122
|
+
globalCacheExpectedPaths.set(key, expectedPath);
|
|
123
|
+
|
|
124
|
+
return expectedPath;
|
|
125
|
+
}
|
|
126
|
+
|
|
81
127
|
getImagesFor(status, stateName) {
|
|
82
128
|
const refImg = this.getRefImg(stateName);
|
|
83
129
|
const currImg = this.getCurrImg(stateName);
|
|
84
130
|
const errImg = this.getErrImg();
|
|
85
131
|
|
|
86
|
-
const refPath =
|
|
132
|
+
const refPath = this._getExpectedPath(stateName, status);
|
|
87
133
|
const currPath = utils.getCurrentPath(this, stateName);
|
|
88
134
|
const diffPath = utils.getDiffPath(this, stateName);
|
|
89
135
|
|
|
@@ -220,20 +266,17 @@ module.exports = class TestAdapter {
|
|
|
220
266
|
return this.imagesInfo;
|
|
221
267
|
}
|
|
222
268
|
|
|
223
|
-
get
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
const {commandsWithShortHistory} = this._pluginConfig;
|
|
227
|
-
|
|
228
|
-
if (!_.isEmpty(history)) {
|
|
229
|
-
err.history = getCommandsHistory(history, commandsWithShortHistory);
|
|
230
|
-
}
|
|
269
|
+
get history() {
|
|
270
|
+
return getCommandsHistory(this._testResult.history);
|
|
271
|
+
}
|
|
231
272
|
|
|
232
|
-
|
|
273
|
+
get error() {
|
|
274
|
+
return _.pick(this._testResult.err, ['message', 'stack', 'stateName']);
|
|
233
275
|
}
|
|
234
276
|
|
|
235
277
|
get imageDir() {
|
|
236
|
-
|
|
278
|
+
// TODO: remove toString after publish major version
|
|
279
|
+
return this._testResult.id.toString();
|
|
237
280
|
}
|
|
238
281
|
|
|
239
282
|
get state() {
|
|
@@ -332,7 +375,7 @@ module.exports = class TestAdapter {
|
|
|
332
375
|
async saveTestImages(reportPath, workers) {
|
|
333
376
|
const result = await Promise.all(this.assertViewResults.map(async (assertResult) => {
|
|
334
377
|
const {stateName} = assertResult;
|
|
335
|
-
const destRefPath =
|
|
378
|
+
const destRefPath = this._getExpectedPath(stateName);
|
|
336
379
|
const srcRefPath = this.getRefImg(stateName).path;
|
|
337
380
|
|
|
338
381
|
const destCurrPath = utils.getCurrentPath(this, stateName);
|
|
@@ -154,6 +154,7 @@ function mkTestResult(row, data = {}) {
|
|
|
154
154
|
description: row[DB_COLUMN_INDEXES.description],
|
|
155
155
|
imagesInfo: JSON.parse(row[DB_COLUMN_INDEXES.imagesInfo]),
|
|
156
156
|
metaInfo: JSON.parse(row[DB_COLUMN_INDEXES.metaInfo]),
|
|
157
|
+
history: JSON.parse(row[DB_COLUMN_INDEXES.history]),
|
|
157
158
|
multipleTabs: Boolean(row[DB_COLUMN_INDEXES.multipleTabs]),
|
|
158
159
|
name: row[DB_COLUMN_INDEXES.name],
|
|
159
160
|
screenshot: Boolean(row[DB_COLUMN_INDEXES.screenshot]),
|
package/package.json
CHANGED