Skip to content

Playwright

Create playwright.config.ts in your project root:

import { defineConfig } from '@playwright/test';
import baseConfig from '@presencelearning/frontend-config/playwright';
export default defineConfig({
...baseConfig,
use: {
...baseConfig.use,
baseURL: 'http://localhost:4200', // Your dev server URL
},
webServer: {
command: 'npm run start',
port: 4200,
reuseExistingServer: !process.env.CI,
},
});

The example above overrides the defaults. The base config uses port 3010, and its own webServer block only activates when CI or RUN_WEB_SERVER is set. PW_BASE_URL overrides the base URL without editing config.

  • CI/CD optimized (Docker/Linux detection)
  • Visual regression testing support — toHaveScreenshot tolerates a 5% diff off Linux and is exact on Linux, so reference screenshots should be generated via the Docker image to match CI
  • Chromium only; the firefox, webkit, and mobile projects are present but commented out, so add them in your own config if you need them
  • On CI: 1 retry, 1 worker, forbidOnly, html + junit reporters into test-results/ui-tests/
  • Timeouts: 2 min per test, 10 s per expect, 90 s per navigation
  • ignoreHTTPSErrors: true — convenient against a local or self-signed HTTPS dev server, but it disables TLS certificate validation for the whole run. Set it to false in your own config if your suite needs to catch certificate problems

The base config sets testDir: 'ui-tests/tests' and a snapshotPathTemplate beneath it. If your e2e specs live elsewhere, override testDir — otherwise Playwright collects zero tests and reports no error.