e545343fe0
1. Top-up across positions: an ad burns from ONE position, and topUpCampaign only looked at the ad's
own position (or the main one when the list row had no memberId), so credits bought on a linked
position could never top up the ad. Ported from InstantAdPay 2026-09-27 (Jim Watts): the ad's real
member id is read from the campaign row; when it cannot cover, the refusal names where the free
credits are and offers switchOptions; with the member's yes (switchTo, only a position on the
account) moveFunding settles what the ad already ran up on the OLD position, moves the ad, then
tops up. Ads screen asks in-page (own dialog) and retries. Create already had the largest-position guard.
2. Toasts: errors stay until closed (close button, role=alert), other notes 3.5 to 9 s by length.
3. Banner Spin per-banner clicks: his 3 clicks were all unmatched (no view on record for that browser),
so they landed on the fallback row and every banner said 0. Click matching now also tries the same
connection (daily-salted IP-only hash) when the browser key finds nothing (mail/exchange app view,
click opened in the phone browser), view notes last 60 min instead of 15, and the stats split
'Fallback shown' from 'Clicks not tied to a banner' so the rows add up to the total. History is not
backfilled: views were never stored per visitor, so old clicks cannot be tied reliably.
4. Holding tank: hub-made waiting accounts with no sponsor are in the tank (waiting, rescue, readyTick
read listAll with { shells: true }; 'hub-shell' no longer holds anyone back). Locked / sponsored /
unknown, grace, 2-adoption cap unchanged; readyTick still never switches a shell on;
accounts.listAll default unchanged (mailings skip shells).
Assets: cr.css, cr-shell.js, ads-screen.js ?v=20261114tu, banner-spin.js ?v=20261114bc.
QA: walk member 0 bugs (36 ok), netconv 57/57, networksso ALL PASSED, tank-hold all passed (new hub
shell part), profile policy 16/16, new topup-positions 8/8, new bannerspin-attrib 7/7, bannerspin e2e
75/75, hubsync 15 checks, tank-cap 15/15, sponsorfollow 30/30.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
119 lines
7.8 KiB
Bash
119 lines
7.8 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 sso # network sign-in InstantAdPay <-> LinkSpin: unit + both servers end to end (NSSO_PEER_DIR = the other repo's site dir if not side by side; also runs in member)
|
|
# bash qa/run.sh earn # local copy: earning flows end to end (~2-3 min)
|
|
# bash qa/run.sh all # public + member + earn
|
|
# bash qa/run.sh kb # chat knowledge base: retrieval unit test + chat endpoint e2e on a local copy with a mock OpenRouter
|
|
# bash qa/run.sh sponsorfollow # sponsor follow rule + network tank unit tests + carry hold guard + carry activation regression
|
|
# bash qa/run.sh tankhold # holding tank: network alignment first, plain-activation hold (never a purchase), 24-hour rotation, payouts on at assignment (unit with a mocked clock + fake engine, then a local copy with a mock InstantAdPay)
|
|
# bash qa/run.sh netconv # conversion linkage: InstantAdPay's joins, wallets, purchases counted once, own account left out, window, aged hits, two copies racing, one Reports list, the landing tag on network links
|
|
# bash qa/run.sh netsrc # network sites as traffic sources: the six fixed network links, ?src= picks the sending site's source, member links get it on first use
|
|
# bash qa/run.sh lsid # page-builder lead -> rotator conversion + postback, audience pixel events and cookieless hits
|
|
# bash qa/run.sh convpixel # conversion pixel: ad click ids, landing tag + goal pixel (url/stored/cookie/soft), dedupe, window, owner check, cost per goal, IAP partner calls, browser + framed
|
|
# bash qa/run.sh nas # Network Ad Space billing: stop snapshot, active-only reconcile, restart without phantom delivery, the 1/N network + partner-zone rate (stubbed NAS, throwaway data)
|
|
# bash qa/run.sh loginqueue # prepaid login-slot queue: ads.js unit test (two app copies promoting at once) + HTTP/Ads-screen e2e on a local copy
|
|
# bash qa/run.sh launchweek # launch week: contest window in Central time, exclusions, minimum sales, payout once across two copies, Founder criterion + grant (fake chain + signer)
|
|
# bash qa/run.sh override # level-4 override: week math, hunt, house, dust carry, cap, balance, two concurrent payers (fake chain + signer, throwaway data)
|
|
# bash qa/run.sh policy # profile policy + link-farm scan: prohibited list, bio links, quarantine, 06:30 claim, walls of free/paying members, 404 walls (unit + local copy; also runs in member)
|
|
# bash qa/run.sh fuel # Fuel Your Offers: refill notices, refuel streak, Refuel Kit, Engine Room (unit + two-copy tests, throwaway data)
|
|
# bash qa/run.sh theme # light/dark themes: WCAG contrast of the main text/background pairs on the member area + public pages, both themes (local copy)
|
|
# QA_THEME=dark bash qa/run.sh member # walk every pane in one theme; screenshots land as *-dark.png / *-light.png
|
|
# 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")/.."
|
|
# no node_modules in this checkout: borrow InstantAdPay's (same ethers major) so ethers-based tests can load
|
|
[ -d node_modules ] || [ -n "${NODE_PATH:-}" ] || { [ -d ../../onchain-ad-membership/site/node_modules ] && export NODE_PATH="$(cd ../../onchain-ad-membership/site/node_modules && pwd)"; }
|
|
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"
|
|
}
|
|
|
|
# Syntax gate, every mode (2026-10-29): /traffic-guide shipped with a parse error in traffic-guide.js (a // comment inside a
|
|
# one-liner) and rendered empty for everyone for a day. node --check costs nothing and catches it before any walk runs.
|
|
syntax_gate() {
|
|
local bad=0 f
|
|
for f in *.js lib/*.js public/*.js public/assets/*.js; do
|
|
[ -f "$f" ] || continue
|
|
node --check "$f" 2>"$OUT/syntax.err" || { echo "[bug] SYNTAX $f :: $(grep -m1 -E 'Error' "$OUT/syntax.err")"; bad=1; }
|
|
done
|
|
rm -f "$OUT/syntax.err"
|
|
[ "$bad" = 0 ] && echo "syntax gate: every script parses" || status=1
|
|
}
|
|
syntax_gate
|
|
|
|
if [ "$MODE" = "public" ]; then
|
|
node qa/walk.mjs public || status=1
|
|
elif [ "$MODE" = "fuel" ]; then
|
|
for f in qa/refill.test.cjs qa/refuel*.test.cjs; do [ -f "$f" ] && { node "$f" || status=1; }; done
|
|
elif [ "$MODE" = "theme" ]; then
|
|
start_local 8797 && { LOCAL=http://127.0.0.1:8797 node qa/theme-contrast.mjs || status=1; }; stop_local 8797
|
|
elif [ "$MODE" = "override" ]; then
|
|
node qa/override.test.cjs || status=1
|
|
elif [ "$MODE" = "launchweek" ]; then
|
|
node qa/launchweek.test.cjs || status=1
|
|
elif [ "$MODE" = "sso" ]; then
|
|
node qa/networksso.test.cjs || status=1
|
|
node qa/networksso.e2e.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
|
|
node qa/networksso.test.cjs || status=1 # network sign-in with the other site: tokens, replay, open redirects, loop guard
|
|
node qa/networksso.e2e.mjs || status=1 # both servers locally, a real browser across them (skips if the other repo is not beside this one)
|
|
node qa/tank-hold.test.mjs || status=1
|
|
node qa/profile-policy.test.cjs || status=1
|
|
node qa/netconv.test.mjs || status=1
|
|
node qa/topup-positions.test.cjs || status=1 # a top-up the ad's position cannot cover offers the position that can, then moves the ad there (Michael Camire 2026-11-14)
|
|
node qa/bannerspin-attrib.test.cjs || status=1 # Banner Spin: impression -> click -> the banner shown gets the click (same browser, same connection, script ?x=), rows add up (Michael Camire 2026-11-14)
|
|
elif [ "$MODE" = "policy" ]; then
|
|
node qa/profile-policy.test.cjs || status=1
|
|
elif [ "$MODE" = "sponsorfollow" ]; then
|
|
node qa/sponsorfollow.test.cjs || status=1
|
|
node qa/carry-hold.test.cjs || status=1
|
|
node qa/carry-activate.test.cjs || status=1
|
|
elif [ "$MODE" = "hubsync" ]; then
|
|
node qa/hubsync.test.cjs || status=1 # needs a network-hub checkout with /v1/resolve {id}: HUB_DIR=<path>
|
|
elif [ "$MODE" = "tankhold" ]; then
|
|
node qa/tank-hold.test.mjs || status=1
|
|
elif [ "$MODE" = "nas" ]; then
|
|
node qa/nas-stop.test.cjs || status=1
|
|
node qa/nas-ratio.test.cjs || status=1
|
|
elif [ "$MODE" = "loginqueue" ]; then
|
|
node qa/loginqueue.test.cjs || status=1
|
|
node qa/loginqueue.e2e.mjs || status=1
|
|
elif [ "$MODE" = "convpixel" ]; then
|
|
node qa/convpixel.test.mjs || status=1
|
|
elif [ "$MODE" = "netconv" ]; then
|
|
node qa/netconv.test.mjs || status=1
|
|
elif [ "$MODE" = "netsrc" ]; then
|
|
node qa/netsrc.test.mjs || status=1
|
|
elif [ "$MODE" = "lsid" ]; then
|
|
node qa/lsid-pixel.test.mjs || status=1
|
|
elif [ "$MODE" = "kb" ]; then
|
|
node qa/kb-retrieval.cjs || status=1
|
|
node qa/kb-chat.mjs || status=1
|
|
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/launchweek.test.cjs || 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
|