add resizing
This commit is contained in:
+64
-36
@@ -1,58 +1,86 @@
|
||||
# CLAUDE.md
|
||||
# E2E 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.
|
||||
Playwright end-to-end tests.
|
||||
|
||||
## 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
|
||||
npm test # Headless
|
||||
npm run test:headed # Visible browser
|
||||
npm run test:ui # Interactive UI
|
||||
npx playwright test tests/basic.spec.ts # Specific file
|
||||
npx playwright test -g "test name" # By name
|
||||
```
|
||||
|
||||
## Architecture
|
||||
## Test Ports
|
||||
|
||||
The e2e setup automatically manages both servers:
|
||||
| Service | Dev Port | E2E Port |
|
||||
|---------|----------|----------|
|
||||
| Backend | 3000 | 3001 |
|
||||
| Frontend | 5173 | 5174 |
|
||||
| Database | spiceflow.db | test-e2e.db |
|
||||
|
||||
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
|
||||
## Directory Structure
|
||||
|
||||
E2E tests use different ports (3001/5174) than dev servers (3000/5173) to allow running tests without interfering with development.
|
||||
```
|
||||
e2e/
|
||||
├── tests/ # Test files
|
||||
├── global-setup.ts # Starts servers
|
||||
├── global-teardown.ts # Stops servers
|
||||
├── server-utils.ts # Server utilities
|
||||
└── playwright.config.ts # Configuration
|
||||
```
|
||||
|
||||
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
|
||||
## Test Pattern
|
||||
|
||||
```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`);
|
||||
// API setup
|
||||
const res = await request.post(`${E2E_BACKEND_URL}/api/sessions`, {
|
||||
data: { provider: 'claude' }
|
||||
});
|
||||
const session = await res.json();
|
||||
|
||||
// Browser interaction - baseURL is configured in playwright.config.ts
|
||||
await page.goto('/');
|
||||
await expect(page.locator('h1')).toBeVisible();
|
||||
// Browser interaction
|
||||
await page.goto(`/session/${session.id}`);
|
||||
await page.fill('textarea', 'Hello');
|
||||
await page.click('button:has-text("Send")');
|
||||
|
||||
// Assertions
|
||||
await expect(page.locator('.assistant-message')).toBeVisible({ timeout: 30000 });
|
||||
|
||||
// Cleanup
|
||||
await request.delete(`${E2E_BACKEND_URL}/api/sessions/${session.id}`);
|
||||
});
|
||||
```
|
||||
|
||||
## Parent Project
|
||||
## Selectors
|
||||
|
||||
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
|
||||
```typescript
|
||||
page.locator('[data-testid="x"]') // By test ID
|
||||
page.getByRole('button', { name: 'Send' })
|
||||
page.locator('text=Hello')
|
||||
page.locator('.class')
|
||||
```
|
||||
|
||||
## Waits
|
||||
|
||||
```typescript
|
||||
await expect(locator).toBeVisible();
|
||||
await expect(locator).toBeVisible({ timeout: 30000 });
|
||||
await expect(locator).toHaveText('Expected');
|
||||
await expect(locator).not.toBeVisible();
|
||||
```
|
||||
|
||||
## Test Files
|
||||
|
||||
| File | Tests |
|
||||
|------|-------|
|
||||
| `basic.spec.ts` | Health, loading |
|
||||
| `workflow-claude.spec.ts` | Claude session flow |
|
||||
| `permissions-claude.spec.ts` | Permission handling |
|
||||
| `autoaccept-claude.spec.ts` | Auto-accept edits |
|
||||
| `tmux-terminal.spec.ts` | Tmux sessions |
|
||||
|
||||
Reference in New Issue
Block a user