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 isNotVisible ( selector , page , options = defaultWaitUntilOptions ) { const waitOptions = { ... defaultWaitUntilOptions , ... options , } ; if ( typeof selector === 'string' ) { const result = await action . isSelectorNotVisible ( selector , page , waitOptions ) ; return result ; } { const result = await action . isSelectorObjectNotVisible ( selector , page , waitOptions ) ; return result ; } } async function expectThatCssSelectorIsNotVisible ( selector , page , options = defaultAssertOptions ) { const waitOptions = { ... defaultWaitUntilOptions , ... defaultAssertOptions , ... options , throwOnTimeout : true , } ; await waitUntil ( ( ) => isNotVisible ( selector , page , noWaitNoThrowOptions ) , `Selector '${ selector }' is visible.` , waitOptions ) ; } async function expectThatSelectorObjectIsNotVisible ( selector , page , options = defaultAssertOptions ) { const waitOptions = { ... defaultWaitUntilOptions , ... defaultAssertOptions , ... options , throwOnTimeout : true , } ; await waitUntil ( ( ) => isNotVisible ( selector , page , noWaitNoThrowOptions ) , `Selector '${ selector . toString ( ) }' is visible.` , waitOptions ) ; } export async function expectThatSelectorIsNotVisible ( selector , page , options = defaultAssertOptions ) { if ( typeof selector === 'string' ) { return await expectThatCssSelectorIsNotVisible ( selector , page , options ) ; } return await expectThatSelectorObjectIsNotVisible ( selector , page , options ) ; }