forked from mirror/crumbs-original
Active service workers change the fetch lifecycle enough that Playwright's waitForResponse() misses SW-mediated responses, causing preferences tests to timeout. Block SW registration during e2e tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
42 lines
903 B
TypeScript
42 lines
903 B
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
export default defineConfig({
|
|
testDir: './tests/e2e',
|
|
fullyParallel: true,
|
|
forbidOnly: !!process.env.CI,
|
|
retries: 0,
|
|
workers: process.env.CI ? 4 : undefined,
|
|
reporter: 'html',
|
|
globalSetup: './tests/e2e/global-setup.ts',
|
|
use: {
|
|
baseURL: 'http://localhost:4173',
|
|
trace: 'on-first-retry',
|
|
screenshot: 'only-on-failure',
|
|
serviceWorkers: 'block'
|
|
},
|
|
projects: [
|
|
{
|
|
name: 'auth-setup',
|
|
testMatch: 'auth.spec.ts',
|
|
fullyParallel: false,
|
|
use: { ...devices['Desktop Chrome'] }
|
|
},
|
|
{
|
|
name: 'app',
|
|
testIgnore: 'auth.spec.ts',
|
|
dependencies: ['auth-setup'],
|
|
use: { ...devices['Desktop Chrome'] }
|
|
}
|
|
],
|
|
webServer: {
|
|
command: 'pnpm preview --port 4173',
|
|
port: 4173,
|
|
reuseExistingServer: !process.env.CI,
|
|
timeout: 120_000,
|
|
env: {
|
|
DATABASE_URL: './data/test-crumbs.db',
|
|
NODE_ENV: 'test'
|
|
}
|
|
}
|
|
});
|