The project uses Playwright for end-to-end (E2E) testing. The configuration is managed via playwright.config.ts and is designed to run against a local development server.
Key configuration behaviors:
- Environment Variables: Uses
.env.local via dotenv to load environment variables. - Base URL: Automatically constructs the
baseURL using the PORT environment variable (defaulting to 3000). - Test Directory: Tests are located in the
./tests directory. - E2E Project: A specific project named
e2e is configured to match files in the e2e/ directory using the Desktop Chrome device profile. - Parallelism: Tests run in
fullyParallel mode. - CI Behavior: On Continuous Integration (CI),
forbidOnly is enabled to prevent accidental test.only usage, and reuseExistingServer is disabled.
import { defineConfig, devices } from "@playwright/test";
export default defineConfig({
testDir: "./tests",
fullyParallel: true,
projects: [
{
name: "e2e",
testMatch: /e2e\/.*\.test\.ts/,
use: { ...devices["Desktop Chrome"] },
},
],
use: {
baseURL: `http://localhost:${PORT}`,
trace: "retain-on-failure",
},
});