// SPDX-License-Identifier: MIT OR Apache-2.0
// Copyright (c) 2025 Pierre Fitness Intelligence
// ABOUTME: Playwright E2E test configuration for the Pierre frontend.
// ABOUTME: Configures browser settings, base URL, and test directory structure.
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './e2e',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: process.env.CI ? 'github' : 'html',
timeout: 30000,
expect: {
timeout: 5000,
},
use: {
baseURL: 'http://localhost:5173',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
},
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
launchOptions: {
args: process.env.CI
? ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage']
: [],
},
},
},
],
// Run the Vite dev server before starting tests
// E2E_TEST=true disables backend proxy since all APIs are mocked by Playwright
webServer: {
command: 'npm run dev',
url: 'http://localhost:5173',
reuseExistingServer: !process.env.CI,
timeout: 120000,
env: {
E2E_TEST: 'true',
},
},
});