Configuration File in Playwright
From the Playwright cheat sheet · Installation & Setup · verified Jul 2026
Configuration File
Set up playwright.config.ts with projects, reporters, and options
typescript
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests',
timeout: 30000,
retries: process.env.CI ? 2 : 0,
use: {
baseURL: 'http://localhost:3000',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
},
projects: [
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
{ name: 'firefox', use: { ...devices['Desktop Firefox'] } },
{ name: 'webkit', use: { ...devices['Desktop Safari'] } },
],
});💡 The webServer option auto-starts your dev server before running tests
⚡ Use fullyParallel: true to run tests in parallel across files and within files
📌 forbidOnly prevents accidental test.only commits from passing in CI
🟢 Device emulation is built-in — just spread from the devices object
configsetup