fix: update Playwright coverage configuration and base URL for consistency across scripts
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
22
.vscode/tasks.json
vendored
22
.vscode/tasks.json
vendored
@@ -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": {
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user