Skip to content

Commit

Permalink
Merge pull request #510 from gemini-testing/sp.HERMIONE-1196.undoFix
Browse files Browse the repository at this point in the history
fix(screenshot-undo): do not fail on revert screenshot with different…
  • Loading branch information
sipayRT authored Oct 4, 2023
2 parents fd771fc + 5c51487 commit b1d06fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/report-builder/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ module.exports = class GuiReportBuilder extends StaticReportBuilder {
}

const previousExpectedPath = _.get(previousImage, 'expectedImg.path', null);
const shouldRemoveReference = _.isNull(previousImage.refImg.size);
const previousImageRefImgSize = _.get(previousImage, 'refImg.size', null);
const shouldRemoveReference = _.isNull(previousImageRefImgSize);
const shouldRevertReference = !shouldRemoveReference;

let updatedImage, removedResult;
Expand Down
7 changes: 2 additions & 5 deletions test/unit/lib/report-builder/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ describe('GuiReportBuilder', () => {
let reportBuilder;

function stubResultData_(result, {resultId, stateName}) {
const res = _.defaultsDeep(result, {
const res = _.defaults(result, {
imageId: 'imageId',
status: UPDATED,
timestamp: 100500,
Expand Down Expand Up @@ -475,10 +475,7 @@ describe('GuiReportBuilder', () => {
const resultId = 'result-id';
const stateName = 's-name';
const formattedResult = mkFormattedResultStub_({id: resultId, stateName});
const previousImage = {
expectedImg: {path: 'previous-expected-path'},
refImg: {path: 'previous-reference-path', size: null}
};
const previousImage = null;
const updatedImage = {
id: 'updated-img-id',
parentId: 'parent-id'
Expand Down

0 comments on commit b1d06fb

Please sign in to comment.