Files
instantadpay/qa/run.sh
T
martbost 362526d007 Chatbot brought fully current + knowledge guard
Audit against the live site: removed stale text (featured links and visit packs marked "coming",
Pipeline "coming soon", the superseded sponsor-hold rule, a non-existent home-page calculator,
"earned credits spend on banner and text only", "Coaching pane"); added live featured and visit-pack
rules with prices and limits, the video cap and rewards, the sign-in bonus and claim ladders,
report-an-ad, the public missed-payout posts, the walk-up gain notice, the four-minute overview
video, the promo Videos and Toolkit tabs; new canned answers for featured links, visit packs and
"what is this". KNOWLEDGE_DATE constant + qa/chatbot-sync.mjs (run in public/all QA) fails when a
release note is newer than the chatbot's knowledge.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 14:10:00 -05:00

44 lines
2.0 KiB
Bash

#!/usr/bin/env bash
# InstantAdPay QA harness runner. From the site dir:
# bash qa/run.sh public # live public pages only (no local server)
# bash qa/run.sh member # local copy: member + admin walk
# bash qa/run.sh earn # local copy: earning flows end to end (~2-3 min)
# bash qa/run.sh all # public + member + earn
# Each local run boots server.js on its own port with a throwaway data dir (JSON store, no DB, no
# mail key, devCode sign-in), so nothing touches production data. Reports land in qa/out/.
set -u
cd "$(dirname "$0")/.."
MODE="${1:-all}"
OUT="qa/out"; mkdir -p "$OUT"
TMP="${TMPDIR:-${TEMP:-/tmp}}/iap-qa-$$"
status=0
start_local() { # $1 = port
local port="$1"
rm -rf "$TMP-$port"; mkdir -p "$TMP-$port/uploads"
(PORT="$port" DATA_DIR="$TMP-$port" ADMIN_EMAIL="${ADMIN_EMAIL:-martybostick@gmail.com}" ADMIN_PASSWORD=localtest node server.js > "$OUT/server-$port.log" 2>&1 &)
for i in $(seq 1 20); do curl -s -m 2 "http://127.0.0.1:$port/api/config" >/dev/null && return 0; sleep 1; done
echo "local server on :$port did not come up"; return 1
}
stop_local() { # $1 = port
for p in $(netstat -ano 2>/dev/null | grep ":$1 " | awk '{print $5}' | sort -u); do taskkill //F //PID "$p" >/dev/null 2>&1; done
rm -rf "$TMP-$1"
}
if [ "$MODE" = "public" ]; then
node qa/walk.mjs public || status=1
node qa/chatbot-sync.mjs || status=1
elif [ "$MODE" = "member" ]; then
start_local 8796 && { LOCAL=http://127.0.0.1:8796 node qa/walk.mjs member || status=1; }; stop_local 8796
elif [ "$MODE" = "earn" ]; then
start_local 8797 && { LOCAL=http://127.0.0.1:8797 node qa/earn.mjs || status=1; }; stop_local 8797
else
node qa/walk.mjs public || status=1
node qa/chatbot-sync.mjs || status=1
start_local 8796 && { LOCAL=http://127.0.0.1:8796 node qa/walk.mjs member || status=1; }; stop_local 8796
start_local 8797 && { LOCAL=http://127.0.0.1:8797 node qa/earn.mjs || status=1; }; stop_local 8797
fi
echo
echo "reports: $OUT/walk-report.txt $OUT/earn-report.txt (screenshots alongside)"
exit $status