playwright.config.ts

 1import { defineConfig, devices } from '@playwright/test';
 2
 3/**
 4 * @see https://playwright.dev/docs/test-configuration
 5 */
 6export default defineConfig({
 7  testDir: './e2e',
 8  /* Run tests in files in parallel */
 9  fullyParallel: false, // Keep simple for now
10  /* Fail the build on CI if you accidentally left test.only in the source code. */
11  forbidOnly: !!process.env.CI,
12  /* Retry on CI only */
13  retries: process.env.CI ? 1 : 0,
14  /* Single worker for predictable test database state */
15  workers: 1,
16  /* Reporter to use. See https://playwright.dev/docs/test-reporters */
17  reporter: process.env.CI ? [['html', { open: 'never' }], ['list']] : 'list',
18  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
19  use: {
20    /* Base URL to use in actions like `await page.goto('/')`. */
21    baseURL: process.env.TEST_SERVER_URL || 'http://localhost:9001',
22    /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
23    trace: 'on-first-retry',
24    /* Take screenshots on failure */
25    screenshot: 'only-on-failure',
26    /* Record video only on failure */
27    video: 'on-first-retry',
28  },
29
30  /* Just test mobile Chrome for simplicity */
31  projects: [
32    {
33      name: 'Mobile Chrome',
34      use: { ...devices['Pixel 5'] },
35    },
36  ],
37
38  /* Run our test server with isolated database */
39  webServer: {
40    command: 'node scripts/test-server.cjs',
41    url: process.env.TEST_SERVER_URL || 'http://localhost:9001',
42    reuseExistingServer: !process.env.CI, // Allow reuse in dev, always fresh in CI
43    timeout: 60000,
44  },
45});