/ opencodehub / playwright.config.ts
Swadhin Biswas fix(ci): switch e2e to PostgreSQL service + harden dev env precedence · 6/4/2026
ab57b8a
41 lines · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
  testDir: './tests/e2e',
  fullyParallel: true,
  forbidOnly: !!process.env.CI,
  retries: process.env.CI ? 2 : 0,
  workers: process.env.CI ? 1 : undefined,
  reporter: 'html',
  use: {
    baseURL: 'http://localhost:4321',
    trace: 'on-first-retry',
  },
  projects: [
    {
      name: 'chromium',
      use: { ...devices['Desktop Chrome'] },
    },
  ],
  webServer: {
    command: 'bun run dev',
    url: 'http://localhost:4321',
    reuseExistingServer: !process.env.CI,
    timeout: 120_000,
    env: {
      // Inherit the parent process env so CI can inject DATABASE_URL, JWT_SECRET,
      // SITE_URL, etc. without us having to mirror them here.
      ...process.env,
      // E2E-specific overrides: bypass security middleware so tests don't get
      // rate-limited, and pin the site URL to the dev server so the
      // pre-receive git hook can reach it.
      RATE_LIMIT_SKIP_DEV: 'true',
      CSRF_SKIP_DEV: 'true',
      SITE_URL: 'http://localhost:4321',
      INTERNAL_HOOK_SECRET:
        process.env.INTERNAL_HOOK_SECRET ||
        'f387ae7ad3fb3493993a14574e8f0f28e2f745248d69168f8d84028df2ae74fc',
    },
  },
});