meteor_detection_system/docker-compose.test.yml
grabbit a04d6eba88 🎉 Epic 1 Complete: Foundation, User Core & First Light
## Major Achievements 

### Story 1.14: 前端事件画廊页面 - Gallery Page Implementation
-  Protected /gallery route with authentication redirect
-  Infinite scroll with React Query + Intersection Observer
-  Responsive event cards with thumbnail, date, location
-  Loading states, empty states, error handling
-  Dark theme UI consistent with design system

### Full-Stack Integration Testing Framework
-  Docker-based test environment (PostgreSQL + LocalStack)
-  E2E tests with Playwright (authentication, gallery workflows)
-  API integration tests covering complete user journeys
-  Automated test data generation and cleanup
-  Performance and concurrency testing

### Technical Stack Validation
-  Next.js 15 + React Query + TypeScript frontend
-  NestJS + TypeORM + PostgreSQL backend
-  AWS S3/SQS integration (LocalStack for testing)
-  JWT authentication with secure token management
-  Complete data pipeline: Edge → Backend → Processing → Gallery

## Files Added/Modified

### Frontend Implementation
- src/app/gallery/page.tsx - Main gallery page with auth protection
- src/services/events.ts - API client for events with pagination
- src/hooks/use-events.ts - React Query hooks for infinite scroll
- src/components/gallery/ - Modular UI components (EventCard, GalleryGrid, States)
- src/contexts/query-provider.tsx - React Query configuration

### Testing Infrastructure
- docker-compose.test.yml - Complete test environment setup
- test-setup.sh - One-command test environment initialization
- test-data/seed-test-data.js - Automated test data generation
- e2e/gallery.spec.ts - Comprehensive E2E gallery tests
- test/integration.e2e-spec.ts - Full-stack workflow validation
- TESTING.md - Complete testing guide and documentation

### Project Configuration
- package.json (root) - Monorepo scripts and workspace management
- playwright.config.ts - E2E testing configuration
- .env.test - Test environment variables
- README.md - Project documentation

## Test Results 📊
-  Unit Tests: 10/10 passing (Frontend components)
-  Integration Tests: Full workflow validation
-  E2E Tests: Complete user journey coverage
-  Lint: No warnings or errors
-  Build: Production ready (11.7kB gallery page)

## Milestone: Epic 1 "First Light" Achieved 🚀

The complete data flow is now validated:
1. User Authentication 
2. Device Registration 
3. Event Upload Pipeline 
4. Background Processing 
5. Gallery Display 

This establishes the foundation for all future development.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-31 18:49:48 +08:00

90 lines
2.3 KiB
YAML

version: '3.8'
services:
# Test Database
test-postgres:
image: postgres:15
environment:
POSTGRES_DB: meteor_test
POSTGRES_USER: meteor_test
POSTGRES_PASSWORD: meteor_test_pass
ports:
- "5433:5432"
volumes:
- test_postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U meteor_test -d meteor_test"]
interval: 5s
timeout: 5s
retries: 5
# LocalStack for AWS services (S3, SQS)
localstack:
image: localstack/localstack:3.0
ports:
- "4566:4566"
- "4510-4559:4510-4559"
environment:
- SERVICES=s3,sqs
- DEBUG=1
- DOCKER_HOST=unix:///var/run/docker.sock
- LOCALSTACK_HOSTNAME=localhost
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "./test-data/localstack:/tmp/localstack"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:4566/_localstack/health"]
interval: 10s
timeout: 5s
retries: 3
# Backend for integration tests
test-backend:
build:
context: ./meteor-web-backend
dockerfile: Dockerfile
environment:
- NODE_ENV=test
- DATABASE_URL=postgresql://meteor_test:meteor_test_pass@test-postgres:5432/meteor_test
- JWT_SECRET=test-jwt-secret-key-for-integration-tests
- AWS_ENDPOINT_URL=http://localstack:4566
- AWS_ACCESS_KEY_ID=test
- AWS_SECRET_ACCESS_KEY=test
- AWS_REGION=us-east-1
- S3_BUCKET_NAME=meteor-test-bucket
- SQS_QUEUE_URL=http://localstack:4566/000000000000/meteor-processing-queue
- PORT=3000
ports:
- "3000:3000"
depends_on:
test-postgres:
condition: service_healthy
localstack:
condition: service_healthy
command: >
sh -c "
npm run migrate:up &&
npm run start:prod
"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/api/v1/events/health/check"]
interval: 10s
timeout: 5s
retries: 5
# Frontend for E2E tests
test-frontend:
build:
context: ./meteor-frontend
dockerfile: Dockerfile
environment:
- NEXT_PUBLIC_API_URL=http://test-backend:3000
- NODE_ENV=test
ports:
- "3001:3000"
depends_on:
test-backend:
condition: service_healthy
volumes:
test_postgres_data: