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