Files
instantadpay/qa/run.sh
T
martbost 218bb10145 Network Weekend 2026, built dormant (Marty 2026-11-17): Black Friday to Cyber Monday, midnight to midnight Central
- promodays.js: reusable date-to-percent bonus map (setting promoDays, kill switch promoDaysOn), once per tx via marks (MySQL):
  Fri 11-27 +40% $5+, Sat/Sun +20% $5+, Mon 11-30 +30% $20+. A mapped Friday is paid by friday.js at max(fridayBonusPct, day pct),
  one bonus per tx, Game Pass Friday perk intact; Five Dollar Friday +20% resumes 12-04 with no hand edits.
- friday.js: Thanksgiving Thursday 18:00 CT notice + email carry the Black Friday copy (one message); Black Friday kickoff and
  wrap-up copy; /api/friday reports the day's real pct and name; IAP_TEST_NOW test clock (ignored in production).
- Weekend Starter Bundle ($20+ in the window: LinkSpin code WEEKEND500 on a purchase notice) and Builder Bundle ($100+: notice +
  GET /api/network/weekend-builders for DownlineHydra, X-Weekend-Key = env WEEKEND_BUNDLE_KEY, constant-time compare).
- promos.js: promo_codes.starts (dormant-until gate) for code NETWORKWEEKEND.
- gamepass.js: tier passes paid by a package Fri 11-27 00:00 CT to Fri 12-04 00:00 CT get Explorer/Champion +15 days, Legend +60.
- /weekend deals page (assets/weekend.js), Home strip + Overview card (assets/weekend-card.js), network ribbon (netdeals.js +
  assets/netweekend.js via common.js and netline.js), chatbot fact + answer date-gated.
- Share hosts: /weekend, /friday and other page names are pages, not usernames (email links use instantadpay.link: instantadpay.com
  is still on the Spamhaus DBL, checked 11-17).
- welcome.js says the day's real pct; common.js/netline.js/welcome.js ?v=20261117nw.
- Tests: qa/promodays.test.cjs (12) + qa/weekend.e2e.mjs (18) at test clocks; bash qa/run.sh weekend; member walk clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 07:59:55 -06:00

152 lines
11 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 walletnudge # game wallet push (any linked wallet, activated or not) + no-wallet nudge copy against a mock game (also runs in member)
# bash qa/run.sh draft # 5xYourTeam The Draft partner routes: pool / adopt / release / status rules on the real tank.js (mocked clock, fake hub) + the signed HTTP routes on a local copy (also runs in member)
# bash qa/run.sh tankhold # holding-tank activation hold, 24-hour safety net (mocked clock) and LinkSpin alignment: unit + local copy (also runs in member)
# bash qa/run.sh sponsorfollow # sponsor follow rule + network tank unit tests and the two-server e2e (local IAP + local LinkSpin, throwaway data)
# bash qa/run.sh door # Spooky Doors door + costume shop flows on their own local copy (qa/door.mjs boots it)
# bash qa/run.sh warpwares # Warp & Wares: Games card gating, the hand-off, a sponsor dock on the refuel rail (visit kind dock + its cap), chatbot gating (qa/warpwares.mjs boots a local copy + a mock game)
# bash qa/run.sh gamepass # Game Pass buy flow + account-wide POL caps (polgrant) on their own local copy (qa/gamepass.mjs boots it)
# bash qa/run.sh sov-passes # (+ qa/sov-heroes-store.cjs: Shards of Valor bonus heroes sold one time, also runs in member)
# bash qa/run.sh sov-passes # pass tiers (Explorer/Champion/Sovereign/Legend): store unit checks + admin buys Explorer + Sovereign with seeded purchased credits on a local copy (screenshots D:/tmp/sov-passes)
# bash qa/run.sh nas # Network Ad Space billing: served-count trap, stopped-ad restart (no phantom delivery), the 1/N network rate + PassiveDrip partner visits (stubbed NAS, throwaway data)
# bash qa/run.sh login-queue # prepaid login-ad line: JSON store end to end + the MySQL path's lease/guard logic against a fake SQL layer (no server, throwaway data)
# bash qa/run.sh gamepass-games # the REAL games' polgrant.js + PolHunter's tournament payer against a local copy (needs the sibling game repos)
# 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 netconv # conversion linkage end to end: spin link -> join -> wallet -> a Purchase on a mock chain, local InstantAdPay + local LinkSpin, LinkSpin down, own account, two copies racing
# bash qa/run.sh convpixel # conversion pixel: lsclk click ids on /api/ads/click, signed push to a MOCK LinkSpin, own-click self flag, Campaigns > Conversion tracking + cost per goal, LinkSpin down (local copy, throwaway data)
# 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 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 bixpay # BixPay card: partner-link validator, sponsor-follows resolver (own / level 3 / company), gate, click store (unit, no server; also runs in member)
# bash qa/run.sh weekend # Network Weekend 2026 (promodays.js): unit tests + local e2e at Black Friday / Cyber Monday / before / after test clocks
# bash qa/run.sh theme # light/dark themes: WCAG contrast of the main text/background pairs on the member area, admin and 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")/.."
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): LinkSpin's /traffic-guide shipped with a parse error in its page script (a // comment
# inside a one-liner) and rendered empty for everyone for a day. node --check costs nothing and catches it before any walk.
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
node qa/chatbot-sync.mjs || status=1
elif [ "$MODE" = "sso" ]; then
node qa/networksso.test.cjs || status=1
node qa/networksso.e2e.mjs || status=1
node qa/networksso-partner.e2e.mjs || status=1 # a partner wallet site (5xYourTeam pattern) through this site: signed in -> straight back; signed out -> sign-in, login ad, Continue -> back; the login-ad clock
node qa/networksso-hub.e2e.mjs || status=1 # the network hub as the sign-in provider: push, hub sign-in on another site, wallet partner, sign out everywhere, blocked, replay (skips without ../../network-hub)
elif [ "$MODE" = "member" ]; then
start_local 8796 && { LOCAL=http://127.0.0.1:8796 node qa/walk.mjs member || status=1; LOCAL=http://127.0.0.1:8796 node qa/member-extra.mjs || status=1; LOCAL=http://127.0.0.1:8796 node qa/support-suggest.mjs || 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/networksso-partner.e2e.mjs || status=1 # a partner wallet site (5xYourTeam pattern) through this site: signed in -> straight back; signed out -> sign-in, login ad, Continue -> back; the login-ad clock
node qa/networksso-hub.e2e.mjs || status=1 # the network hub as the sign-in provider: push, hub sign-in on another site, wallet partner, sign out everywhere, blocked, replay (skips without ../../network-hub)
node qa/tank-hold.mjs || status=1
node qa/tank-batch.test.mjs || status=1 # holding tank batches: ladder, switch off = no writes, rotation, grace, cadence, follow-up, separate 5x cap
node qa/draft-partner.test.mjs || status=1 # 5xYourTeam draft partner routes (DRAFT_E2E_PORT, default 8825)
node qa/walletnudge.test.cjs || status=1
node qa/bixpay.test.cjs || status=1
node qa/profile-policy.test.cjs || status=1
node qa/sov-heroes-store.cjs || status=1
node qa/erase.test.cjs || status=1 # member erase (erase.js + scrub.js, 2026-11-15); qa/erase.mysql.test.cjs needs TEST_DATABASE_URL
node --test qa/promodays.test.cjs || status=1 # Network Weekend 2026: promo days, Black Friday via friday.js, bundles, code start gate, pass days (2026-11-17)
elif [ "$MODE" = "weekend" ]; then
node --test qa/promodays.test.cjs || status=1
node qa/weekend.e2e.mjs || status=1 # /weekend, Home strip, ribbon, feeds, builders key at test clocks (local copies + a fake hub)
elif [ "$MODE" = "draft" ]; then
node qa/draft-partner.test.mjs || status=1
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" = "policy" ]; then
node qa/profile-policy.test.cjs || status=1
elif [ "$MODE" = "bixpay" ]; then
node qa/bixpay.test.cjs || status=1
elif [ "$MODE" = "hub" ]; then
node qa/hubsync.test.cjs || status=1 # needs the network-hub checkout beside this repo (HUB_DIR to override)
elif [ "$MODE" = "walletnudge" ]; then
node qa/walletnudge.test.cjs || status=1
elif [ "$MODE" = "tankhold" ]; then
node qa/tank-hold.mjs || status=1
node qa/tank-batch.test.mjs || status=1 # holding tank batches: ladder, switch off = no writes, rotation, grace, cadence, follow-up, separate 5x cap
elif [ "$MODE" = "sponsorfollow" ]; then
node qa/sponsorfollow.test.cjs || status=1
node qa/sponsorfollow-e2e.mjs || status=1
elif [ "$MODE" = "kb" ]; then
node qa/kb-retrieval.cjs || status=1
node qa/kb-chat.mjs || status=1
node qa/netkb-merge.test.cjs || status=1 # the shared network knowledge base: home first, a named site first, labels, fast-path skip (2026-11-15)
node qa/netkb-semantic.test.mjs || status=1 # semantic matching via the hub (2026-11-16): route/suggest decisions, fail soft, shared-file parity
elif [ "$MODE" = "door" ]; then
node qa/door.mjs || status=1
elif [ "$MODE" = "warpwares" ]; then
node qa/warpwares.mjs || status=1
elif [ "$MODE" = "gamepass" ]; then
node qa/gamepass.mjs || status=1
elif [ "$MODE" = "sov-passes" ]; then
node qa/sov-passes-store.cjs || status=1
node qa/sov-heroes-store.cjs || status=1
node qa/erase.test.cjs || status=1 # member erase (erase.js + scrub.js, 2026-11-15); qa/erase.mysql.test.cjs needs TEST_DATABASE_URL
node qa/sov-passes-local.mjs || status=1
elif [ "$MODE" = "nas" ]; then
node qa/nas-served.mjs || status=1
node qa/nas-restart.mjs || status=1
node qa/nas-ratio.mjs || status=1
elif [ "$MODE" = "login-queue" ]; then
node qa/login-queue.cjs || status=1
node qa/login-queue-sql.cjs || status=1
elif [ "$MODE" = "netconv" ]; then
node qa/netconv.test.mjs || status=1
elif [ "$MODE" = "convpixel" ]; then
node qa/convpixel.test.mjs || 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" = "override" ]; then
node qa/override.test.cjs || status=1
elif [ "$MODE" = "gamepass-games" ]; then
node qa/gamepass-games.cjs || 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/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