import * as SUT from '../../playwright-fluent' ; describe ( 'Playwright Fluent - navigateTo' , ( ) : void => { let p ; beforeEach ( ( ) : void => { p = new SUT . PlaywrightFluent ( ) ; } ) ; afterEach ( async ( ) : Promise < void > => { await p . close ( ) ; } ) ; test ( 'should give back an error on navigating to an url without launching the browser' , async ( ) : Promise < void > => { let result = undefined ; try { await p . navigateTo ( 'https://www.google.fr' ) ; } catch ( error ) { result = error as Error ; } expect ( result && result . message ) . toContain ( "Cannot navigate to 'https://www.google.fr' because no browser has been launched" ) ; } ) ; test ( 'should navigate to url with chromium' , async ( ) : Promise < void > => { const url = 'https://reactstrap.github.io/?path=/docs/components-forms--input' ; await p . withBrowser ( 'chromium' ) . navigateTo ( url ) ; expect ( await p . getCurrentUrl ( ) ) . toBe ( `${ url }` ) ; expect ( p . lastError ( ) ) . toBe ( undefined ) ; } ) ; test ( 'should navigate to url with firefox' , async ( ) : Promise < void > => { const url = 'https://reactstrap.github.io/?path=/docs/components-forms--input' ; await p . withBrowser ( 'firefox' ) . navigateTo ( url ) ; expect ( await p . getCurrentUrl ( ) ) . toBe ( `${ url }` ) ; expect ( p . lastError ( ) ) . toBe ( undefined ) ; } ) ; test ( 'should navigate to url with webkit' , async ( ) : Promise < void > => { const url = 'https://reactstrap.github.io/?path=/docs/components-forms--input' ; await p . withBrowser ( 'webkit' ) . navigateTo ( url ) ; expect ( await p . getCurrentUrl ( ) ) . toBe ( `${ url }` ) ; expect ( p . lastError ( ) ) . toBe ( undefined ) ; } ) ; } ) ;