mirror of
https://github.com/bitbaum/evig.git
synced 2026-12-04 15:58:09 +01:00
The E2E personas are real accounts on a real deployment, and every place that needed one carried it as a literal in a public repo: a fallback in scripts/e2e-inventory-prod.sh, four `|| '...'` defaults across the e2e specs and their auth helper, a workflow header comment, and two docs tables. The repo therefore published whose accounts they are — and the defaults were dead weight besides: CI has supplied both addresses from the repository secrets of the same name since they were created, so the literals were an unreachable branch that only ever leaked. Now there is no default anywhere. The addresses come from AUTH_TEST_USER_EMAIL and AUTH_TEST_ADMIN_EMAIL, both existing repo secrets, and the absence of one is an error rather than a quiet substitution: - scripts/e2e-inventory-prod.sh requires both with `:?` naming the secret. The "no passwords configured, skip" path still runs first, so an unconfigured checkout is unaffected. - The two consuming jobs guard first and fail with `::error::` naming the missing secret, instead of dying inside bash or playwright. - The specs skip a persona when its address is unset, the same way they already skip on a missing password, rather than attempting a login with an empty e-mail and reporting it as a broken page. Unchanged: the e2e-local job, which sets all four addresses to its own seeded @evig.test fixtures at job level, so the defaults were never reached there either. Not addressed here, and still in the tree: the owner's address in the SUPER_ADMIN_EMAILS allowlist (plus its assertions and the applied SQL migrations that reference it), and the public contact address in src/config/org.ts, which is published on purpose. Those are identity and data, not E2E credentials, and removing them is a separate decision. Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2 Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
56 lines
2.4 KiB
Bash
Executable File
56 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Dual-persona feature inventory against production (or PLAYWRIGHT_BASE_URL).
|
|
#
|
|
# Requires AUTH_TEST_USER_PASSWORD and AUTH_TEST_ADMIN_PASSWORD, plus
|
|
# AUTH_TEST_USER_EMAIL and AUTH_TEST_ADMIN_EMAIL for the two personas.
|
|
# Optional: PLAYWRIGHT_BASE_URL.
|
|
#
|
|
# Used by GitHub Actions post-deploy and manual: npm run test:e2e:inventory:prod
|
|
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "$ROOT"
|
|
|
|
BASE_URL="${PLAYWRIGHT_BASE_URL:-https://evig.orangecat.ch}"
|
|
|
|
if [ -z "${AUTH_TEST_USER_PASSWORD:-}" ] || [ -z "${AUTH_TEST_ADMIN_PASSWORD:-}" ]; then
|
|
echo "AUTH_TEST_USER_PASSWORD and AUTH_TEST_ADMIN_PASSWORD not set — skipping inventory smoke."
|
|
exit 0
|
|
fi
|
|
|
|
echo "=== wait for ${BASE_URL}/api/health ==="
|
|
ready=0
|
|
for _ in 1 2 3 4 5 6; do
|
|
if curl -sf --max-time 15 "${BASE_URL}/api/health" >/dev/null; then
|
|
ready=1
|
|
break
|
|
fi
|
|
sleep 10
|
|
done
|
|
if [ "$ready" -ne 1 ]; then
|
|
echo "ERROR: ${BASE_URL}/api/health did not become ready"
|
|
exit 1
|
|
fi
|
|
|
|
export PLAYWRIGHT_BASE_URL="$BASE_URL"
|
|
# Neither persona address has a default. Both are real accounts on the target
|
|
# deployment, so a baked-in default would do two bad things at once: publish a
|
|
# person's address in a public repo, and silently drive this suite as whoever
|
|
# that is when the variable is missing. In CI both come from the repository
|
|
# secrets of the same name; locally, export them yourself. Prefer a staging
|
|
# PLAYWRIGHT_BASE_URL — the journeys beyond the read-only inventory mutate data.
|
|
export AUTH_TEST_USER_EMAIL="${AUTH_TEST_USER_EMAIL:?set AUTH_TEST_USER_EMAIL (repo secret AUTH_TEST_USER_EMAIL) to the non-admin E2E account}"
|
|
export AUTH_TEST_ADMIN_EMAIL="${AUTH_TEST_ADMIN_EMAIL:?set AUTH_TEST_ADMIN_EMAIL (repo secret AUTH_TEST_ADMIN_EMAIL) to the staff/admin E2E account}"
|
|
|
|
echo "=== dual-persona inventory smoke → ${BASE_URL} ==="
|
|
pnpm exec playwright test tests/e2e/feature-inventory.spec.ts --project=chromium --reporter=line
|
|
|
|
# The MUTATING journey specs (it-hilfe, marketplace checkout, workshops,
|
|
# service appointments, timecards, intake, tasks, protocols, decisions, cms,
|
|
# hr) no longer run against production from here: they create/submit/approve
|
|
# real rows and depend on fixture accounts/data prod doesn't have (the
|
|
# service-appointment journey needs the user persona to BE a technician).
|
|
# They run against the seeded ephemeral environment in CI (e2e-local job)
|
|
# instead. Production keeps the read-only dual-persona route inventory above.
|