html-reporter 9.7.6 → 9.8.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.
- package/CHANGELOG.md +37 -0
- package/lib/common-utils.js +6 -0
- package/lib/constants/database.js +32 -14
- package/lib/gui/tool-runner/index.js +11 -4
- package/lib/history-utils.js +3 -3
- package/lib/report-builder/static.js +5 -1
- package/lib/sqlite-adapter.js +38 -0
- 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/meta-info/content.js +24 -9
- package/lib/static/gui.min.css +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 +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/modules/store.js +1 -1
- package/lib/static/report.min.css +1 -1
- package/lib/static/report.min.js +15 -15
- package/lib/static/styles.css +16 -0
- package/lib/test-adapter.js +57 -9
- 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,17 +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, status) {
|
|
31
|
-
return new this(testResult, hermione, status);
|
|
31
|
+
static create(testResult = {}, {hermione, sqliteAdapter, status}) {
|
|
32
|
+
return new this(testResult, {hermione, sqliteAdapter, status});
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
constructor(testResult, hermione, status) {
|
|
35
|
+
constructor(testResult, {hermione, sqliteAdapter, status}) {
|
|
35
36
|
this._testResult = testResult;
|
|
36
37
|
this._hermione = hermione;
|
|
38
|
+
this._sqliteAdapter = sqliteAdapter;
|
|
37
39
|
this._errors = this._hermione.errors;
|
|
38
40
|
this._suite = SuiteAdapter.create(this._testResult);
|
|
39
41
|
this._imagesSaver = this._hermione.htmlReporter.imagesSaver;
|
|
@@ -77,12 +79,57 @@ module.exports = class TestAdapter {
|
|
|
77
79
|
return globalCacheAllImages.get(imgPath) || imgPath;
|
|
78
80
|
}
|
|
79
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
|
+
|
|
80
127
|
getImagesFor(status, stateName) {
|
|
81
128
|
const refImg = this.getRefImg(stateName);
|
|
82
129
|
const currImg = this.getCurrImg(stateName);
|
|
83
130
|
const errImg = this.getErrImg();
|
|
84
131
|
|
|
85
|
-
const refPath =
|
|
132
|
+
const refPath = this._getExpectedPath(stateName, status);
|
|
86
133
|
const currPath = utils.getCurrentPath(this, stateName);
|
|
87
134
|
const diffPath = utils.getDiffPath(this, stateName);
|
|
88
135
|
|
|
@@ -228,7 +275,8 @@ module.exports = class TestAdapter {
|
|
|
228
275
|
}
|
|
229
276
|
|
|
230
277
|
get imageDir() {
|
|
231
|
-
|
|
278
|
+
// TODO: remove toString after publish major version
|
|
279
|
+
return this._testResult.id.toString();
|
|
232
280
|
}
|
|
233
281
|
|
|
234
282
|
get state() {
|
|
@@ -327,7 +375,7 @@ module.exports = class TestAdapter {
|
|
|
327
375
|
async saveTestImages(reportPath, workers) {
|
|
328
376
|
const result = await Promise.all(this.assertViewResults.map(async (assertResult) => {
|
|
329
377
|
const {stateName} = assertResult;
|
|
330
|
-
const destRefPath =
|
|
378
|
+
const destRefPath = this._getExpectedPath(stateName);
|
|
331
379
|
const srcRefPath = this.getRefImg(stateName).path;
|
|
332
380
|
|
|
333
381
|
const destCurrPath = utils.getCurrentPath(this, stateName);
|
package/package.json
CHANGED