Skip to content
This repository was archived by the owner on Sep 21, 2022. It is now read-only.

Commit ef198bc

Browse files
committed
perf: Use reference images instead of actual(current) in HTML report
Reference images are compressed so it should decrease HTML report size
1 parent 8fa16a3 commit ef198bc

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/reporters/html/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ function logPathToHtmlReport() {
7272
function prepareImages(runner) {
7373
function handleTestResultEvent_(testResult) {
7474
let actions = [
75-
copyImage(testResult.currentPath, lib.currentAbsolutePath(testResult))
75+
copyImage(testResult.referencePath, lib.referenceAbsolutePath(testResult))
7676
];
7777

7878
if (!testResult.equal) {
7979
actions.push(
80-
copyImage(testResult.referencePath, lib.referenceAbsolutePath(testResult)),
80+
copyImage(testResult.currentPath, lib.currentAbsolutePath(testResult)),
8181
saveDiff(testResult, lib.diffAbsolutePath(testResult))
8282
);
8383
}

test/unit/reporters/html/html.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,19 @@ describe('HTML Reporter', () => {
7070
assert.equal(render(data), '<img data-src="images/fake/long%2Bpath/fakeName/fakeId~current.png">');
7171
});
7272

73-
it('should save only current when screenshots are equal', () => {
74-
sandbox.stub(lib, 'currentAbsolutePath').returns('absolute/current/path');
73+
it('should save only reference when screenshots are equal', () => {
74+
sandbox.stub(lib, 'referenceAbsolutePath').returns('absolute/reference/path');
7575

7676
emitter.emit(Events.TEST_RESULT, mkStubResult_({
77-
currentPath: 'current/path',
77+
referencePath: 'reference/path',
7878
equal: true
7979
}));
8080

8181
emitter.emit(Events.END);
8282

8383
return emitter.emitAndWait(Events.END_RUNNER).then(() => {
8484
assert.calledOnce(fs.copyAsync);
85-
assert.calledWith(fs.copyAsync, 'current/path', 'absolute/current/path');
85+
assert.calledWith(fs.copyAsync, 'reference/path', 'absolute/reference/path');
8686
});
8787
});
8888

0 commit comments

Comments
 (0)