import * as SUT from '../index' ; import { Page } from 'playwright' ; describe ( 'record downloads to' , ( ) : void => { beforeEach ( ( ) : void => { } ) ; test ( 'should return an error when browser has not been launched' , async ( ) : Promise < void > => { const page = undefined ; const downloadsDirectory = __dirname ; const expectedError = new Error ( `Cannot record downloads to '${ downloadsDirectory }' because no browser has been launched` ) ; await SUT . recordDownloadsTo ( downloadsDirectory , page ) . catch ( ( error ) : void => expect ( error ) . toMatchObject ( expectedError ) ) ; } ) ; } ) ;