Files
euchre_camp/playwright.config.ts
T
david 38771a86cb
Pull Request / unit-tests (pull_request) Successful in 2m3s
Pull Request / analyze-bump-type (pull_request) Successful in 13s
Pull Request / build-and-deploy-ci (pull_request) Failing after 16m0s
perf: parallelize tests and reduce timeouts
- Increase workers from 1 to 10 in CI for parallel execution
- Reduce expect timeout from 5000ms to 2000ms
- Reduce all waitForTimeout calls >1000ms to 200-500ms
- Remove unnecessary waits in global setup
2026-05-19 00:39:46 -07:00

74 lines
2.1 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './e2e',
timeout: 30000,
expect: {
timeout: 2000
},
// Run tests in parallel for speed - database isolation is per-test via unique data
fullyParallel: true,
// Use multiple workers in CI to speed up test execution
workers: process.env.CI ? 10 : 1,
// Reporter to use
reporter: 'html',
// Global setup and teardown
globalSetup: require.resolve('./e2e/global.setup'),
globalTeardown: require.resolve('./e2e/global.teardown'),
// Use base URL for relative navigation
use: {
baseURL: process.env.CI ? 'https://euchre-ci.notsosm.art' : 'http://localhost:3000',
// Collect trace when retrying the failed test.
trace: 'on-first-retry',
// Capture screenshot only on failure
screenshot: 'only-on-failure',
},
// Configure projects
projects: [
// Setup project - runs before all other projects
{
name: 'setup',
testMatch: /global\.setup\.ts/,
},
// Main Chromium project with regular user authentication
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
// Use prepared auth state for regular user tests
storageState: 'playwright/.auth/user.json',
},
dependencies: ['setup'],
testIgnore: ['**/admin-*.test.ts'],
},
// Admin user project
{
name: 'chromium-admin',
use: {
...devices['Desktop Chrome'],
// Use prepared auth state for admin tests
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['setup'],
},
// Unauthenticated project - for tests that don't require login
{
name: 'chromium-unauth',
use: {
...devices['Desktop Chrome'],
// No authentication state
storageState: undefined,
},
dependencies: ['setup'],
testIgnore: ['**/admin-*.test.ts'],
},
],
// Run your local dev server before starting the tests
webServer: process.env.CI ? undefined : {
command: 'bun run dev',
url: 'http://localhost:3000',
timeout: 120000,
reuseExistingServer: !process.env.CI,
},
});