import { PlaywrightFluent , LaunchOptions } from '../../playwright-fluent' ; declare const window ; describe ( 'Playwright Fluent - withOptions' , ( ) : void => { let p ; beforeEach ( ( ) : void => { p = new PlaywrightFluent ( ) ; } ) ; afterEach ( async ( ) : Promise < void > => { await p . close ( ) ; } ) ; test ( 'should target chromium in headfull mode' , async ( ) : Promise < void > => { const browser = 'chromium' ; await p . withBrowser ( browser ) . withOptions ( { headless : false } ) ; const browserInstance = p . currentBrowser ( ) ; const pageInstance = p . currentPage ( ) ; expect ( browserInstance ) . toBeDefined ( ) ; expect ( pageInstance ) . toBeDefined ( ) ; const userAgent = pageInstance && ( await pageInstance . evaluate ( ( ) => window . navigator . userAgent ) ) ; expect ( userAgent ) . toContain ( 'Chrome' ) ; expect ( userAgent ) . not . toContain ( 'Headless' ) ; } ) ; test ( 'should target chromium in headfull mode with custom window size' , async ( ) : Promise < void > => { const browser = 'chromium' ; const options = { headless : false , args : [ '--window-size=999,700' ] , } ; const url = 'https://reactstrap.github.io' ; await p . withBrowser ( browser ) . withOptions ( options ) . navigateTo ( url ) ; const windowState = await p . getCurrentWindowState ( ) ; expect ( Math . abs ( windowState . outerWidth - 999 ) ) . toBeLessThanOrEqual ( 20 ) ; expect ( Math . abs ( windowState . outerHeight - 700 ) ) . toBeLessThanOrEqual ( 40 ) ; const viewport = { width : windowState . innerWidth , height : windowState . innerHeight } ; expect ( Math . abs ( viewport . height - windowState . outerHeight ) ) . toBeLessThanOrEqual ( 132 ) ; expect ( Math . abs ( viewport . width - windowState . outerWidth ) ) . toBeLessThanOrEqual ( 20 ) ; } ) ; } ) ;