Playwright's bundled Chromium lags behind Chrome security releases (1.56.1 ships 141, and even 1.64.1 ships 156.0.8078.4, before the 156.0.8078.73 fixes), and Playwright launches it with --no-sandbox by default. Outside CI, use the installed, auto-updated Chrome with the sandbox enabled. CI keeps the bundled Chromium, so the self-hosted runner's preinstalled 1.56.1 browsers still work. Assisted-by: Claude (Opus 5.5 Medium)
37 lines
931 B
TypeScript
37 lines
931 B
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
export default defineConfig({
|
|
expect: {
|
|
timeout: 5000
|
|
},
|
|
forbidOnly: !!process.env.CI,
|
|
fullyParallel: true,
|
|
projects: [
|
|
{
|
|
name: 'chromium',
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
// locally, the installed (auto-updated) Chrome with its sandbox on: the bundled
|
|
// Chromium lags behind security fixes and Playwright disables its sandbox by default
|
|
...(process.env.CI ? {} : { channel: 'chrome', launchOptions: { chromiumSandbox: true } })
|
|
}
|
|
}
|
|
],
|
|
reporter: 'line',
|
|
retries: process.env.CI ? 2 : 0,
|
|
testDir: 'tests/e2e',
|
|
testMatch: ['**/*.e2e.ts'],
|
|
timeout: 30000,
|
|
use: {
|
|
baseURL: 'http://localhost:8181',
|
|
trace: 'on-first-retry'
|
|
},
|
|
webServer: {
|
|
command: 'npm run build && npx http-server ./dist -p 8181',
|
|
port: 8181,
|
|
reuseExistingServer: !process.env.CI,
|
|
timeout: 120000
|
|
},
|
|
workers: process.env.CI ? 1 : undefined
|
|
});
|