pediatric-ai-scribe-v3/scripts/e2e.sh
Daniel abdbaa3507 feat: A1+A2 — Playwright smoke suite + index.html mtime-based caching
Safety net for upcoming refactors:
- 26 Playwright smoke tests via @playwright/test 1.50.0 in an official
  Playwright container (no host Node needed). Covers every Bedside sub-pill,
  the age→weight estimator, dose calculators (seizure/sepsis/anaphylaxis/
  burns/airway), and interactive widgets (lightbox, vent SVG).
- `npm run e2e` wrapper runs tests inside mcr.microsoft.com/playwright:v1.50.0-noble
  on the ped-ai_default Docker network so no host port mapping is needed.
- public/e2e-harness.html + public/js/e2e-bootstrap.js load the calculators
  component without the SPA auth wall (scripts external to satisfy CSP).

Server:
- server.js now re-reads public/index.html on mtime change instead of
  caching at boot. Fixes the "edit HTML, restart container" friction.
- CSP upgradeInsecureRequests disabled in helmet config; Caddy still
  enforces HTTPS at the reverse-proxy layer in production.
2026-04-20 03:51:22 +02:00

22 lines
748 B
Bash
Executable file

#!/usr/bin/env bash
# Runs Playwright smoke tests inside the official Playwright container against
# the running PedScribe app. Usage: npm run e2e (or ./scripts/e2e.sh)
set -euo pipefail
cd "$(dirname "$0")/.."
IMAGE="mcr.microsoft.com/playwright:v1.50.0-noble"
# Attach the Playwright container to the same Docker network as the app so it
# can resolve pediatric-ai-scribe by service name. Internal container port is 3000.
NETWORK="${E2E_NETWORK:-ped-ai_default}"
BASE_URL="${BASE_URL:-http://pediatric-ai-scribe:3000}"
docker run --rm --ipc=host \
--network="$NETWORK" \
-v "$PWD/e2e":/work \
-w /work \
-e BASE_URL="$BASE_URL" \
-e CI=true \
"$IMAGE" \
sh -c "npm install --no-audit --no-fund --silent && npx playwright test"