const blackoutStyle = `
    <style id="cypress-blackout">
      [data-vis-reg-mask], [data-vis-reg-mask] * {
        background-color: black !important;
        color: black !important;
      }
      [data-vis-reg-hide] {
        display: none;
      }
    </style>` ; const commonScreenshotOptions = { capture : 'fullPage' } ; export function makeScreenshots ( name , viewports = [ 'macbook-15' , 'iphone-6+' , 'iphone-6' , 'iphone-5' ] ) { cy . get ( 'html > head' ) . then ( e => e . append ( blackoutStyle ) ) ; if ( ( Cypress . config ( ) as any ) . isInteractive ) { cy . screenshot ( name , commonScreenshotOptions as any ) ; } else { cy . get ( 'body' ) . then ( e => e . append ( '<textarea style="position: absolute; top: 0; opacity: 0" />' ) ) ; for ( const viewport of viewports ) { cy . viewport ( viewport as any ) ; cy . get ( 'textarea' ) . last ( ) . focus ( ) . blur ( ) ; cy . wait ( 100 ) ; cy . screenshot ( `${ name }-${ normalizeViewportName ( viewport ) }` , commonScreenshotOptions as any ) ; } cy . get ( 'textarea' ) . last ( ) . then ( e => e . remove ( ) ) ; } cy . get ( '#cypress-blackout' ) . then ( e => e . remove ( ) ) ; } function normalizeViewportName ( viewport ) { return viewport . replace ( '+' , 'plus' ) ; }