houserules/.sisyphus/scripts/run-pw.sh
Joey Yakimowich-Payne 35d9d3aafb
fix(e2e): run-pw.sh — don't set CI=true; reuse docker compose dev server
The helper previously set CI=true, which flipped Playwright's
`reuseExistingServer` to false. That caused Playwright to spawn its own
Vite dev server on :5173, colliding with the docker compose stack
(paratype-web-dev container).

Removing CI=true makes Playwright connect to the running dev server in
docker. Verified: 146/146 e2e tests pass against docker-compose.dev.yml.
0 fixmes. 0 skips. EXIT_CODE=0.
2026-04-26 22:06:01 -06:00

30 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
# run-pw.sh — run Playwright tests via nohup; poll output file
# Usage:
# ./run-pw.sh <output-file> <playwright-args>
# Example:
# ./run-pw.sh /tmp/pw-t83.log packages/chess/e2e/request-choice.spec.ts --reporter=list
#
# Then poll: while [[ ! -f /tmp/pw-t83.log.done ]]; do sleep 5; done; cat /tmp/pw-t83.log
set -uo pipefail
OUTFILE="${1:?need output file path}"
shift
# Spawn detached; touch DONE marker when complete (success or failure)
# NOTE: do NOT set CI=true — that flips Playwright's reuseExistingServer to
# false and makes it try to spawn its own webServer on :5173, which collides
# with the docker compose dev stack (paratype-web-dev). Leaving CI unset
# means reuseExistingServer=true → Playwright connects to the running dev
# server in docker.
nohup bash -c "
cd /home/joey/Projects/rules
export GIT_TERMINAL_PROMPT=0 GIT_PAGER=cat PAGER=cat
bunx playwright test $* > '$OUTFILE' 2>&1
echo \"EXIT_CODE=\$?\" >> '$OUTFILE'
touch '$OUTFILE.done'
" >/dev/null 2>&1 &
disown
PID=$!
echo "Spawned pw run (pid=$PID); output -> $OUTFILE; done-marker -> $OUTFILE.done"