import * as SUT from '../index' ; import { Dialog , Page } from 'playwright' ; describe ( 'accept page dialog' , ( ) : void => { beforeEach ( ( ) : void => { } ) ; test ( 'should return an error when browser has not been launched' , async ( ) : Promise < void > => { const page = undefined ; const dialog = undefined ; const expectedError = new Error ( 'Cannot accept dialog because no browser has been launched' ) ; await SUT . acceptDialog ( dialog , 'foobar' , page , ( ) => { } ) . catch ( ( error ) : void => expect ( error ) . toMatchObject ( expectedError ) ) ; } ) ; } ) ;