Files
Pulse/tests/integration
Claude 2afdca4d30 Add comprehensive integration test suite for update flow
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.
2025-11-11 09:31:52 +00:00
..

Update Integration Tests

End-to-end tests for the Pulse update flow, validating the entire path from UI to backend.

Architecture

┌─────────────────┐     ┌──────────────────┐     ┌─────────────────────┐
│  Playwright     │────▶│  Pulse Server    │────▶│  Mock GitHub API    │
│  (Browser UI)   │     │  (Test Instance) │     │  (Controlled        │
│                 │     │                  │     │   Responses)        │
└─────────────────┘     └──────────────────┘     └─────────────────────┘

Test Scenarios

  1. Happy Path: Valid checksums, successful update
  2. Bad Checksums: Server rejects update, UI shows error once (not twice)
  3. Rate Limiting: Multiple rapid requests are throttled gracefully
  4. Network Failure: UI retries with exponential backoff
  5. Stale Release: Backend refuses to install flagged releases

Frontend Validation

  • UpdateProgressModal appears exactly once
  • Error messages are user-friendly (not raw API errors)
  • Modal can be dismissed after error
  • No duplicate modals on error

Running Tests

Local Development

# Start test environment
cd tests/integration
docker-compose up -d

# Run tests
npm test

# View logs
docker-compose logs -f pulse-test
docker-compose logs -f mock-github

# Cleanup
docker-compose down -v

CI Pipeline

Tests run automatically on every PR touching update code via .github/workflows/test-updates.yml

Test Data

The mock GitHub server (mock-github-server/) provides controllable responses:

  • /api/releases - List all releases
  • /api/releases/latest - Latest stable release
  • /download/{version}/pulse-{version}-linux-amd64.tar.gz - Release tarballs
  • /download/{version}/checksums.txt - Checksum files

Response behavior can be controlled via environment variables:

  • MOCK_CHECKSUM_ERROR=true - Return invalid checksums
  • MOCK_NETWORK_ERROR=true - Simulate network failures
  • MOCK_RATE_LIMIT=true - Enable aggressive rate limiting
  • MOCK_STALE_RELEASE=true - Mark releases as stale

Success Criteria

  • Tests run in CI on every PR touching update code
  • All scenarios pass reliably
  • Tests catch checksum validation issues automatically
  • Frontend UX regressions are blocked