import { report } from '../../../utils' ; import { VerboseOptions } from '../is-handle-visible' ; import { getIntersectionRatioOfHandle } from '../get-intersection-ratio-of-handle' ; import { ElementHandle } from 'playwright' ; declare const window ; export async function isHandleNotVisibleInViewport ( selector , options ) { if ( selector === undefined || selector === null ) { return true ; } const visibleRatio = await getIntersectionRatioOfHandle ( selector ) ; report ( `visible ratio is ${ visibleRatio }` , options . verbose ) ; if ( visibleRatio <= 0 ) { report ( `selector is not visible in the current viewport` , options . verbose ) ; return true ; } const isTransparentOrHidden = await selector . evaluate ( ( el ) : boolean => { const style = window . getComputedStyle ( el ) ; if ( style && style . opacity && style . opacity === '0' ) { return true ; } if ( style && style . visibility === 'hidden' ) { return true ; } return false ; } ) ; return isTransparentOrHidden ; }