import * as SUT from '../../playwright-fluent' ; import { noWaitNoThrowOptions } from '../../../utils' ; import * as path from 'path' ; describe ( 'Playwright Fluent - expectThat isEnabled with default assert options' , ( ) : void => { let p ; beforeEach ( ( ) : void => { p = new SUT . PlaywrightFluent ( ) ; } ) ; afterEach ( async ( ) : Promise < void > => { await p . close ( ) ; } ) ; test ( 'should wait until selector exists and is enabled - chromium' , async ( ) : Promise < void > => { const url = `file:${ path . join ( __dirname , 'with-default-assert-options.test.html' ) }` ; const selector = '#dynamically-added-input' ; await p . withBrowser ( 'chromium' ) . withOptions ( { headless : false } ) . withCursor ( ) . withDefaultAssertOptions ( { stabilityInMilliseconds : 0 , timeoutInMilliseconds : 10000 } ) . navigateTo ( url ) . expectThatSelector ( selector ) . isEnabled ( ) ; const isEnabled = await p . isEnabled ( selector , noWaitNoThrowOptions ) ; expect ( isEnabled ) . toBe ( true ) ; } ) ; test ( 'should wait until selector object exists and is enabled - chromium' , async ( ) : Promise < void > => { const url = `file:${ path . join ( __dirname , 'with-default-assert-options.test.html' ) }` ; const selector = p . selector ( 'input' ) . withValue ( 'dynamically added' ) ; await p . withBrowser ( 'chromium' ) . withOptions ( { headless : false } ) . withDefaultAssertOptions ( { stabilityInMilliseconds : 0 , timeoutInMilliseconds : 10000 } ) . withCursor ( ) . navigateTo ( url ) . expectThatSelector ( selector ) . isEnabled ( ) ; const isEnabled = await p . isEnabled ( selector , noWaitNoThrowOptions ) ; expect ( isEnabled ) . toBe ( true ) ; } ) ; } ) ;