diff --git a/CHANGELOG.md b/CHANGELOG.md index db5d1f225..56d6c7cc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [2.20.8](https://github.com/gemini-testing/html-reporter/compare/v2.20.7...v2.20.8) (2018-08-28) + + +### Bug Fixes + +* unable update image for test after first accept ([5c967aa](https://github.com/gemini-testing/html-reporter/commit/5c967aa)) + + + ## [2.20.7](https://github.com/gemini-testing/html-reporter/compare/v2.20.6...v2.20.7) (2018-08-03) diff --git a/lib/report-builder-factory/report-builder.js b/lib/report-builder-factory/report-builder.js index 2c15490f4..202ddd1cc 100644 --- a/lib/report-builder-factory/report-builder.js +++ b/lib/report-builder-factory/report-builder.js @@ -156,13 +156,15 @@ module.exports = class ReportBuilder { formattedResult.attempt = testResult.attempt; formattedResult.image = hasImage(formattedResult); - const {imagesInfo} = stateInBrowser.result; + const {imagesInfo, status: currentStatus} = stateInBrowser.result; stateInBrowser.result = extendTestWithImagePaths(testResult, formattedResult, imagesInfo); if (!hasFails(stateInBrowser)) { stateInBrowser.result.status = SUCCESS; } else if (hasNoRefImageErrors(stateInBrowser.result)) { stateInBrowser.result.status = FAIL; + } else if (stateInBrowser.result.status === UPDATED) { + stateInBrowser.result.status = currentStatus; } setStatusForBranch(this._tree, node.suitePath, testResult.status); diff --git a/package-lock.json b/package-lock.json index 054f641ac..36ecd9322 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "html-reporter", - "version": "2.20.7", + "version": "2.20.8", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 2b76992eb..22dff88ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "html-reporter", - "version": "2.20.7", + "version": "2.20.8", "description": "Plugin for gemini and hermione which is intended to aggregate the results of tests running into html report", "scripts": { "lint": "eslint .", diff --git a/test/lib/report-builder-factory/report-builder.js b/test/lib/report-builder-factory/report-builder.js index a923ff4eb..e8a95670d 100644 --- a/test/lib/report-builder-factory/report-builder.js +++ b/test/lib/report-builder-factory/report-builder.js @@ -353,7 +353,7 @@ describe('ReportBuilder', () => { }); describe('addUpdated', () => { - it('should add "idle" status to result', () => { + it('should add "updated" status to result', () => { const reportBuilder = mkReportBuilder_(); reportBuilder.addUpdated(stubTest_()); @@ -386,6 +386,29 @@ describe('ReportBuilder', () => { assert.match(imagesInfo[1], {stateName: 'plain2', status: FAIL}); }); + it('should not rewrite status to "updated" if test has failed states', () => { + const reportBuilder = mkReportBuilder_(); + + const failedTest = stubTest_({ + imagesInfo: [ + {stateName: 'plain1', status: FAIL}, + {stateName: 'plain2', status: FAIL} + ] + }); + const updatedTest = stubTest_({ + imagesInfo: [ + {stateName: 'plain1', status: UPDATED} + ] + }); + + reportBuilder.addFail(failedTest); + reportBuilder.addUpdated(updatedTest); + + const {status} = getReportBuilderResult_(reportBuilder); + + assert.equal(status, FAIL); + }); + it('should update last test image if state name was not passed', () => { const reportBuilder = mkReportBuilder_();