import * as SUT from '../../playwright-fluent' ; import * as path from 'path' ; describe ( 'Playwright Fluent - invoke method on selector' , ( ) : void => { let p ; beforeEach ( ( ) : void => { p = new SUT . PlaywrightFluent ( ) ; } ) ; afterEach ( async ( ) : Promise < void > => { await p . close ( ) ; } ) ; test ( 'should invoke click method on selector - chromium' , async ( ) : Promise < void > => { const url = `file:${ path . join ( __dirname , 'invoke-method.test.html' ) }` ; const selector = '#dynamically-added-input' ; await p . withBrowser ( 'chromium' ) . withOptions ( { headless : false } ) . withCursor ( ) . navigateTo ( url ) . expectThat ( selector ) . isEnabled ( ) . invokeMethod ( 'click' , selector ) ; const isChecked = await p . isChecked ( selector ) ; expect ( isChecked ) . toBe ( true ) ; await p . expectThatSelector ( selector ) . isChecked ( ) ; } ) ; test ( 'should invoke click method on selector object - chromium' , async ( ) : Promise < void > => { const url = `file:${ path . join ( __dirname , 'invoke-method.test.html' ) }` ; const selector = p . selector ( 'input' ) . withValue ( 'dynamically added' ) ; await p . withBrowser ( 'chromium' ) . withOptions ( { headless : false } ) . withCursor ( ) . navigateTo ( url ) . expectThat ( selector ) . isEnabled ( ) . invokeMethod ( 'click' , selector ) ; const isChecked = await selector . isChecked ( ) ; expect ( isChecked ) . toBe ( true ) ; await p . expectThatSelector ( selector ) . isChecked ( ) ; } ) ; } ) ;