with one click
e2e-test-service-management
// Service management for E2E testing in EdgeQuake. Start, stop, and monitor PostgreSQL, backend API, and frontend services. Includes health checks and logging utilities for interactive testing workflows.
// Service management for E2E testing in EdgeQuake. Start, stop, and monitor PostgreSQL, backend API, and frontend services. Includes health checks and logging utilities for interactive testing workflows.
Integrate CopilotKit AI components into Next.js frontend for building agentic UIs. Enables context-aware AI agents that can read app state and trigger tools/actions. Supports custom adapters for self-hosted LLMs and multiple provider integrations.
Validate documentation traceability between code annotations (@implements), feature registry, business rules, and use cases. Detect ID collisions, undocumented features, broken cross-references, and namespace violations.
Unified development workflow for EdgeQuake using Makefile commands. Use when starting services, running tests, or managing the full development stack (database, backend, frontend). Provides simplified alternatives to raw cargo/npm commands.
Validate PDF to Markdown conversion quality using multi-dimensional metrics. Assess table accuracy, style preservation (bold/italic/headings), robustness, and performance with standardized F1-scoring methodology.
Capture EdgeQuake WebUI routes with Playwright and write artifacts immediately (screenshots + per-page request JSON + capture index). Use when adding/updating Playwright E2E capture specs or when asked to automate UI screenshot collection.
Automatically generate comprehensive documentation for Rust and TypeScript codebases by analyzing code structure, patterns, and relationships. Supports trait-based patterns, async operations, React components, and Next.js applications.
| name | e2e-test-service-management |
| description | Service management for E2E testing in EdgeQuake. Start, stop, and monitor PostgreSQL, backend API, and frontend services. Includes health checks and logging utilities for interactive testing workflows. |
| license | Proprietary (repository internal) |
| compatibility | Requires make, cargo, Node.js/pnpm, Docker Desktop with docker-compose support, and curl for health checks. |
| metadata | {"repo":"raphaelmansuy/edgequake","area":"testing","dependencies":"makefile-dev-workflow","related_skills":["makefile-dev-workflow","playwright-ux-ui-capture","ux-ui-analyze-single-page"],"file":"TESTING_SERVICES.sh (utility script, optional)"} |
Use this skill when you need to:
ā
E2E Testing Workflows - Running Playwright tests with real services
ā
Interactive Debugging - Testing features manually with live backend
ā
Service Isolation - Starting only specific services
ā
Health Monitoring - Detecting service crashes/failures
ā
Log Inspection - Troubleshooting backend/database issues
ā
Test Isolation - Cleaning services between test runs
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā E2E Testing Environment ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā ā
ā Frontend (Next.js) Port 3000 ā
ā āā Playwright Tests ā
ā āā Hot Reload Development ā
ā āā TypeScript/React Components ā
ā ā
ā Backend (Rust) Port 8080 ā
ā āā RAG Query Engine ā
ā āā Document Processing ā
ā āā Knowledge Graph API ā
ā āā LLM Integration ā
ā ā
ā Database (PostgreSQL) Port 5432 ā
ā āā pgvector Extension (embeddings) ā
ā āā Apache AGE (graph storage) ā
ā āā Conversation History ā
ā āā Document Metadata ā
ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Frontend (3000)
ā
Backend (8080)
ā
Database (5432)
Services should be started in reverse dependency order: Database ā Backend ā Frontend
Services should be stopped in dependency order: Frontend ā Backend ā Database
make dev
What this does:
Output example:
ā PostgreSQL started on localhost:5432
ā Backend running on http://localhost:8080
ā Frontend ready on http://localhost:3000
Wait time: 15-30 seconds (depends on system)
make stop
Stops all services gracefully in the correct order.
make status
Returns health status of all three services:
š¢ Frontend: http://localhost:3000 (200 OK)
š¢ Backend: http://localhost:8080 (200 OK)
š¢ Database: localhost:5432 (responding)
make db-start
Starts PostgreSQL container with pgvector and Apache AGE extensions.
Configuration:
edgequake-postgrespostgres:15-alpine with custom extensionsedgequake_postgres_data (persistent)5432:5432make db-stop
Stops container gracefully (saves state).
make db-logs
Streams PostgreSQL logs in real-time for debugging connection issues.
make db-shell
Opens interactive psql terminal to:
make db-reset
WARNING: Deletes ALL data and reinitializes database. Use only for:
make backend-dev
Starts backend with:
BACKEND_PORT)Important Environment Variables:
# Test with real OpenAI
export OPENAI_API_KEY="sk-your-key-here"
make backend-dev
# Test with mock provider (default)
make backend-dev # Uses mock by default
make backend-build
Creates optimized release binary (slower build, faster runtime).
make backend-run
Runs pre-compiled backend binary (requires backend-build first).
make backend-test
Runs all Rust tests:
OPENAI_API_KEY=sk-... make backend-testmake backend-fmt # Format code with rustfmt
make backend-clippy # Run clippy linter
make frontend-dev
Starts development server with:
make frontend-build
Creates optimized production build in .next/.
make frontend-start
Runs production-optimized server (requires frontend-build first).
make frontend-test
Runs Jest unit tests for React components.
make frontend-lint
Runs ESLint to check for code quality issues.
# 1. Start all services
make dev
make status # Verify all are running
# 2. Run Playwright tests
cd edgequake_webui
pnpm exec playwright test
# 3. View test results
# Reports generated in: playwright-report/
# 4. Stop services (when done)
make stop
# Test a specific file
cd edgequake_webui
pnpm exec playwright test e2e/query-page.spec.ts
# Test with specific browser
pnpm exec playwright test --project=chromium
# Run in headed mode (see browser)
pnpm exec playwright test --headed
# Debug mode (pause on failures)
pnpm exec playwright test --debug
# 1. Start services
make dev
# 2. Use Playwright MCP tools for interactive testing
# - mcp_microsoft_pla_browser_navigate
# - mcp_microsoft_pla_browser_click
# - mcp_microsoft_pla_browser_type
# - mcp_microsoft_pla_browser_take_screenshot
# 3. Inspect results and failures
# 4. Stop when complete
make stop
In separate terminal:
# Watch logs continuously
make db-logs & # Terminal 1
make backend-logs & # Terminal 2
make frontend-logs &# Terminal 3
# Or view combined logs
tail -f edgequake/target/debug/backend.log
# Frontend
curl -s http://localhost:3000 | head -20
# Backend API
curl -s http://localhost:8080/api/v1/health | jq
# Database connection
psql -h localhost -U edgequake -d edgequake -c "SELECT 1"
#!/bin/bash
# Wait for all services to be ready
echo "Waiting for services..."
# Frontend
until curl -s http://localhost:3000 > /dev/null 2>&1; do
echo " ā³ Frontend not ready..."
sleep 1
done
echo "ā Frontend ready"
# Backend
until curl -s http://localhost:8080/api/v1/health > /dev/null 2>&1; do
echo " ā³ Backend not ready..."
sleep 1
done
echo "ā Backend ready"
# Database
until psql -h localhost -U edgequake -d edgequake -c "SELECT 1" > /dev/null 2>&1; do
echo " ā³ Database not ready..."
sleep 1
done
echo "ā Database ready"
echo "ā
All services ready for testing"
Check logs:
make db-logs # Database issues
make backend-logs # Backend/API issues
make frontend-logs # Frontend issues
Common issues:
| Issue | Solution |
|---|---|
| Port already in use (3000/8080/5432) | make stop then make dev OR change ports in .env |
| Database won't connect | Ensure Docker is running: docker ps |
| Backend panic on startup | Check migrations: make db-reset |
| Frontend build errors | Clear cache: cd edgequake_webui && rm -rf .next node_modules && make frontend-dev |
# Check PostgreSQL is running
docker ps | grep postgres
# Check logs
docker logs edgequake-postgres
# Test connection directly
psql -h localhost -U edgequake -d edgequake -c "SELECT version()"
# Run backend tests with real LLM
export OPENAI_API_KEY="sk-..."
make backend-test
# Run specific test
cargo test --package edgequake-core --test e2e_pipeline
# See detailed output
cargo test -- --nocapture
# Run in headed mode to see what's happening
cd edgequake_webui && pnpm exec playwright test --headed
# Run with debug tracing
pnpm exec playwright test --debug
# View test reports
open playwright-report/index.html
# Backend
BACKEND_PORT=8080 # Default
RUST_LOG=debug # Log level
OPENAI_API_KEY=sk-... # Optional (mock by default)
# Frontend
NEXT_PUBLIC_API_URL=http://localhost:8080
# Database
POSTGRES_USER=edgequake
POSTGRES_PASSWORD=edgequake
POSTGRES_DB=edgequake
DATABASE_URL=postgresql://edgequake:edgequake@localhost:5432/edgequake
.env.local for overridescat > .env.local << EOF
BACKEND_PORT=8080
OPENAI_API_KEY=sk-your-real-key
RUST_LOG=debug
EOF
make stop
make dev
sleep 5 # Wait for startup
# Terminal 1: Run tests
cd edgequake_webui && pnpm exec playwright test
# Terminal 2: Monitor backend
make backend-logs
# Terminal 3: Monitor database
make db-logs
# Before risky tests
docker exec edgequake-postgres \
pg_dump -U edgequake edgequake > /tmp/backup.sql
# After failures, restore
docker exec -i edgequake-postgres \
psql -U edgequake edgequake < /tmp/backup.sql
# Test with mock (fast, deterministic)
make backend-dev
# Test with real OpenAI (costs money, real behavior)
OPENAI_API_KEY=sk-... make backend-dev
make status
# All should show š¢ (green)
# If not, wait and retry
# Start services
make dev
# Run focused test
cd edgequake_webui
pnpm exec playwright test --grep "initial load"
# 1. Start services
make dev
# 2. Upload documents via UI or API
curl -X POST http://localhost:8080/api/v1/documents \
-F "file=@document.pdf"
# 3. Run tests
cd edgequake_webui && pnpm exec playwright test
# 1. Start services
make dev
# 2. Stop backend to simulate failure
make backend-stop
# 3. Run tests to verify error handling
cd edgequake_webui && pnpm exec playwright test
# 4. Restart backend
make backend-dev
# 1. Start services with resource monitoring
make dev
# 2. Monitor during test
watch -n 1 'docker stats edgequake-postgres edgequake-backend'
# 3. Run load tests
cd edgequake_webui
pnpm exec playwright test --workers=5 # Parallel execution
name: E2E Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Start services
run: make dev &
- name: Wait for services
run: |
until curl -s http://localhost:3000; do sleep 1; done
until curl -s http://localhost:8080/api/v1/health; do sleep 1; done
- name: Run E2E tests
run: |
cd edgequake_webui
pnpm exec playwright test
- name: Upload results
if: always()
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: edgequake_webui/playwright-report/
- name: Stop services
if: always()
run: make stop
| Task | Command |
|---|---|
| Start all services | make dev |
| Stop all services | make stop |
| Check status | make status |
| Backend dev | make backend-dev |
| Frontend dev | make frontend-dev |
| Database shell | make db-shell |
| Run E2E tests | cd edgequake_webui && pnpm exec playwright test |
| View test reports | open edgequake_webui/playwright-report/index.html |
| Debug test | cd edgequake_webui && pnpm exec playwright test --debug |
| View backend logs | make backend-logs |
| View database logs | make db-logs |
| Reset database | make db-reset |
ā
Service Start/Stop Simplification - Using Make commands instead of manual docker/cargo calls saves time and prevents mistakes
ā
Browser Automation - Interactive E2E testing with MCP tools provides fast feedback and debugging visibility
ā
Console Log Analysis - Monitoring browser and backend logs during tests reveals issues quickly
ā
Isolated Service Management - Starting only needed services reduces resource usage and startup time
| Challenge | Solution | Benefit |
|---|---|---|
| Services not responding when tests start | Wait for health checks before running tests | Prevents flaky tests |
| Stale data between test runs | make db-reset between cycles | Clean test isolation |
| Difficult to track issues across services | Monitor logs in parallel terminals | Faster debugging |
| Forgetting to stop services | make stop creates habit | Prevents port conflicts |
| Tests dependent on real LLM costs | Default to mock, override with env var | Faster feedback loops |
make status before running testsdb-reset between test cycles for clean stateLast Updated: December 27, 2025
Tested in Session: E2E Testing New Query Button Fix
Verified with: Playwright MCP Tools + Service Management Commands