(options: {
headless?: boolean
devtools?: boolean
baseURL?: string
})
| 342 | } |
| 343 | |
| 344 | export async function newBrowserSession(options: { |
| 345 | headless?: boolean |
| 346 | devtools?: boolean |
| 347 | baseURL?: string |
| 348 | }): Promise<BrowserSession> { |
| 349 | const browser = await chromium.launch({ |
| 350 | headless: options.headless ?? process.env.HEADLESS !== 'false', |
| 351 | args: options.headless ? undefined : ['--auto-open-devtools-for-tabs'], |
| 352 | timeout: 60000, |
| 353 | }) |
| 354 | const context = await browser.newContext({ |
| 355 | baseURL: options.baseURL ?? 'http://localhost:3000', |
| 356 | viewport: { width: 1280, height: 720 }, |
| 357 | }) |
| 358 | context.setDefaultTimeout(120000) |
| 359 | context.setDefaultNavigationTimeout(120000) |
| 360 | return new BrowserSessionImpl(browser, context) |
| 361 | } |
| 362 | |
| 363 | // see next.js/test/lib/browsers/playwright.ts |
no outgoing calls
no test coverage detected