Files
spiceflow/e2e/CLAUDE.md

1.6 KiB

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

# 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 3000) and frontend (port 5173)
  2. Global Teardown (global-teardown.ts) - Stops both servers
  3. Server Utils (server-utils.ts) - Spawns Clojure and Vite processes, waits for health checks

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

import { test, expect } from '@playwright/test';

test('example', async ({ page, request }) => {
  // Direct API call
  const response = await request.get('http://localhost:3000/api/sessions');

  // Browser interaction
  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