arrow-left Back to topicQuizWeb serverCheck yourself1.You set reuseExistingServer: !process.env.CI in your webServer config. A teammate runs the tests locally without starting the dev server first. What happens?Tests fail immediately with 'connection refused' because no server is runningPlaywright starts the dev server automatically using the configured command, waits for it to be ready, then runs testsTests are skipped because the server isn't availablePlaywright tries to reuse the server, fails, and asks the user to start it manually2.Your Next.js app takes 90 seconds to compile on the first start. Tests fail with a timeout error before the server is ready. What do you change?Increase the test timeout in playwright.config.ts — the server timeout is linked to the test timeoutAdd timeout: 120 * 1000 to the webServer config — the default is 60 secondsSet reuseExistingServer: true so tests wait indefinitely for the serverUse wait: { stdout: /ready/i } instead of url — stdout matching has no timeout3.Your server responds 200 to the health check URL immediately, but the database connection isn't ready for another 5 seconds — causing test failures. What webServer option handles this?Add a sleep of 5 seconds at the start of each testUse the wait option with a stdout/stderr regex pattern — Playwright waits for that string to appear in server output before starting testsSet a delay option: delay: 5000 in the webServer configConfigure retries: 3 in playwright.config.ts so tests retry until the database is ready4.Your project has a React frontend on port 3000 and a Node API on port 4000. Both need to be running before tests start. How do you configure this?Add a pre-test script in package.json that starts both serversSet webServer to an array of two config objects, one for each serverUse a single webServer config with command: 'npm run frontend & npm run api'Create two playwright.config.ts files and run them sequentially5.After setting up webServer pointing to localhost:3000, your tests still use await page.goto('http://localhost:3000/orders') with the full URL. What simpler pattern does Playwright support?Set baseURL in the use section — page.goto('/orders') automatically prepends itUse page.goto({ path: '/orders' }) to separate origin from pathDeclare SERVER_URL in process.env and reference it in each gotowebServer automatically sets baseURL — no extra config needed6.On CI, what happens if the port that webServer is configured to use is already occupied by another process?Playwright automatically picks the next available portThe test run fails with an error because reuseExistingServer: false (CI) means always start fresh — a port conflict is fatalPlaywright kills the existing process and starts the configured serverPlaywright reuses the existing server regardless of reuseExistingServer7.What does stdout: 'ignore', stderr: 'pipe' in the webServer config do?Suppresses all server output to keep CI logs cleanDiscards normal server output (stdout) but forwards error output (stderr) to the terminal — so startup errors are visible but routine logs are hiddenCaptures server output to a file for later analysisRedirects server logs to the Playwright test output for each test8.Where is the recommended place to read environment variables set by the webServer's wait regex named capture groups?In playwright.config.ts after the webServer declarationIn test files via process.env — the variables are available to all tests after the server startsIn globalSetup — it runs before tests and has access to webServer outputIn the webServer itself — named groups are only accessible within the webServer configSubmit answersarrow-left PreviousReportersPage object modelsNext arrow-right