@@ -387,6 +387,99 @@ describe('percySnapshot', () => {
387387 ) ;
388388 } ) ;
389389 } ) ;
390+
391+ describe ( 'ignoreStyleSheetSerializationErrors via percySnapshot' , ( ) => {
392+
393+ it ( 'should default to false when no options are provided' , async ( ) => {
394+ spyOn ( driver , 'executeScript' ) . and . returnValue ( Promise . resolve ( {
395+ domSnapshot : { html : '<html></html>' , resources : [ ] }
396+ } ) ) ;
397+
398+ await percySnapshot ( driver , 'Default canvas test' ) ;
399+
400+ expect ( driver . executeScript ) . toHaveBeenCalledWith (
401+ jasmine . any ( Function ) ,
402+ jasmine . objectContaining ( {
403+ ignoreStyleSheetSerializationErrors : false
404+ } )
405+ ) ;
406+ } ) ;
407+
408+ it ( 'should use value from options when provided as true' , async ( ) => {
409+ spyOn ( driver , 'executeScript' ) . and . returnValue ( Promise . resolve ( {
410+ domSnapshot : { html : '<html></html>' , resources : [ ] }
411+ } ) ) ;
412+
413+ await percySnapshot ( driver , 'Options true test' , {
414+ ignoreStyleSheetSerializationErrors : true
415+ } ) ;
416+
417+ expect ( driver . executeScript ) . toHaveBeenCalledWith (
418+ jasmine . any ( Function ) ,
419+ jasmine . objectContaining ( {
420+ ignoreStyleSheetSerializationErrors : true
421+ } )
422+ ) ;
423+ } ) ;
424+
425+ it ( 'should use value from options when provided as false' , async ( ) => {
426+ spyOn ( driver , 'executeScript' ) . and . returnValue ( Promise . resolve ( {
427+ domSnapshot : { html : '<html></html>' , resources : [ ] }
428+ } ) ) ;
429+
430+ await percySnapshot ( driver , 'Options false test' , {
431+ ignoreStyleSheetSerializationErrors : false
432+ } ) ;
433+
434+ expect ( driver . executeScript ) . toHaveBeenCalledWith (
435+ jasmine . any ( Function ) ,
436+ jasmine . objectContaining ( {
437+ ignoreStyleSheetSerializationErrors : false
438+ } )
439+ ) ;
440+ } ) ;
441+
442+ it ( 'should prefer options value over config value' , async ( ) => {
443+ utils . percy . config = { snapshot : { ignoreStyleSheetSerializationErrors : true } } ;
444+
445+ spyOn ( driver , 'executeScript' ) . and . returnValue ( Promise . resolve ( {
446+ domSnapshot : { html : '<html></html>' , resources : [ ] }
447+ } ) ) ;
448+
449+ await percySnapshot ( driver , 'Options override test' , {
450+ ignoreStyleSheetSerializationErrors : false
451+ } ) ;
452+
453+ expect ( driver . executeScript ) . toHaveBeenCalledWith (
454+ jasmine . any ( Function ) ,
455+ jasmine . objectContaining ( {
456+ ignoreStyleSheetSerializationErrors : false
457+ } )
458+ ) ;
459+ } ) ;
460+
461+ it ( 'should return false when both options and config are undefined' , async ( ) => {
462+ utils . percy . config = {
463+ ...utils . percy . config ,
464+ snapshot : {
465+ ...utils . percy . config ?. snapshot ,
466+ }
467+ } ;
468+
469+ spyOn ( driver , 'executeScript' ) . and . returnValue ( Promise . resolve ( {
470+ domSnapshot : { html : '<html></html>' , resources : [ ] }
471+ } ) ) ;
472+
473+ await percySnapshot ( driver , 'Both undefined test' , { } ) ;
474+
475+ expect ( driver . executeScript ) . toHaveBeenCalledWith (
476+ jasmine . any ( Function ) ,
477+ jasmine . objectContaining ( {
478+ ignoreStyleSheetSerializationErrors : false
479+ } )
480+ ) ;
481+ } ) ;
482+ } ) ;
390483} ) ;
391484
392485describe ( '#slowScrollToBottom' , ( ) => {
0 commit comments