ext-apps/playwright.config.ts
Olivier Chafik 6f14cf301d
fix: ensure E2E screenshot tests work consistently across CI and local (#150)
- Remove platform-specific browser channel (was using Chrome on macOS,
  Chromium in CI) - now uses default Chromium everywhere
- Add Docker-based test scripts for CI-identical local testing:
  - `npm run test:e2e:docker` - run tests in Docker
  - `npm run test:e2e:docker:update` - regenerate golden screenshots
- Regenerate golden screenshots using Docker/Linux environment

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 15:12:36 +00:00

44 lines
1.3 KiB
TypeScript

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 ? 2 : 4, // Parallel execution now works with factory pattern
timeout: 30000, // 30s per test
reporter: process.env.CI ? "list" : "html",
// Use platform-agnostic snapshot names (no -darwin/-linux suffix)
snapshotPathTemplate:
"{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}{ext}",
use: {
baseURL: "http://localhost:8080",
trace: "on-first-retry",
screenshot: "only-on-failure",
},
projects: [
{
name: "chromium",
use: {
...devices["Desktop Chrome"],
// Use default Chromium everywhere for consistent screenshot rendering
// Run `npm run test:e2e:docker` locally for CI-identical results
},
},
],
// Run examples server before tests
webServer: {
command: "npm run examples:start",
url: "http://localhost:8080",
// Always start fresh servers to avoid stale state issues
reuseExistingServer: false,
timeout: 120000,
},
// Snapshot configuration
expect: {
toHaveScreenshot: {
maxDiffPixelRatio: 0.06,
animations: "disabled",
},
},
});