@@ -429,6 +429,14 @@ describe('TestRunsService', () => {
429429 diffTollerancePercent : undefined ,
430430 branchName : 'develop' ,
431431 merge : true ,
432+ ignoreAreas : [
433+ {
434+ x : 1 ,
435+ y : 2 ,
436+ width : 100 ,
437+ height : 200 ,
438+ } ,
439+ ] ,
432440 } ;
433441 const testRunWithResult = {
434442 id : 'id' ,
@@ -457,7 +465,7 @@ describe('TestRunsService', () => {
457465 browser : 'browser' ,
458466 viewport : 'viewport' ,
459467 device : 'device' ,
460- ignoreAreas : '[]' ,
468+ ignoreAreas : '[{"x":3,"y":4,"width":500,"height":600} ]' ,
461469 comment : 'some comment' ,
462470 createdAt : new Date ( ) ,
463471 updatedAt : new Date ( ) ,
@@ -487,12 +495,6 @@ describe('TestRunsService', () => {
487495 const result = await service . create ( testVariation , createTestRequestDto ) ;
488496
489497 expect ( saveImageMock ) . toHaveBeenCalledWith ( 'screenshot' , Buffer . from ( createTestRequestDto . imageBase64 , 'base64' ) ) ;
490- expect ( service . getDiff ) . toHaveBeenCalledWith (
491- baseline ,
492- image ,
493- testRun . diffTollerancePercent ,
494- JSON . parse ( testVariation . ignoreAreas )
495- ) ;
496498 expect ( getImageMock ) . toHaveBeenNthCalledWith ( 1 , testVariation . baselineName ) ;
497499 expect ( getImageMock ) . toHaveBeenNthCalledWith ( 2 , imageName ) ;
498500 expect ( testRunCreateMock ) . toHaveBeenCalledWith ( {
@@ -523,12 +525,20 @@ describe('TestRunsService', () => {
523525 status : TestStatus . new ,
524526 } ,
525527 } ) ;
526- expect ( getDiffMock ) . toHaveBeenCalledWith (
527- baseline ,
528- image ,
529- testRun . diffTollerancePercent ,
530- JSON . parse ( testRun . ignoreAreas )
531- ) ;
528+ expect ( getDiffMock ) . toHaveBeenCalledWith ( baseline , image , testRun . diffTollerancePercent , [
529+ {
530+ x : 3 ,
531+ y : 4 ,
532+ width : 500 ,
533+ height : 600 ,
534+ } ,
535+ {
536+ x : 1 ,
537+ y : 2 ,
538+ width : 100 ,
539+ height : 200 ,
540+ } ,
541+ ] ) ;
532542 expect ( saveDiffResultMock ) . toHaveBeenCalledWith ( testRun . id , diffResult ) ;
533543 expect ( eventTestRunCreatedMock ) . toHaveBeenCalledWith ( testRunWithResult ) ;
534544 expect ( result ) . toBe ( testRunWithResult ) ;
0 commit comments