Overview
World Monitor includes three test suites:- E2E Tests — Playwright tests for full user flows across variants
- API Tests — Node.js tests for serverless functions and handlers
- Visual Regression — Screenshot comparison for map layers
E2E Tests (Playwright)
Run All Tests
Run the complete E2E suite across all variants:- Runtime fetch tests (variant-agnostic API checks)
- Full variant tests
- Tech variant tests
- Finance variant tests
Run Tests by Variant
Test Configuration
Test Files
Example Test: Runtime Fetch
Run Specific Test
-g flag matches test names via regex.
Debug Mode
Headed Mode
Visual Regression Tests
Golden Screenshot Tests
Map layer rendering is validated using golden screenshots:Run Visual Tests
Update Golden Screenshots
When map rendering changes intentionally:e2e/map-harness.spec.ts-snapshots/.
API Tests (Node.js)
Run API Tests
--test flag:
Test Files
Data Validation Tests
tests/ using tsx --test:
RSS Feed Validation
Regression Testing
Map Overlay Behavior
From the README:Map overlay behavior is validated in Playwright using the map harness (These tests ensure:/tests/map-harness.html).
- Cluster-state cache initialization guard:
updates protest marker click payload after data refreshinitializes cluster movement cache on first protest cluster render- Run by variant:
npm run test:e2e:full -- -g "updates protest marker click payload after data refresh|initializes cluster movement cache on first protest cluster render"npm run test:e2e:tech -- -g "updates protest marker click payload after data refresh|initializes cluster movement cache on first protest cluster render"
- Cluster cache initialization — Supercluster state is cached on first render
- Click payload accuracy — Marker click handlers receive up-to-date data after refresh
Run Regression Tests
Continuous Integration
GitHub Actions
Test Coverage
Covered Areas
- API endpoint responses (20+ services)
- Map layer rendering (40+ layers)
- Circuit breaker persistence
- Keyword spike detection
- Theme switching (dark/light)
- Mobile map interactions
- Investment panel (Finance variant)
- CORS policy
- RSS feed parsing
- GeoJSON data validation
Not Covered
- WebSocket connections (AIS relay)
- Desktop OS keychain integration
- Ollama/LM Studio auto-discovery
- Service worker updates
- IndexedDB snapshot storage
Best Practices
Tests run serially (
workers: 1) to avoid race conditions in shared state (service worker, localStorage).Debugging Failed Tests
View Trace Files
test-results/.
View Screenshots
Failed tests save screenshots totest-results/:
View Video Recordings
Videos are saved for failed tests whenvideo: 'retain-on-failure' is set:
Next Steps
Deployment
Deploy to production
Contributing
Contribute to World Monitor