import { executeImageCompare } from '../methods/images' ; import { checkIsMobile } from '../helpers/utils' ; import saveFullPageScreen from './saveFullPageScreen' ; import { ImageCompareResult } from '../methods/images.interfaces' ; import { Methods } from '../methods/methods.interface' ; import { InstanceData } from '../methods/instanceData.interfaces' ; import { Folders } from '../base.interface' ; import { CheckFullPageOptions , SaveFullPageOptions } from './fullPage.interfaces' ; import { methodCompareOptions } from '../helpers/options' ; /**
 * Compare a fullpage screenshot
 */ export default async function checkFullPageScreen ( methods , instanceData , folders , tag , checkFullPageOptions ) { const saveFullPageOptions = { wic : checkFullPageOptions . wic , method : { ... ( 'disableCSSAnimation' in checkFullPageOptions . method ? { disableCSSAnimation : checkFullPageOptions . method . disableCSSAnimation } : { } ) , ... ( 'fullPageScrollTimeout' in checkFullPageOptions . method ? { fullPageScrollTimeout : checkFullPageOptions . method . fullPageScrollTimeout } : { } ) , ... ( 'hideScrollBars' in checkFullPageOptions . method ? { hideScrollBars : checkFullPageOptions . method . hideScrollBars } : { } ) , ... { hideElements : checkFullPageOptions . method . hideElements || [ ] } , ... { removeElements : checkFullPageOptions . method . removeElements || [ ] } , ... { hideAfterFirstScroll : checkFullPageOptions . method . hideAfterFirstScroll || [ ] } , } } ; const { devicePixelRatio , fileName } = await saveFullPageScreen ( methods , instanceData , folders , tag , saveFullPageOptions ) ; const compareOptions = methodCompareOptions ( checkFullPageOptions . method ) ; const executeCompareOptions = { devicePixelRatio , compareOptions : { wic : checkFullPageOptions . wic . compareOptions , method : compareOptions , } , fileName , folderOptions : { autoSaveBaseline : checkFullPageOptions . wic . autoSaveBaseline , actualFolder : folders . actualFolder , baselineFolder : folders . baselineFolder , diffFolder : folders . diffFolder , browserName : instanceData . browserName , deviceName : instanceData . deviceName , isMobile : checkIsMobile ( instanceData . platformName ) , savePerInstance : checkFullPageOptions . wic . savePerInstance , } , isAndroidNativeWebScreenshot : instanceData . nativeWebScreenshot , isHybridApp : checkFullPageOptions . wic . isHybridApp , logLevel : checkFullPageOptions . wic . logLevel , platformName : instanceData . platformName , } ; return executeImageCompare ( methods . executor , executeCompareOptions ) ; }