#!/usr/bin/env bash set -euo pipefail # Seeds the Playwright browser cache for offline console CI runs. # Run on a connected runner once, then bake ~/.cache/ms-playwright into the runner image. ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" pushd "$ROOT/src/Web" >/dev/null if ! command -v npx >/dev/null; then echo "npx not found; install Node.js 20+ first" >&2 exit 1 fi echo "Installing Playwright Chromium to ~/.cache/ms-playwright ..." PLAYWRIGHT_BROWSERS_PATH=${PLAYWRIGHT_BROWSERS_PATH:-~/.cache/ms-playwright} export PLAYWRIGHT_BROWSERS_PATH npx playwright install chromium --with-deps echo "Done. Cache directory: $PLAYWRIGHT_BROWSERS_PATH" popd >/dev/null