import { defineConfig, devices } from '@playwright/test'; export default defineConfig({ testDir: './test-harness/tests', /* Fail the build on CI if you accidentally left test.only in the source code. */ forbidOnly: !!process.env.CI, /* Retries for flakiness in CI */ retries: process.env.CI ? 2 : 0, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ reporter: 'html', use: { /* Base URL to use in actions like `await page.goto('/')`. */ baseURL: 'http://localhost:3080', /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: 'on-first-retry' }, projects: [ { name: 'chromium', use: { ...devices['Desktop Chrome'] } }, // You can add Firefox/WebKit here later if you want cross-browser testing ], expect: { // Configure global tolerance for visual regression tests toHaveScreenshot: { // Allows up to 2% of the pixels to be different before failing the test maxDiffPixelRatio: 0.02 } }, /* Run your local dev server before starting the tests */ webServer: { command: 'yarn test:start', // The command to boot test-harness/server.ts url: 'http://localhost:3080', // Playwright pings this until it gets a 2xx response reuseExistingServer: !process.env.CI } });