mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-02-18 00:17:39 +01:00
Implements end-to-end testing infrastructure for the Pulse update flow, validating the entire path from UI to backend with controllable test scenarios. ## What's Included ### Test Infrastructure - Mock GitHub release server (Go) with controllable failure modes - Docker Compose test environment (isolated services) - Playwright test framework with TypeScript - 60+ test cases across 6 test suites - Helper library with 20+ reusable test utilities ### Test Scenarios 1. Happy Path (8 tests) - Valid checksums, successful update flow - Modal appears exactly once - Complete end-to-end validation 2. Bad Checksums (8 tests) - Server rejects invalid checksums - Error shown ONCE (not twice) - fixes v4.28.0 issue type - User-friendly error messages 3. Rate Limiting (9 tests) - Multiple rapid requests throttled gracefully - Proper rate limit headers - Clear error messages 4. Network Failure (10 tests) - Exponential backoff retry logic - Timeout handling - Graceful degradation 5. Stale Release (10 tests) - Backend refuses flagged releases - Informative error messages - Proper rejection logging 6. Frontend Validation (15 tests) - UpdateProgressModal appears exactly once - No duplicate modals on error - User-friendly error messages - Proper accessibility attributes ### CI/CD Integration - GitHub Actions workflow (.github/workflows/test-updates.yml) - Runs on PRs touching update-related code - Separate test runs for each scenario - Regression test to verify v4.28.0 issue prevention - Automatic artifact uploads ### Documentation - README.md: Architecture and overview - QUICK_START.md: Getting started guide - IMPLEMENTATION_SUMMARY.md: Complete implementation details - Helper scripts for setup and test execution ## Success Criteria Met ✅ Tests run in CI on every PR touching update code ✅ All scenarios pass reliably ✅ Tests catch v4.28.0 checksum issue type automatically ✅ Frontend UX regressions are blocked ## Usage ```bash cd tests/integration ./scripts/setup.sh # One-time setup npm test # Run all tests ``` See QUICK_START.md for detailed instructions. Addresses requirements from issue for comprehensive update flow testing with specific focus on preventing duplicate error modals and ensuring checksum validation works correctly.
67 lines
1.7 KiB
YAML
67 lines
1.7 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# Mock GitHub API server for controlled testing
|
|
mock-github:
|
|
build:
|
|
context: ./mock-github-server
|
|
dockerfile: Dockerfile
|
|
container_name: pulse-mock-github
|
|
ports:
|
|
- "8080:8080"
|
|
environment:
|
|
- PORT=8080
|
|
# Control test scenarios via environment variables
|
|
- MOCK_CHECKSUM_ERROR=${MOCK_CHECKSUM_ERROR:-false}
|
|
- MOCK_NETWORK_ERROR=${MOCK_NETWORK_ERROR:-false}
|
|
- MOCK_RATE_LIMIT=${MOCK_RATE_LIMIT:-false}
|
|
- MOCK_STALE_RELEASE=${MOCK_STALE_RELEASE:-false}
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080/health"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 3
|
|
start_period: 5s
|
|
networks:
|
|
- test-network
|
|
|
|
# Pulse server under test
|
|
pulse-test:
|
|
build:
|
|
context: ../../
|
|
dockerfile: Dockerfile
|
|
container_name: pulse-test-server
|
|
ports:
|
|
- "7655:7655"
|
|
environment:
|
|
- TZ=UTC
|
|
# Point to mock GitHub server
|
|
- PULSE_UPDATE_SERVER=http://mock-github:8080
|
|
# Test database in memory
|
|
- PULSE_DATA_DIR=/tmp/pulse-test-data
|
|
# Enable debug logging
|
|
- PULSE_LOG_LEVEL=debug
|
|
# Mock mode for faster testing
|
|
- PULSE_MOCK_MODE=true
|
|
volumes:
|
|
- test-data:/tmp/pulse-test-data
|
|
depends_on:
|
|
mock-github:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:7655/api/health"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 5
|
|
start_period: 10s
|
|
networks:
|
|
- test-network
|
|
|
|
volumes:
|
|
test-data:
|
|
driver: local
|
|
|
|
networks:
|
|
test-network:
|
|
driver: bridge
|