Unverified Commit 71c21dfc authored by Hendrik Liebau's avatar Hendrik Liebau Committed by GitHub

Set default playwright timeout to `NEXT_E2E_TEST_TIMEOUT` (#66258)

This allows us to set breakpoints and debug e2e tests without
encountering a timeout after 60 seconds. For example, using:
    
```
NEXT_E2E_TEST_TIMEOUT=1000000 NODE_OPTIONS=--inspect-brk pnpm test-dev test/e2e/app-dir/metadata/metadata.test.ts
```
    
Notably, this change also affects the turbopack dev tests in the CI,
where `NEXT_E2E_TEST_TIMEOUT` is currently set to 240 seconds. Since the
same env variable is also used for `jest.setTimeout()`, a test timeout
will now most likely occur due to jest timing out, and not a specific
playwright check (i.e. `waitForElementByCss` or `waitForCondition`)
timing out. This sounds acceptable to me.
Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
parent 4c48f3b5
...@@ -21,6 +21,12 @@ let websocketFrames: Array<{ payload: string | Buffer }> = [] ...@@ -21,6 +21,12 @@ let websocketFrames: Array<{ payload: string | Buffer }> = []
const tracePlaywright = process.env.TRACE_PLAYWRIGHT const tracePlaywright = process.env.TRACE_PLAYWRIGHT
const defaultTimeout = process.env.NEXT_E2E_TEST_TIMEOUT
? parseInt(process.env.NEXT_E2E_TEST_TIMEOUT, 10)
: // In development mode, compilation can take longer due to lower CPU
// availability in GitHub Actions.
60 * 1000
// loose global to register teardown functions before quitting the browser instance. // loose global to register teardown functions before quitting the browser instance.
// This is due to `quit` can be called anytime outside of BrowserInterface's lifecycle, // This is due to `quit` can be called anytime outside of BrowserInterface's lifecycle,
// which can create corrupted state by terminating the context. // which can create corrupted state by terminating the context.
...@@ -208,10 +214,8 @@ export class Playwright extends BrowserInterface { ...@@ -208,10 +214,8 @@ export class Playwright extends BrowserInterface {
await this.initContextTracing(url, context) await this.initContextTracing(url, context)
page = await context.newPage() page = await context.newPage()
// in development compilation can take longer due to page.setDefaultTimeout(defaultTimeout)
// lower CPU availability in GH actions page.setDefaultNavigationTimeout(defaultTimeout)
page.setDefaultTimeout(60 * 1000)
page.setDefaultNavigationTimeout(60 * 1000)
pageLogs = [] pageLogs = []
websocketFrames = [] websocketFrames = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment