#!/usr/bin/env bash
set -euo pipefail

HOST="${PERF_HOST:-127.0.0.1:8000}"

# Check server is running
if ! curl -sf "http://$HOST/api/stats" > /dev/null 2>&1; then
  echo "ERROR: Server not running on $HOST" >&2
  echo "Start it with: uv run scripts/serve start" >&2
  exit 1
fi

cd "$(dirname "$0")/../frontend"
BASE_URL="http://$HOST" npx playwright test tests/a11y.spec.js --reporter=list
