#!/usr/bin/env bash # Milestone 2 check: serve dist/ locally, render it in headless Chromium, and # require the page's own summary to read "13 of 13 manifests identical". # Usage: scripts/check-page.sh [chromium binary] (after scripts/build-dist.sh) set -euo pipefail ROOT=$(cd "$(dirname "$0")/.." && pwd) cd "$ROOT" CHROME=${1:-${CHROME:-$(command -v google-chrome || command -v chromium || echo "$HOME/.cache/ms-playwright/chromium_headless_shell-1194/chrome-linux/headless_shell")}} PORT=${PORT:-8765} python3 -m http.server "$PORT" --directory dist >/dev/null 2>&1 & SERVER=$! trap 'kill $SERVER 2>/dev/null' EXIT sleep 1 dom=$(timeout 90 "$CHROME" --headless --no-sandbox --disable-gpu --virtual-time-budget=15000 \ --dump-dom "http://127.0.0.1:$PORT/" 2>/dev/null) rows=$(grep -o '
]*>[^<]*
' <<<"$dom" | sed 's/<[^>]*>//g') echo "$rows identical rows; summary: $summary" [ "$rows" = 13 ] && grep -q "13 of 13 manifests identical" <<<"$summary"