#!/usr/bin/env bash # Staging acceptance test (Phase 4 §23/§18) — the four things a human needs before promoting a # build: app deploys, migrations ran clean, the Gateway/Platform API/Provisioner are reachable, # and (if OWNER_EMAIL/OWNER_PASSWORD are provided) a real assessment can be started end to end. # Reuses platform/test/e2e-phase3b.js against the staging Gateway URL rather than re-inventing # a parallel smoke-test harness — that suite already IS the full acceptance chain. set -euo pipefail STAGING_URL="${STAGING_GATEWAY_URL:?set STAGING_GATEWAY_URL, e.g. https://staging.academy.example.com}" echo "==> Health checks" curl -sf "$STAGING_URL/healthz" > /dev/null && echo "OK: Gateway /healthz" if [ -n "${OWNER_EMAIL:-}" ] && [ -n "${OWNER_PASSWORD:-}" ]; then echo "==> Full acceptance run (platform/test/e2e-phase3b.js against staging)" cd "$(dirname "$0")/../../platform" GATEWAY_URL="$STAGING_URL" OWNER_EMAIL="$OWNER_EMAIL" OWNER_PASSWORD="$OWNER_PASSWORD" \ SKIP_RESTART_TEST=1 node test/e2e-phase3b.js else echo "==> Skipping full e2e run — set OWNER_EMAIL/OWNER_PASSWORD for a real classroom-workflow" echo " smoke test (bootstrap one first against staging: platform/api/bootstrap-owner.js)." fi echo "OK: staging smoke test passed"