html-reporter 9.8.1 → 9.8.3
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 +20 -0
- package/lib/static/gui.min.js +1 -1
- package/lib/static/report.min.js +1 -1
- package/lib/test-adapter.js +26 -15
- package/package.json +1 -1
package/lib/test-adapter.js
CHANGED
|
@@ -96,32 +96,40 @@ module.exports = class TestAdapter {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
_getExpectedKey(stateName) {
|
|
99
|
+
const {id, browserId} = this._testResult;
|
|
99
100
|
// TODO: remove toString after publish major version
|
|
100
|
-
return
|
|
101
|
+
return [id.toString(), browserId, stateName].join('/');
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
_getExpectedPath(stateName, status) {
|
|
104
|
+
_getExpectedPath(stateName, status, cacheExpectedPaths) {
|
|
104
105
|
const key = this._getExpectedKey(stateName);
|
|
105
106
|
|
|
106
107
|
if (status === UPDATED) {
|
|
107
108
|
const expectedPath = utils.getReferencePath(this, stateName);
|
|
108
|
-
|
|
109
|
+
cacheExpectedPaths.set(key, expectedPath);
|
|
109
110
|
|
|
110
|
-
return expectedPath;
|
|
111
|
+
return {path: expectedPath, reused: false};
|
|
111
112
|
}
|
|
112
113
|
|
|
113
|
-
if (
|
|
114
|
-
return
|
|
114
|
+
if (cacheExpectedPaths.has(key)) {
|
|
115
|
+
return {path: cacheExpectedPaths.get(key), reused: true};
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
const imageInfo = this._getLastImageInfoFromDB(stateName);
|
|
118
|
-
const expectedPath = imageInfo && imageInfo.expectedImg
|
|
119
|
-
? imageInfo.expectedImg.path
|
|
120
|
-
: utils.getReferencePath(this, stateName);
|
|
121
119
|
|
|
122
|
-
|
|
120
|
+
if (imageInfo && imageInfo.expectedImg) {
|
|
121
|
+
const expectedPath = imageInfo.expectedImg.path;
|
|
123
122
|
|
|
124
|
-
|
|
123
|
+
cacheExpectedPaths.set(key, expectedPath);
|
|
124
|
+
|
|
125
|
+
return {path: expectedPath, reused: true};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const expectedPath = utils.getReferencePath(this, stateName);
|
|
129
|
+
|
|
130
|
+
cacheExpectedPaths.set(key, expectedPath);
|
|
131
|
+
|
|
132
|
+
return {path: expectedPath, reused: false};
|
|
125
133
|
}
|
|
126
134
|
|
|
127
135
|
getImagesFor(status, stateName) {
|
|
@@ -129,7 +137,7 @@ module.exports = class TestAdapter {
|
|
|
129
137
|
const currImg = this.getCurrImg(stateName);
|
|
130
138
|
const errImg = this.getErrImg();
|
|
131
139
|
|
|
132
|
-
const refPath = this._getExpectedPath(stateName, status);
|
|
140
|
+
const {path: refPath} = this._getExpectedPath(stateName, status, globalCacheExpectedPaths);
|
|
133
141
|
const currPath = utils.getCurrentPath(this, stateName);
|
|
134
142
|
const diffPath = utils.getDiffPath(this, stateName);
|
|
135
143
|
|
|
@@ -372,10 +380,10 @@ module.exports = class TestAdapter {
|
|
|
372
380
|
await fs.writeFile(detailsFilePath, detailsData);
|
|
373
381
|
}
|
|
374
382
|
|
|
375
|
-
async saveTestImages(reportPath, workers) {
|
|
383
|
+
async saveTestImages(reportPath, workers, cacheExpectedPaths = globalCacheExpectedPaths) {
|
|
376
384
|
const result = await Promise.all(this.assertViewResults.map(async (assertResult) => {
|
|
377
385
|
const {stateName} = assertResult;
|
|
378
|
-
const destRefPath = this._getExpectedPath(stateName);
|
|
386
|
+
const {path: destRefPath, reused: reusedReference} = this._getExpectedPath(stateName, undefined, cacheExpectedPaths);
|
|
379
387
|
const srcRefPath = this.getRefImg(stateName).path;
|
|
380
388
|
|
|
381
389
|
const destCurrPath = utils.getCurrentPath(this, stateName);
|
|
@@ -395,8 +403,11 @@ module.exports = class TestAdapter {
|
|
|
395
403
|
actions.push(
|
|
396
404
|
this._saveImg(srcCurrPath, destCurrPath, reportPath),
|
|
397
405
|
this._saveImg(srcDiffPath, dstCurrPath, reportPath),
|
|
398
|
-
this._saveImg(srcRefPath, destRefPath, reportPath)
|
|
399
406
|
);
|
|
407
|
+
|
|
408
|
+
if (!reusedReference) {
|
|
409
|
+
actions.push(this._saveImg(srcRefPath, destRefPath, reportPath));
|
|
410
|
+
}
|
|
400
411
|
}
|
|
401
412
|
|
|
402
413
|
if (this.isNoRefImageError(assertResult)) {
|
package/package.json
CHANGED