# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Project Overview Spiceflow E2E tests - Playwright-based end-to-end tests for the Spiceflow AI Session Orchestration PWA. Tests run against both the Clojure backend and SvelteKit frontend. ## Commands ```bash # Run all tests (starts both servers automatically) npm test # Run with visible browser npm run test:headed # Run with Playwright UI mode npm run test:ui ``` ## Architecture The e2e setup automatically manages both servers: 1. **Global Setup** (`global-setup.ts`) - Starts backend (port 3001) and frontend (port 5174) 2. **Global Teardown** (`global-teardown.ts`) - Stops both servers 3. **Server Utils** (`server-utils.ts`) - Spawns Clojure and Vite processes, waits for health checks E2E tests use different ports (3001/5174) than dev servers (3000/5173) to allow running tests without interfering with development. Tests use Playwright's `page` fixture for browser interactions and `request` fixture for direct API calls. ## Test Database E2E tests use a separate database (`server/test-e2e.db`) to avoid polluting the main database. ## Writing Tests ```typescript import { test, expect } from '@playwright/test'; import { E2E_BACKEND_URL } from '../playwright.config'; test('example', async ({ page, request }) => { // Direct API call - use E2E_BACKEND_URL for backend requests const response = await request.get(`${E2E_BACKEND_URL}/api/sessions`); // Browser interaction - baseURL is configured in playwright.config.ts await page.goto('/'); await expect(page.locator('h1')).toBeVisible(); }); ``` ## Parent Project This is part of the Spiceflow monorepo. See `../CLAUDE.md` for full project documentation including: - `../server/` - Clojure backend (Ring/Reitit, SQLite) - `../client/` - SvelteKit PWA frontend