The project uses Playwright for visual regression testing. The configuration is defined in playwright.config.ts and targets tests located in the ./visual-tests directory.
Key configuration settings include:
testDir: Set to ./visual-tests.fullyParallel: Enabled (true) to run tests in parallel.forbidOnly: Prevents running tests with .only in CI environments.retries: Set to 0.reporter: Uses the html reporter.webServer: Automatically starts the local development server using npx vite --config visual-tests/vite.config.ts at http://localhost:3419 before running tests. It is configured to reuseExistingServer: true.projects: Currently configured to run tests on chromium using the Desktop Chrome device profile.expect.toHaveScreenshot: Visual comparison is configured with a maxDiffPixels threshold of 2.
import { defineConfig, devices } from "@playwright/test";
export default defineConfig({
testDir: "./visual-tests",
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: 0,
reporter: "html",
use: {
baseURL: "http://localhost:3419",
trace: "on-first-retry",
},
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
],
webServer: {
command: "npx vite --config visual-tests/vite.config.ts",
url: "http://localhost:3419",
reuseExistingServer: true,
},
expect: {
toHaveScreenshot: {
maxDiffPixels: 2,
},
},
});