The playwright.config.js file controls test execution behavior and browser settings.
Key configuration options:
module.exports = {
// Test directory
testDir: './tests',
// Global timeout for each test
timeout: 30000,
// Global setup and teardown
globalSetup: './global-setup.js',
globalTeardown: './global-teardown.js',
// Retry failed tests
retries: 2,
// Parallel execution
workers: process.env.CI ? 1 : undefined,
// Reporter configuration
reporter: [['html'], ['junit', { outputFile: 'results.xml' }]],
// Browser and context settings
use: {
baseURL: 'http://localhost:3000',
headless: true,
screenshot: 'only-on-failure',
video: 'retain-on-failure',
trace: 'on-first-retry'
},
// Multiple browser projects
projects: [
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
{ name: 'mobile', use: { ...devices['iPhone 12'] } }
]
};
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
The model's verdict: “”
The interactive diagram is below the answer - jump to diagram ↓
This answer is explained by a shared concept diagram - open →