Add Playwright E2E testing infrastructure
- Add playwright-web-flake to flake.nix for NixOS browser support - Pin @playwright/test@1.56.1 to match nixpkgs version - Create playwright.config.ts with Chromium-only, auto-start dev server - Add e2e/smoke.spec.ts with initial smoke tests - Add .mcp.json for Claude browser control via MCP - Update .gitignore for playwright artifacts - Remove E2E test skip from spec.md Known Limitations - Update specs/testing.md to require three-tier testing approach Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
46
playwright.config.ts
Normal file
46
playwright.config.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
// ABOUTME: Playwright E2E test configuration for browser-based testing.
|
||||
// ABOUTME: Configures Chromium-only headless testing with automatic dev server startup.
|
||||
import { defineConfig, devices } from "@playwright/test";
|
||||
|
||||
export default defineConfig({
|
||||
// Test directory for E2E tests
|
||||
testDir: "./e2e",
|
||||
|
||||
// Run tests in parallel
|
||||
fullyParallel: true,
|
||||
|
||||
// Fail the build on CI if you accidentally left test.only in the source code
|
||||
forbidOnly: !!process.env.CI,
|
||||
|
||||
// Retry failed tests on CI only
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
|
||||
// Limit parallel workers on CI to avoid resource issues
|
||||
workers: process.env.CI ? 1 : undefined,
|
||||
|
||||
// Reporter configuration
|
||||
reporter: [["html", { open: "never" }], ["list"]],
|
||||
|
||||
// Shared settings for all projects
|
||||
use: {
|
||||
// Base URL for navigation actions like page.goto('/')
|
||||
baseURL: "http://localhost:3000",
|
||||
|
||||
// Collect trace on first retry for debugging
|
||||
trace: "on-first-retry",
|
||||
|
||||
// Take screenshot on failure
|
||||
screenshot: "only-on-failure",
|
||||
},
|
||||
|
||||
// Configure projects - Chromium only per requirements
|
||||
projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }],
|
||||
|
||||
// Run dev server before starting tests
|
||||
webServer: {
|
||||
command: "pnpm dev",
|
||||
url: "http://localhost:3000",
|
||||
reuseExistingServer: !process.env.CI,
|
||||
timeout: 120 * 1000, // 2 minutes for Next.js to start
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user