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.
82 lines
1.9 KiB
TypeScript
82 lines
1.9 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
/**
|
|
* Playwright configuration for Pulse update integration tests
|
|
* See https://playwright.dev/docs/test-configuration
|
|
*/
|
|
export default defineConfig({
|
|
testDir: './tests',
|
|
|
|
/* Run tests in files in parallel */
|
|
fullyParallel: false, // Update tests should run sequentially
|
|
|
|
/* Fail the build on CI if you accidentally left test.only in the source code */
|
|
forbidOnly: !!process.env.CI,
|
|
|
|
/* Retry on CI only */
|
|
retries: process.env.CI ? 2 : 0,
|
|
|
|
/* Opt out of parallel tests on CI */
|
|
workers: 1, // Update tests modify global state
|
|
|
|
/* Reporter to use */
|
|
reporter: [
|
|
['html', { outputFolder: 'playwright-report' }],
|
|
['list'],
|
|
['junit', { outputFile: 'test-results/junit.xml' }]
|
|
],
|
|
|
|
/* Shared test timeout */
|
|
timeout: 60000, // Updates can take time
|
|
expect: {
|
|
timeout: 10000,
|
|
},
|
|
|
|
/* Shared settings for all projects */
|
|
use: {
|
|
/* Base URL for all tests */
|
|
baseURL: 'http://localhost:7655',
|
|
|
|
/* Collect trace when retrying the failed test */
|
|
trace: 'on-first-retry',
|
|
|
|
/* Screenshot on failure */
|
|
screenshot: 'only-on-failure',
|
|
|
|
/* Video on failure */
|
|
video: 'retain-on-failure',
|
|
|
|
/* Default navigation timeout */
|
|
navigationTimeout: 15000,
|
|
|
|
/* Default action timeout */
|
|
actionTimeout: 10000,
|
|
},
|
|
|
|
/* Configure projects for different browsers */
|
|
projects: [
|
|
{
|
|
name: 'chromium',
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
// Use headless mode in CI
|
|
headless: !!process.env.CI,
|
|
},
|
|
},
|
|
|
|
// Uncomment to test on Firefox and WebKit
|
|
// {
|
|
// name: 'firefox',
|
|
// use: { ...devices['Desktop Firefox'] },
|
|
// },
|
|
// {
|
|
// name: 'webkit',
|
|
// use: { ...devices['Desktop Safari'] },
|
|
// },
|
|
],
|
|
|
|
/* Run local dev server before starting the tests */
|
|
// We use docker-compose instead, managed via npm scripts
|
|
webServer: undefined,
|
|
});
|