import { SelectorFluent } from '../../selector-api' ; import { WaitUntilOptions , defaultWaitUntilOptions , waitUntil , noWaitNoThrowOptions , } from '../../utils' ; import * as action from '../../actions' ; import { AssertOptions , defaultAssertOptions } from '../../fluent-api' ; import { Frame , Page } from 'playwright' ; export async function isNotVisibleInViewport ( selector , page , options = defaultWaitUntilOptions ) { const waitOptions = { ... defaultWaitUntilOptions , ... options , } ; if ( typeof selector === 'string' ) { const result = await action . isSelectorNotVisibleInViewport ( selector , page , waitOptions ) ; return result ; } { const result = await action . isSelectorObjectNotVisibleInViewport ( selector , page , waitOptions ) ; return result ; } } async function expectThatCssSelectorIsNotVisibleInViewport ( selector , page , options = defaultAssertOptions ) { const waitOptions = { ... defaultWaitUntilOptions , ... defaultAssertOptions , ... options , throwOnTimeout : true , } ; await waitUntil ( ( ) => isNotVisibleInViewport ( selector , page , noWaitNoThrowOptions ) , `Selector '${ selector }' is visible in the current viewport.` , waitOptions ) ; } async function expectThatSelectorObjectIsNotVisibleInViewport ( selector , page , options = defaultAssertOptions ) { const waitOptions = { ... defaultWaitUntilOptions , ... defaultAssertOptions , ... options , throwOnTimeout : true , } ; await waitUntil ( ( ) => isNotVisibleInViewport ( selector , page , noWaitNoThrowOptions ) , `Selector '${ selector . toString ( ) }' is visible in the current viewport.` , waitOptions ) ; } export async function expectThatSelectorIsNotVisibleInViewport ( selector , page , options = defaultAssertOptions ) { if ( typeof selector === 'string' ) { return await expectThatCssSelectorIsNotVisibleInViewport ( selector , page , options ) ; } return await expectThatSelectorObjectIsNotVisibleInViewport ( selector , page , options ) ; }