|
27 | 27 | - **Streaming Citations**: Citations stream before the answer for instant transparency |
28 | 28 | - **Hybrid Runtime**: Edge for chat, Node.js for ingestion (optimal performance) |
29 | 29 | - **Observability**: OpenTelemetry (ingest/retrieval spans), Langfuse (LLM traces, token usage) |
30 | | -- **CI/CD & Testing**: GitHub Actions (lint, build, test), Vitest unit tests |
| 30 | +- **CI/CD & Testing**: GitHub Actions (lint, build, unit + E2E), Vitest, Playwright |
31 | 31 | - **Docker**: Standalone image + docker-compose for local/self-hosted run |
32 | 32 | - **Modern UI**: Beautiful, responsive chat interface with real-time streaming |
33 | 33 | - **Optional gRPC Gateway**: Binary-efficient vector upsert/query sidecar (Proto + Node server) |
@@ -106,6 +106,13 @@ graph TB |
106 | 106 |
|
107 | 107 | 6. **Open [http://localhost:3000](http://localhost:3000)** |
108 | 108 |
|
| 109 | +### E2E tests (Playwright) |
| 110 | + |
| 111 | +- **Scripts**: `npm run test:e2e` (starts the app on **port 3100** by default so it does not clash with `next dev` on 3000), `npm run test:e2e:ui` for the Playwright UI mode. Override with `PLAYWRIGHT_E2E_PORT` / `PLAYWRIGHT_BASE_URL`. |
| 112 | +- **CI**: After `npm run build`, the workflow installs Chromium and runs `npm run test:e2e`, which starts the **standalone** server (`node .next/standalone/server.js` on port 3100) because this app uses `output: "standalone"`. Only **smoke** tests run by default (no real Gemini/Upstash calls required for the UI checks). |
| 113 | +- **Full RAG E2E**: Set `E2E_FULL=1` and real API keys in the environment used by the Next server, add `e2e/fixtures/sample.pdf` (or `E2E_FIXTURE_PDF`), then run `npx playwright test e2e/optional-full-flow.spec.ts`. |
| 114 | +- **Preview deployments**: Run with `PLAYWRIGHT_SKIP_WEB_SERVER=1` and `PLAYWRIGHT_BASE_URL=https://your-preview.vercel.app`. |
| 115 | + |
109 | 116 | ## How It Works |
110 | 117 |
|
111 | 118 | ### 1. PDF Ingestion (Client-Side) |
@@ -146,14 +153,16 @@ graph TB |
146 | 153 | | **PDF Parsing** | `pdfjs-dist` | Client-side to avoid Edge limits | |
147 | 154 | | **UI** | React + `@ai-sdk/react` | Streaming chat with citation support | |
148 | 155 | | **Observability** | OpenTelemetry, Langfuse | Traces (ingest/retrieval), LLM generations & token usage | |
149 | | -| **CI/CD** | GitHub Actions | Lint, build, test on push/PR | |
150 | | -| **Testing** | Vitest | Unit tests (chunking, observability) | |
| 156 | +| **CI/CD** | GitHub Actions | Lint, build, unit + E2E on push/PR | |
| 157 | +| **Testing** | Vitest, Playwright | Unit tests; browser E2E (smoke + optional full RAG) | |
151 | 158 | | **Containers** | Docker, docker-compose | Local/self-hosted run | |
152 | 159 |
|
153 | 160 | ## Project Structure |
154 | 161 |
|
155 | 162 | ``` |
156 | 163 | serverless-rag/ |
| 164 | +├── e2e/ # Playwright tests (smoke + optional full flow) |
| 165 | +├── playwright.config.ts # Playwright + webServer (dev local / start in CI) |
157 | 166 | ├── src/ |
158 | 167 | │ ├── app/ |
159 | 168 | │ │ ├── api/ |
|
0 commit comments