# Browser Alignment Diagnostic Report **Date:** February 2, 2026 **Mission:** Comprehensive E2E test analysis across Chromium, Firefox, and WebKit **Environment:** Local Docker E2E container (charon-e2e) **Base URL:** http://localhost:8080 --- ## Executive Summary **๐Ÿ”ด CRITICAL FINDING: Firefox and WebKit tests did not execute** Out of 2,620 total tests across all browser projects: - **Chromium:** 263 tests executed (234 passed, 2 interrupted, 27 skipped) - **Firefox:** 0 tests executed (873 tests queued but never started) - **WebKit:** 0 tests executed (873 tests queued but never started) - **Skipped/Not Run:** 2,357 tests total This represents a **90% test execution failure** for non-Chromium browsers, explaining CI discrepancies between local and GitHub Actions results. --- ## Detailed Findings ### 1. Playwright E2E Test Results #### Environment Validation โœ… **E2E Container Status:** Healthy โœ… **Port Accessibility:** - Application (8080): โœ“ Accessible - Emergency API (2020): โœ“ Healthy - Caddy Admin (2019): โœ“ Healthy โœ… **Emergency Token:** Validated (64 chars, valid hexadecimal) โœ… **Authentication State:** Setup completed successfully โœ… **Global Setup:** Orphaned data cleanup completed #### Chromium Test Results (Desktop Chrome) **Project:** chromium **Status:** Partially completed (interrupted) **Tests Run:** 263 total - โœ… **Passed:** 234 tests (6.3 minutes) - โš ๏ธ **Interrupted:** 2 tests - `tests/core/certificates.spec.ts:788` - Form Accessibility โ€บ keyboard navigation - `tests/core/certificates.spec.ts:807` - Form Accessibility โ€บ Escape key handling - โญ๏ธ **Skipped:** 27 tests - โŒ **Did Not Run:** 2,357 tests (remaining from Firefox/WebKit projects) **Interrupted Test Details:** ``` Error: browserContext.close: Target page, context or browser has been closed Error: page.waitForTimeout: Test ended ``` **Sample Passed Tests:** - Security Dashboard (all ACL, WAF, Rate Limiting, CrowdSec tests) - Security Headers Configuration (12/12 tests) - WAF Configuration (16/16 tests) - ACL Enforcement (security-tests project) - Emergency Token Break Glass Protocol (8/8 tests) - Access Lists CRUD Operations (53/53 tests visible) - SSL Certificates CRUD Operations (partial) - Audit Logs (16/16 tests) **Coverage Collection:** Enabled (`@bgotink/playwright-coverage`) #### Firefox Test Results (Desktop Firefox) **Project:** firefox **Status:** โŒ **NEVER STARTED** **Tests Expected:** ~873 tests (estimated based on chromium ร— 3 browsers) **Tests Run:** 0 **Dependency Chain:** setup โ†’ security-tests โ†’ security-teardown โ†’ firefox **Observation:** When explicitly running Firefox project tests: ```bash playwright test --project=setup --project=security-tests --project=security-teardown --project=firefox ``` Result: Tests BEGIN execution (982 tests queued, 2 workers allocated), but in the full test suite run, Firefox tests are marked as "did not run." **Hypothesis:** Possible causes: 1. **Timeout During Chromium Tests:** Chromium tests take 6.3 minutes; if the overall test run times out before reaching Firefox, subsequent browser projects never execute. 2. **Interrupted Dependency:** If `security-teardown` or `chromium` project encounters a critical error, dependent projects (firefox, webkit) may be skipped. 3. **CI vs Local Configuration Mismatch:** Different timeout settings or resource constraints in GitHub Actions may cause earlier interruption. #### WebKit Test Results (Desktop Safari) **Project:** webkit **Status:** โŒ **NEVER STARTED** **Tests Expected:** ~873 tests **Tests Run:** 0 **Dependency Chain:** setup โ†’ security-tests โ†’ security-teardown โ†’ webkit **Same behavior as Firefox:** Tests are queued but never executed in the full suite. --- ### 2. Backend Test Coverage **Script:** `./scripts/go-test-coverage.sh` **Status:** โœ… Completed successfully **Coverage Metrics:** - **Overall Coverage:** 84.9% - **Required Threshold:** 85.0% - **Gap:** -0.1% (BELOW THRESHOLD โš ๏ธ) **Sample Package Coverage:** - `pkg/dnsprovider/custom`: 97.5% โœ… - Various modules: Range from 70%-99% **Filtered Packages:** Excluded packages (vendor, mocks) removed from report **Recommendation:** Add targeted unit tests to increase coverage by 0.1%+ to meet threshold. --- ### 3. Frontend Test Coverage **Script:** `npm test -- --run --coverage` (Vitest) **Status:** โœ… Completed successfully **Coverage Metrics:** - **Overall Coverage:** 84.22% (statements) - **Branch Coverage:** 77.39% - **Function Coverage:** 79.29% - **Line Coverage:** 84.81% **Module Breakdown:** - `src/api`: 88.45% โœ… - `src/components`: 88.77% โœ… - `src/hooks`: 99.52% โœ… (excellent) - `src/pages`: 82.59% โš ๏ธ (needs attention) - `Security.tsx`: 65.17% โŒ (lowest) - `SecurityHeaders.tsx`: 69.23% โš ๏ธ - `Plugins.tsx`: 63.63% โŒ - `src/utils`: 96.49% โœ… **Localization Files:** 0% (expected - JSON translation files not covered by tests) **Recommendation:** Focus on increasing coverage for `Security.tsx`, `SecurityHeaders.tsx`, and `Plugins.tsx` pages. --- ## Browser-Specific Discrepancies ### Chromium (Passing Locally) โœ… **234 tests passed** in 6.3 minutes โœ… Authentication working โœ… Security module toggles functional โœ… CRUD operations successful โš ๏ธ 2 tests interrupted (likely resource/timing issues) ### Firefox (Not Running Locally) โŒ **0 tests executed** in full suite โœ… **Tests DO start** when run in isolation with explicit project flags โ“ **Root Cause:** Unknown - requires further investigation **Potential Causes:** 1. **Sequential Execution Issue:** Playwright project dependencies may not be triggering Firefox execution after Chromium completes/interrupts. 2. **Resource Exhaustion:** Docker container may run out of memory/CPU during Chromium tests, preventing Firefox from starting. 3. **Configuration Mismatch:** playwright.config.js may have an issue with project dependency resolution. 4. **Workers Setting:** `workers: process.env.CI ? 1 : undefined` - local environment may be allocating workers differently. ### WebKit (Not Running Locally) โŒ **0 tests executed** (same as Firefox) โ“ **Root Cause:** Same as Firefox - likely dependency chain issue --- ## Key Differences: Local vs CI | Aspect | Local Behavior | Expected CI Behavior | |--------|----------------|----------------------| | **Chromium Tests** | โœ… 234 passed, 2 interrupted | โ“ Unknown (CI outage) | | **Firefox Tests** | โŒ Never executed | โ“ Unknown (CI outage) | | **WebKit Tests** | โŒ Never executed | โ“ Unknown (CI outage) | | **Test Workers** | `undefined` (auto) | `1` (sequential) | | **Retries** | 0 | 2 | | **Execution Mode** | Parallel per project | Sequential (1 worker) | | **Total Runtime** | 6.3 min (Chromium only) | Unknown | **Hypothesis:** In CI, Playwright may: 1. Enforce stricter dependency execution (all projects must run sequentially) 2. Have longer timeouts allowing Firefox/WebKit to eventually execute 3. Allocate resources differently (1 worker forces sequential execution) --- ## Test Execution Flow Analysis ### Configured Project Dependencies ``` setup (auth) โ†“ security-tests (sequential, 1 worker, headless chromium) โ†“ security-teardown (cleanup) โ†“ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ chromium โ”‚ firefox โ”‚ webkit โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ ``` ### Actual Execution (Local) ``` setup โœ… โ†“ security-tests โœ… (completed) โ†“ security-teardown โœ… โ†“ chromium โš ๏ธ (started, 234 passed, 2 interrupted) โ†“ firefox โŒ (queued but never started) โ†“ webkit โŒ (queued but never started) ``` **Critical Observation:** The interruption in Chromium tests at test #263 (certificates accessibility tests) may be the trigger that prevents Firefox/WebKit from executing. The error `Target page, context or browser has been closed` suggests resource cleanup or allocation issues. --- ## Raw Test Output Excerpts ### Chromium - Successful Tests ``` [chromium] โ€บ tests/security/audit-logs.spec.ts:26:5 โ€บ Audit Logs โ€บ Page Loading โœ“ 26/982 passed (2.9s) [chromium] โ€บ tests/security/crowdsec-config.spec.ts:26:5 โ€บ CrowdSec Configuration โœ“ 24-29 passed [chromium] โ€บ tests/security-enforcement/acl-enforcement.spec.ts:114:3 โœ… Admin whitelist configured for test IP ranges โœ“ Cerberus enabled โœ“ ACL enabled โœ“ 123-127 passed [chromium] โ€บ tests/security-enforcement/emergency-token.spec.ts:198:3 ๐Ÿงช Testing emergency token bypass with ACL enabled... โœ“ Confirmed ACL is enabled โœ“ Emergency token successfully accessed protected endpoint โœ… Test 1 passed: Emergency token bypasses ACL โœ“ 141-148 passed ``` ### Chromium - Interrupted Tests ``` [chromium] โ€บ tests/core/certificates.spec.ts:788:5 Error: browserContext.close: Target page, context or browser has been closed [chromium] โ€บ tests/core/certificates.spec.ts:807:5 Error: page.waitForTimeout: Test ended. ``` ### Firefox - Isolation Run (Successful Start) ``` Running 982 tests using 2 workers [setup] โ€บ tests/auth.setup.ts:26:1 โ€บ authenticate โœ… [security-tests] โ€บ tests/security/audit-logs.spec.ts:26:5 โœ… [security-tests] โ€บ tests/security/audit-logs.spec.ts:47:5 โœ… ... [Tests continuing in security-tests project for Firefox] ``` --- ## Coverage Data Summary | Layer | Coverage | Threshold | Status | |-------|----------|-----------|--------| | **Backend** | 84.9% | 85.0% | โš ๏ธ Below (-0.1%) | | **Frontend** | 84.22% | N/A | โœ… Acceptable | | **E2E (Chromium)** | Collected | N/A | โœ… V8 coverage enabled | --- ## Recommendations ### Immediate Actions (Priority: CRITICAL) 1. **Investigate Chromium Test Interruption** - Analyze why `certificates.spec.ts` tests are interrupted - Check for resource leaks or memory issues in test cleanup - Review `page.waitForTimeout(500)` usage (anti-pattern - use auto-waiting) 2. **Fix Project Dependency Execution** - Verify `playwright.config.js` project dependencies are correctly configured - Test if removing `fullyParallel: true` (line 115) affects execution - Consider adding explicit timeout settings for long-running test suites 3. **Enable Verbose Logging for Debugging** ```bash DEBUG=pw:api npx playwright test --reporter=line ``` Capture full execution flow to identify why Firefox/WebKit projects are skipped. 4. **Reproduce CI Behavior Locally** ```bash CI=1 npx playwright test --workers=1 --retries=2 ``` Force sequential execution with retries to match CI configuration. ### Short-Term Actions (Priority: HIGH) 5. **Isolate Browser Test Runs** - Run each browser project independently to confirm functionality: ```bash npx playwright test --project=setup --project=security-tests --project=chromium npx playwright test --project=setup --project=security-tests --project=firefox npx playwright test --project=setup --project=security-tests --project=webkit ``` - Compare results to identify browser-specific failures. 6. **Increase Backend Coverage by 0.1%** - Target packages with coverage gaps (see Backend section) - Add unit tests for uncovered edge cases 7. **Improve Frontend Page Coverage** - `Security.tsx`: 65.17% โ†’ Target 80%+ - `SecurityHeaders.tsx`: 69.23% โ†’ Target 80%+ - `Plugins.tsx`: 63.63% โ†’ Target 80%+ ### Long-Term Actions (Priority: MEDIUM) 8. **Refactor Test Dependencies** - Evaluate if security-tests MUST run before all browser tests - Consider running security-tests only once, store state, and restore for each browser 9. **Implement Test Sharding** - Split tests into multiple shards to reduce runtime - Run browser projects in parallel across different CI jobs 10. **Monitor Test Stability** - Track test interruptions and flaky tests - Implement retry logic for known-flaky tests - Add test stability metrics to CI --- ## Triage Plan ### Phase 1: Root Cause Analysis (Day 1) - [ ] Run Chromium tests in isolation with verbose logging - [ ] Identify exact cause of `certificates.spec.ts` interruption - [ ] Fix resource leak or timeout issues ### Phase 2: Browser Execution Fix (Day 2) - [ ] Verify Firefox/WebKit projects can run independently - [ ] Investigate project dependency resolution in Playwright - [ ] Apply configuration fixes to enable sequential browser execution ### Phase 3: CI Alignment (Day 3) - [ ] Reproduce CI environment locally (`CI=1`, `workers=1`, `retries=2`) - [ ] Compare test results between local and CI configurations - [ ] Document any remaining discrepancies ### Phase 4: Coverage Improvements (Day 4-5) - [ ] Add backend unit tests to reach 85% threshold - [ ] Add frontend tests for low-coverage pages - [ ] Verify E2E coverage collection is working correctly --- ## Appendix: Test Execution Commands ### Full Suite (As Executed) ```bash # E2E container rebuild /projects/Charon/.github/skills/scripts/skill-runner.sh docker-rebuild-e2e # Full Playwright suite (all browsers) npx playwright test ``` ### Individual Browser Tests ```bash # Chromium only npx playwright test --project=setup --project=security-tests --project=security-teardown --project=chromium # Firefox only npx playwright test --project=setup --project=security-tests --project=security-teardown --project=firefox # WebKit only npx playwright test --project=setup --project=security-tests --project=security-teardown --project=webkit ``` ### Backend Coverage ```bash ./scripts/go-test-coverage.sh ``` ### Frontend Coverage ```bash cd frontend && npm test -- --run --coverage ``` --- ## Related Documentation - [Testing Instructions](.github/instructions/testing.instructions.md) - [Playwright TypeScript Instructions](.github/instructions/playwright-typescript.instructions.md) - [Playwright Config](playwright.config.js) - [E2E Rebuild Skill](.github/skills/docker-rebuild-e2e.SKILL.md) --- **Report Generated By:** GitHub Copilot (QA Security Mode) **Total Diagnostic Time:** ~25 minutes **Next Update:** After Phase 1 completion