diff --git a/.github/skills/test-e2e-playwright-coverage-scripts/run.sh b/.github/skills/test-e2e-playwright-coverage-scripts/run.sh index 7ebca5b7..1910e7d8 100755 --- a/.github/skills/test-e2e-playwright-coverage-scripts/run.sh +++ b/.github/skills/test-e2e-playwright-coverage-scripts/run.sh @@ -238,6 +238,7 @@ main() { # IMPORTANT: Use Vite URL (3000) for coverage, not Docker (8080) export PLAYWRIGHT_HTML_OPEN="${PLAYWRIGHT_HTML_OPEN:-never}" export PLAYWRIGHT_SKIP_SECURITY_DEPS="${PLAYWRIGHT_SKIP_SECURITY_DEPS:-1}" + export PLAYWRIGHT_COVERAGE="1" export PLAYWRIGHT_BASE_URL="${PLAYWRIGHT_BASE_URL:-http://localhost:${VITE_PORT}}" # Log configuration diff --git a/.github/skills/test-e2e-playwright-debug-scripts/run.sh b/.github/skills/test-e2e-playwright-debug-scripts/run.sh index 5f9e5353..9e9941db 100755 --- a/.github/skills/test-e2e-playwright-debug-scripts/run.sh +++ b/.github/skills/test-e2e-playwright-debug-scripts/run.sh @@ -197,7 +197,7 @@ main() { export PLAYWRIGHT_SKIP_SECURITY_DEPS="${PLAYWRIGHT_SKIP_SECURITY_DEPS:-1}" # Debug runs should not start the Vite dev server by default export PLAYWRIGHT_COVERAGE="${PLAYWRIGHT_COVERAGE:-0}" - set_default_env "PLAYWRIGHT_BASE_URL" "http://localhost:8080" + set_default_env "PLAYWRIGHT_BASE_URL" "http://127.0.0.1:8080" # Enable Inspector if requested if [[ "${INSPECTOR}" == "true" ]]; then diff --git a/.github/skills/test-e2e-playwright-scripts/run.sh b/.github/skills/test-e2e-playwright-scripts/run.sh index b9d0364f..3d920410 100755 --- a/.github/skills/test-e2e-playwright-scripts/run.sh +++ b/.github/skills/test-e2e-playwright-scripts/run.sh @@ -150,7 +150,7 @@ main() { export PLAYWRIGHT_SKIP_SECURITY_DEPS="${PLAYWRIGHT_SKIP_SECURITY_DEPS:-1}" # Ensure non-coverage runs do NOT start the Vite dev server (use Docker in CI/local non-coverage) export PLAYWRIGHT_COVERAGE="${PLAYWRIGHT_COVERAGE:-0}" - set_default_env "PLAYWRIGHT_BASE_URL" "http://localhost:8080" + set_default_env "PLAYWRIGHT_BASE_URL" "http://127.0.0.1:8080" # Log configuration log_step "CONFIG" "Test configuration" diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 9e2dddbb..bb5ef60b 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -140,7 +140,7 @@ { "label": "Test: E2E Playwright (FireFox, Workers 1)", "type": "shell", - "command": "cd /projects/Charon && npx playwright test --project=firefox --workers=1", + "command": "cd /projects/Charon && PLAYWRIGHT_COVERAGE=0 PLAYWRIGHT_BASE_URL=http://127.0.0.1:8080 PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=firefox --workers=1", "group": "test", "problemMatcher": [], "presentation": { @@ -152,7 +152,7 @@ { "label": "Test: E2E Playwright (FireFox) - Cerberus: Real-Time Logs", "type": "shell", - "command": "cd /projects/Charon && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=firefox tests/monitoring/real-time-logs.spec.ts", + "command": "cd /projects/Charon && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_COVERAGE=0 PLAYWRIGHT_BASE_URL=http://127.0.0.1:8080 PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=firefox tests/monitoring/real-time-logs.spec.ts", "group": "test", "problemMatcher": [], "presentation": { @@ -164,7 +164,7 @@ { "label": "Test: E2E Playwright (FireFox) - Cerberus: Security Dashboard", "type": "shell", - "command": "cd /projects/Charon && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=security-tests tests/security/security-dashboard.spec.ts", + "command": "cd /projects/Charon && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_COVERAGE=0 PLAYWRIGHT_BASE_URL=http://127.0.0.1:8080 PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=security-tests tests/security/security-dashboard.spec.ts", "group": "test", "problemMatcher": [], "presentation": { @@ -176,7 +176,7 @@ { "label": "Test: E2E Playwright (FireFox) - Cerberus: Rate Limiting", "type": "shell", - "command": "cd /projects/Charon && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=security-tests tests/security/rate-limiting.spec.ts", + "command": "cd /projects/Charon && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_COVERAGE=0 PLAYWRIGHT_BASE_URL=http://127.0.0.1:8080 PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=security-tests tests/security/rate-limiting.spec.ts", "group": "test", "problemMatcher": [], "presentation": { @@ -195,7 +195,7 @@ { "label": "Test: E2E Playwright (FireFox) - Core: Access Lists", "type": "shell", - "command": "cd /projects/Charon && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=firefox tests/core/access-lists-crud.spec.ts", + "command": "cd /projects/Charon && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_COVERAGE=0 PLAYWRIGHT_BASE_URL=http://127.0.0.1:8080 PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=firefox tests/core/access-lists-crud.spec.ts", "group": "test", "problemMatcher": [], "presentation": { @@ -207,7 +207,7 @@ { "label": "Test: E2E Playwright (FireFox) - Core: Authentication", "type": "shell", - "command": "cd /projects/Charon && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=firefox tests/core/authentication.spec.ts", + "command": "cd /projects/Charon && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_COVERAGE=0 PLAYWRIGHT_BASE_URL=http://127.0.0.1:8080 PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=firefox tests/core/authentication.spec.ts", "group": "test", "problemMatcher": [], "presentation": { @@ -219,7 +219,7 @@ { "label": "Test: E2E Playwright (FireFox) - Core: Certificates", "type": "shell", - "command": "cd /projects/Charon && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=firefox tests/core/certificates.spec.ts", + "command": "cd /projects/Charon && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_COVERAGE=0 PLAYWRIGHT_BASE_URL=http://127.0.0.1:8080 PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=firefox tests/core/certificates.spec.ts", "group": "test", "problemMatcher": [], "presentation": { @@ -231,7 +231,7 @@ { "label": "Test: E2E Playwright (FireFox) - Core: Dashboard", "type": "shell", - "command": "cd /projects/Charon && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=firefox tests/core/dashboard.spec.ts", + "command": "cd /projects/Charon && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_COVERAGE=0 PLAYWRIGHT_BASE_URL=http://127.0.0.1:8080 PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=firefox tests/core/dashboard.spec.ts", "group": "test", "problemMatcher": [], "presentation": { @@ -243,7 +243,7 @@ { "label": "Test: E2E Playwright (FireFox) - Core: Navigation", "type": "shell", - "command": "cd /projects/Charon && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=firefox tests/core/navigation.spec.ts", + "command": "cd /projects/Charon && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_COVERAGE=0 PLAYWRIGHT_BASE_URL=http://127.0.0.1:8080 PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=firefox tests/core/navigation.spec.ts", "group": "test", "problemMatcher": [], "presentation": { @@ -255,7 +255,7 @@ { "label": "Test: E2E Playwright (FireFox) - Core: Navigation Shard", "type": "shell", - "command": "cd /projects/Charon && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=firefox --shard=1/1 tests/core/navigation.spec.ts", + "command": "cd /projects/Charon && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_COVERAGE=0 PLAYWRIGHT_BASE_URL=http://127.0.0.1:8080 PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=firefox --shard=1/1 tests/core/navigation.spec.ts", "group": "test", "problemMatcher": [], "presentation": { @@ -628,7 +628,7 @@ { "label": "Test: E2E Playwright (Targeted Suite)", "type": "shell", - "command": "cd /projects/Charon && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=firefox ${input:playwrightSuitePath}", + "command": "cd /projects/Charon && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_COVERAGE=0 PLAYWRIGHT_BASE_URL=http://127.0.0.1:8080 PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=firefox ${input:playwrightSuitePath}", "group": "test", "problemMatcher": [], "presentation": { diff --git a/package.json b/package.json index 7ccb28f7..e6d21ebf 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "type": "module", "scripts": { - "e2e": "PLAYWRIGHT_HTML_OPEN=never npx playwright test --project=firefox", - "e2e:all": "PLAYWRIGHT_HTML_OPEN=never npx playwright test", - "e2e:headed": "npx playwright test --project=firefox --headed", + "e2e": "PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_COVERAGE=0 PLAYWRIGHT_BASE_URL=http://127.0.0.1:8080 PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=firefox", + "e2e:all": "PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_COVERAGE=0 PLAYWRIGHT_BASE_URL=http://127.0.0.1:8080 PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test", + "e2e:headed": "PLAYWRIGHT_COVERAGE=0 PLAYWRIGHT_BASE_URL=http://127.0.0.1:8080 PLAYWRIGHT_SKIP_SECURITY_DEPS=1 npx playwright test --project=firefox --headed", "e2e:ui:headless-server": "bash ./scripts/run-e2e-ui.sh", "e2e:report": "npx playwright show-report", "lint:md": "markdownlint-cli2 '**/*.md' --ignore node_modules --ignore .venv --ignore test-results --ignore codeql-db --ignore codeql-agent-results", diff --git a/playwright.config.js b/playwright.config.js index a633e5b8..c5a7cbc9 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -23,9 +23,9 @@ const STORAGE_STATE = join(__dirname, 'playwright/.auth/user.json'); /** * Coverage reporter configuration for E2E tests - * Enabled by default, disable with PLAYWRIGHT_COVERAGE=0 + * Disabled by default; enable with PLAYWRIGHT_COVERAGE=1. */ -const enableCoverage = process.env.PLAYWRIGHT_COVERAGE !== '0'; +const enableCoverage = process.env.PLAYWRIGHT_COVERAGE === '1'; const resolvedBaseURL = process.env.PLAYWRIGHT_BASE_URL || (enableCoverage ? 'http://localhost:5173' : 'http://127.0.0.1:8080'); if (!process.env.PLAYWRIGHT_BASE_URL) { process.env.PLAYWRIGHT_BASE_URL = resolvedBaseURL;