How to fix flaky Playwright crashes and random browser exits in CI?
PlaywrightRandom exits are commonly resource-related: low memory, too many workers, or unstable shared CI agents.
Reduce concurrency, enable retries/traces, and isolate heavy suites.
// playwright.config.ts
import { defineConfig } from '@playwright/test';
export default defineConfig({
retries: 2,
workers: process.env.CI ? 2 : undefined,
use: { trace: 'on-first-retry' },
});
When crashes persist, compare pass/fail runs with traces and browser stderr logs.