43 lines
1.1 KiB
Bash
Executable File
43 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
cd "$ROOT"
|
|
|
|
# install deps (fast fail if missing)
|
|
npm ci --no-audit --no-fund
|
|
npx playwright install --with-deps || true
|
|
|
|
# start a simple static server to serve public/ on port 3020
|
|
PORT=3020
|
|
PUBLIC_DIR="$ROOT/public"
|
|
|
|
# prefer serve if available, else use npx http-server
|
|
if command -v serve > /dev/null 2>&1; then
|
|
serve -s "$PUBLIC_DIR" -l $PORT > /tmp/studio_static_server.log 2>&1 &
|
|
SERVER_PID=$!
|
|
else
|
|
npx http-server "$PUBLIC_DIR" -p $PORT > /tmp/studio_static_server.log 2>&1 &
|
|
SERVER_PID=$!
|
|
fi
|
|
|
|
echo "Started static server (pid=$SERVER_PID), log: /tmp/studio_static_server.log"
|
|
sleep 1
|
|
|
|
# export envs for the test
|
|
export TOKEN_SERVER_URL=${TOKEN_SERVER_URL:-http://localhost:4000}
|
|
export STUDIO_URL=${STUDIO_URL:-http://localhost:3020}
|
|
|
|
# run playwright test
|
|
npx playwright test tests/e2e/session_flow.spec.ts --project=chromium --config=playwright.config.ts || true
|
|
|
|
# cleanup
|
|
if [ -n "${SERVER_PID:-}" ]; then
|
|
kill "$SERVER_PID" 2>/dev/null || true
|
|
fi
|
|
|
|
echo "Artifacts (screenshots) in /tmp/e2e_*.png"
|
|
ls -la /tmp/e2e_*.png || true
|
|
|
|
exit 0
|