summaryrefslogtreecommitdiff
path: root/player-server/test/e2e-web/playwright.config.ts
blob: 26782bf9a6eef2de23004f61a508168922a1da09 (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { defineConfig, devices } from '@playwright/test';

// Base URL for the running player server. Override with the PLAYER_URL env var
// when testing against a non-default address or port.
const baseURL = process.env.PLAYER_URL || 'http://localhost:8080';

export default defineConfig({
  // Look for test files only inside the tests/ subdirectory.
  testDir: './tests',

  // Run each test file in its own isolated context. Tests within the same
  // file share a browser context by default (serial execution per file).
  fullyParallel: false,

  // Fail the CI run on test.only left in source.
  forbidOnly: !!process.env.CI,

  // Retry once on CI to absorb transient timing flakes.
  retries: process.env.CI ? 1 : 0,

  // Single worker: the tests mutate shared server state (bootstrap, user
  // accounts) so parallelism across workers would cause races.
  workers: 1,

  reporter: [['list'], ['html', { open: 'never' }]],

  // Allow up to 120 s for the global beforeAll hook which triggers a media
  // rescan and waits for at least one set to appear in the database.
  globalTimeout: 120_000,

  use: {
    baseURL,

    // Headless by default; PWDEBUG=1 or --headed enables the browser window.
    headless: true,

    // Capture a screenshot on failure for easier CI debugging.
    screenshot: 'only-on-failure',

    // Record a trace on the first retry to capture the failure timeline.
    trace: 'on-first-retry',

    // Generous navigation timeout for the Go server to respond on CI.
    navigationTimeout: 15_000,
    actionTimeout: 10_000,
  },

  projects: [
    {
      // Run against Chromium only. The smoke suite exercises application
      // logic, not cross-browser compatibility. Add Firefox/WebKit when
      // cross-browser coverage is needed.
      name: 'chromium',
      use: { ...devices['Desktop Chrome'] },
    },
  ],
});