← back to Dw Photo Capture

5x/tools/sweep.sh

25 lines

#!/bin/bash
# One /5x sweep against the --test server on :9987. Usage: 5x/tools/sweep.sh <n>
N=${1:?sweep number}; R=/Users/macstudio3/Projects/dw-photo-capture; O=$R/5x/out/sweep-$N; mkdir -p $O
cd $R
grep -q "STUBBED (--test)" /tmp/dwp-e2e-server.log || { echo "ABORT: server not in --test"; exit 3; }
S=0; T=0; alive(){ curl -s -o /dev/null -m 5 http://127.0.0.1:9987/healthz || { echo "ABORT: test server died mid-sweep (before: $1) — sweep invalid"; exit 4; }; }
tally(){ alive "$2"; T=$((T+1)); if [ "$1" = 0 ]; then S=$((S+1)); echo "  PASS $2"; else echo "  FAIL $2"; fi; }
for E in chromium webkit firefox; do
  ENGINE=$E TESTROOT=/tmp/dwp-e2e OUT=/tmp/dwp-e2e/shots-sweep$N-$E node scripts/e2e-front-back-display.cjs > $O/e2e-$E.log 2>&1; tally $? "e2e front/back journey [$E] ($(tail -1 $O/e2e-$E.log); $(grep -m1 "capture path" $O/e2e-$E.log))"
done
WARM_CAMERA=1 ENGINE=webkit TESTROOT=/tmp/dwp-e2e OUT=/tmp/dwp-e2e/shots-sweep$N-webkit-warm node scripts/e2e-front-back-display.cjs > $O/e2e-webkit-warm.log 2>&1; tally $? "e2e front/back journey [webkit, warm camera → LIVE path] ($(tail -1 $O/e2e-webkit-warm.log))"
for E in chromium webkit firefox; do
  HUNG_CAMERA=1 ENGINE=$E TESTROOT=/tmp/dwp-e2e OUT=/tmp/dwp-e2e/shots-sweep$N-$E-hung node scripts/e2e-front-back-display.cjs > $O/e2e-$E-hung.log 2>&1; tally $? "e2e journey [$E, HUNG camera → timeout → SNAP file-input path] ($(tail -1 $O/e2e-$E-hung.log); $(grep -m1 "capture path" $O/e2e-$E-hung.log))"
done
for p in / /captures /batch /cam; do n=$(echo $p|tr -d /); n=${n:-root}
  node ~/.claude/skills/3x/run.js --url "http://127.0.0.1:9987$p" --user admin --pass 'DW2024!' --paths "/,/captures,/batch,/cam" --no-open --clickthrough 1 > $O/3x-$n.log 2>&1
  alive "3x $p"
  echo "  3x $p: $(grep -E '^\s+\[(PASS|FAIL|SKIP)\] (M|B)' $O/3x-$n.log | awk '{print $1,$2}' | tr '\n' ' ') | $(grep 'CLICK-THROUGH' $O/3x-$n.log | sed 's/ *CLICK-THROUGH → //')"
done
JSON=$O/probe.json node 5x/tools/console-probe.cjs > $O/probe.log 2>&1; tally $? "console/pageerror/4xx/broken-img probe 3 engines x 4 pages"
node 5x/tools/index-toolbar-click.cjs > $O/toolbar.log 2>&1; tally $? "index launcher+toolbar clickthrough 3 engines ($(tail -1 $O/toolbar.log))"
node 5x/tools/history-scroll-check.cjs > $O/history.log 2>&1; tally $? "history thumbs load after scroll 3 engines"
node 5x/tools/captures-missing-check.cjs > $O/missing.log 2>&1; tally $? "missing-side rule api+ui 3 engines"
echo "TARGETED: $S/$T passed"