// InstantAdPay QA harness: site walk. // node qa/walk.mjs public -> live public pages (no sign-in): errors, failed requests, broken images, dead links, mobile // node qa/walk.mjs member -> local copy: sign in, every member pane + sub-tab, every admin pane, forms // node qa/walk.mjs all -> both // Env: LIVE (default https://instantadpay.com), LOCAL (default http://127.0.0.1:8796), OUT (report dir), // PW (playwright package dir; default D:/Projects/MarketingAgent/qa-tester/node_modules/playwright) // Exit code 1 when any [bug] finding remains after noise filtering. import { pathToFileURL } from 'node:url'; import fs from 'node:fs'; const PW = process.env.PW || 'D:/Projects/MarketingAgent/qa-tester/node_modules/playwright'; const { chromium } = (await import(pathToFileURL(PW + '/index.js').href)).default; const MODE = process.argv[2] || 'all'; const LIVE = process.env.LIVE || 'https://instantadpay.com'; const LOCAL = process.env.LOCAL || 'http://127.0.0.1:8796'; const OUT = process.env.OUT || 'qa/out'; fs.mkdirSync(OUT, { recursive: true }); // QA_THEME=light|dark|auto (2026-11-01): set localStorage iap.theme before the first navigation so every pane is walked and // screenshotted in that theme; screenshots get a - suffix so both sets survive in qa/out const THEME = ['light', 'dark', 'auto'].includes(process.env.QA_THEME || '') ? process.env.QA_THEME : ''; const SUF = THEME ? '-' + THEME : ''; const themed = async ctx => { if (THEME) await ctx.addInitScript(t => { try { localStorage.setItem('iap.theme', t); } catch (e) {} }, THEME); return ctx; }; const findings = []; const note = (sev, where, what) => findings.push({ sev, where, what }); const NOISE = /walletconnect|reown|web3modal|coingecko|fonts\.|\/api\/feed\/live|\/api\/auth\/logout/; function watch(page, base) { const bag = { console: [], failed: [], status: [] }; page.on('pageerror', e => bag.console.push('pageerror: ' + e.message)); page.on('console', m => { if (m.type() !== 'error') return; const loc = (m.location() && m.location().url) || ''; if (loc && !loc.startsWith(base)) return; // third-party or framed page, not ours if (/status of (400|401|404)/.test(m.text())) return; // expected API answers surface as console noise bag.console.push(m.text()); }); page.on('requestfailed', r => { const u = r.url(); const err = (r.failure() && r.failure().errorText) || ''; if (err === 'net::ERR_ABORTED') return; /* a request the page cancelled by navigating away (a poll or a save still in flight): never a server failure (2026-11-01) */ if (u.startsWith(base) && !NOISE.test(u)) bag.failed.push(u + ' ' + err); }); page.on('response', r => { const st = r.status(); const u = r.url(); if (st >= 500 && u.startsWith(base)) bag.status.push(st + ' ' + u); }); return bag; } function flush(bag, label) { for (const c of bag.console) note('bug', label, 'console: ' + c.slice(0, 200)); for (const f of bag.failed) note('bug', label, 'request failed: ' + f.slice(0, 200)); for (const s of bag.status) note('bug', label, 'HTTP ' + s.slice(0, 200)); bag.console.length = bag.failed.length = bag.status.length = 0; } async function domChecks(page, label) { const r = await page.evaluate(() => { const vis = el => el.offsetParent !== null; const brokenImgs = [...document.images].filter(i => i.complete && i.naturalWidth === 0 && i.src && vis(i)).map(i => i.src); const unfilled = [...document.querySelectorAll('body *')].filter(el => el.children.length === 0 && (el.textContent || '').trim() === '…' && vis(el)).length; const overflow = document.documentElement.scrollWidth > document.documentElement.clientWidth + 2; return { brokenImgs, unfilled, overflow, title: document.title }; }); const imgs = label.startsWith('LOCAL') ? r.brokenImgs.filter(s => !/\/api\/qr\?/.test(s)) : r.brokenImgs; // the qrcode module is not installed in a local checkout, so /api/qr answers 404 there (2026-11-01) if (imgs.length) note('bug', label, 'broken images: ' + imgs.slice(0, 3).join(', ')); if (r.unfilled) note('warn', label, r.unfilled + ' element(s) still showing the loading ellipsis'); if (r.overflow) note('warn', label, 'page scrolls horizontally'); return r; } const hide = page => page.evaluate(() => { document.querySelectorAll('.modal-back,.lgate,.iap-welcome').forEach(m => m.hidden = true); }); const browser = await chromium.launch(); if (MODE === 'public' || MODE === 'all') { const ctx = await themed(await browser.newContext({ viewport: { width: 1280, height: 900 } })); await ctx.addInitScript(() => { try { sessionStorage.setItem('iap.welcome.v1', '1'); } catch (e) {} }); // the session pop-up would block every click in an automated run const page = await ctx.newPage(); const bag = watch(page, LIVE); const PUBLIC = ['/', '/ledger', '/contract', '/terms', '/privacy', '/disclaimer', '/wall/martbost', '/join/martbost', '/join/martbost?v=instant', '/join/martbost?v=adspend', '/join/martbost?v=free', '/join/martbost?v=ledger', '/join/martbost?v=two', '/admin', '/my', '/shorts', '/presentation', '/presentation?ref=martbost', '/support', '/nope-404']; for (const p of PUBLIC) { const label = 'LIVE ' + p; try { const resp = await page.goto(LIVE + p, { waitUntil: 'domcontentloaded', timeout: 45000 }); await page.waitForTimeout(2500); const st = resp ? resp.status() : 0; if (p === '/nope-404') { if (st !== 404) note('warn', label, 'expected 404, got ' + st); } else if (st >= 400) note('bug', label, 'page HTTP ' + st); const d = await domChecks(page, label); const hrefs = await page.evaluate(() => [...new Set([...document.querySelectorAll('a[href]')].map(a => a.href).filter(h => h.startsWith(location.origin) && !h.includes('#') && !h.includes('/api/')))]); for (const h of hrefs.slice(0, 40)) { try { const r = await page.request.head(h, { timeout: 15000 }); if (r.status() >= 400) note('bug', label, 'dead link ' + h + ' -> ' + r.status()); } catch (e) { note('warn', label, 'link check failed ' + h); } } flush(bag, label); console.log('ok', label, '|', d.title); } catch (e) { note('bug', label, 'navigation failed: ' + e.message.slice(0, 160)); flush(bag, label); } } const m = await themed(await browser.newContext({ viewport: { width: 390, height: 844 }, isMobile: true })); await m.addInitScript(() => { try { sessionStorage.setItem('iap.welcome.v1', '1'); } catch (e) {} }); // the session pop-up would block every click in an automated run const mp = await m.newPage(); const mbag = watch(mp, LIVE); for (const p of ['/', '/join/martbost?v=instant', '/wall/martbost', '/my']) { await mp.goto(LIVE + p, { waitUntil: 'domcontentloaded', timeout: 45000 }).catch(e => note('bug', 'LIVE mobile ' + p, e.message)); await mp.waitForTimeout(2000); await domChecks(mp, 'LIVE mobile ' + p); flush(mbag, 'LIVE mobile ' + p); await mp.screenshot({ path: OUT + '/mobile' + p.replace(/[^a-z0-9]+/gi, '-') + SUF + '.png' }).catch(() => {}); } await ctx.close(); await m.close(); } if (MODE === 'member' || MODE === 'all') { const ctx = await themed(await browser.newContext({ viewport: { width: 1280, height: 950 } })); await ctx.addInitScript(() => { try { sessionStorage.setItem('iap.welcome.v1', '1'); } catch (e) {} }); // the session pop-up would block every click in an automated run const page = await ctx.newPage(); const bag = watch(page, LOCAL); page.on('dialog', d => d.accept()); const L = 'LOCAL '; await page.goto(LOCAL + '/my', { waitUntil: 'networkidle' }); await page.fill('#mcEmail', 'qa-walk@example.com'); await page.click('#mcSendBtn'); await page.waitForSelector('#mcVerifyBtn:not([hidden])'); await page.click('#mcVerifyBtn'); await page.waitForTimeout(2000); if (await page.$('#onboardModal:not([hidden])')) { await page.fill('#obUsername', 'qawalker'); await page.click('#obSave'); await page.waitForTimeout(1200); } await hide(page); flush(bag, L + 'sign-in'); const PANES = ['overview', 'line', 'pipeline', 'buy', 'campaigns', 'earn', 'earnings', 'promo', 'training', 'help', 'games', 'wallet', 'profile']; for (const pn of PANES) { const label = L + 'my#' + pn; await page.click('.bo-menu [data-pane="' + pn + '"]'); await page.waitForTimeout(1200); await hide(page); const vis = await page.evaluate(id => { const el = document.getElementById('pane-' + id); return el && !el.hidden && el.offsetHeight > 40; }, pn); if (!vis) note('bug', label, 'pane did not render'); await domChecks(page, label); const subs = await page.$$('#pane-' + pn + ' .subtabs [data-earn], #pane-' + pn + ' .promo-pills [data-promo]'); for (const s of subs) { try { await s.click(); await page.waitForTimeout(500); } catch (e) {} } if (subs.length) await domChecks(page, label + ' (sub-tabs)'); flush(bag, label); await page.screenshot({ path: OUT + '/my-' + pn + SUF + '.png' }).catch(() => {}); console.log('ok', label, 'subtabs:', subs.length); } // Game Pass card on the Games tab (2026-10-16): hidden while gamePassEnabled is off, rendered with its state and Buy button once on; /my#games?pass=1 highlights it await page.request.patch(LOCAL + '/api/admin/site', { headers: { Authorization: 'Bearer ' + (process.env.ADMIN_PASSWORD || 'localtest'), 'Content-Type': 'application/json' }, data: { gamePassEnabled: '1' } }).catch(() => {}); await page.goto(LOCAL + '/my#games?pass=1', { waitUntil: 'networkidle' }); await page.waitForTimeout(1500); await hide(page); const gpVis = await page.evaluate(() => { const c = document.getElementById('gpCard'); return !!(c && !c.hidden && c.offsetHeight > 40 && /Game Pass/.test(c.textContent) && c.querySelector('#gpBuy, #gpGoBuy')); }); if (!gpVis) note('bug', L + 'my#games/gamepass', 'Game Pass card did not render with gamePassEnabled on (deep link /my#games?pass=1)'); else { await domChecks(page, L + 'my#games/gamepass'); console.log('ok Game Pass card'); } await page.request.patch(LOCAL + '/api/admin/site', { headers: { Authorization: 'Bearer ' + (process.env.ADMIN_PASSWORD || 'localtest'), 'Content-Type': 'application/json' }, data: { gamePassEnabled: '0' } }).catch(() => {}); await page.goto(LOCAL + '/my#games'); await page.reload({ waitUntil: 'load' }); await page.waitForTimeout(2500); await hide(page); // a hash-only goto would not reload the card if (await page.evaluate(() => { const c = document.getElementById('gpCard'); return !!(c && !c.hidden); })) note('bug', L + 'my#games/gamepass', 'Game Pass card shows while gamePassEnabled is off'); flush(bag, L + 'my#games/gamepass'); // BixPay card (2026-10-29): nothing while bixpayLive is off; once on: Wallet card, Overview card, Profile field (customer link refused, // partner link saved, "Using: your link"), the Promo tab with posts + 4 banners + the tracked link, /bixpay 200 with the CTA, /go/bixpay 302s const ADM = { Authorization: 'Bearer ' + (process.env.ADMIN_PASSWORD || 'localtest'), 'Content-Type': 'application/json' }; { const B = L + 'bixpay'; const me0 = await page.evaluate(() => fetch('/api/me').then(r => r.json())); const tok = me0.username || me0.refCode; await page.click('.bo-menu [data-pane="wallet"]'); await page.waitForTimeout(800); if (await page.evaluate(() => { const c = document.getElementById('bixWalletCard'); return !!(c && !c.hidden); })) note('bug', B + '/off', 'Wallet card shows while bixpayLive is off'); if ((await page.request.get(LOCAL + '/bixpay')).status() !== 404) note('bug', B + '/off', '/bixpay served while bixpayLive is off'); await page.request.patch(LOCAL + '/api/admin/site', { headers: ADM, data: { bixpayLive: '1' } }).catch(() => {}); await page.goto(LOCAL + '/my#wallet'); await page.reload({ waitUntil: 'load' }); await page.waitForTimeout(2500); await hide(page); const wc = await page.evaluate(() => { const c = document.getElementById('bixWalletCard'); return c && !c.hidden ? c.textContent : ''; }); if (!/Spend your POL anywhere with a BixPay Visa card/.test(wc) || !/3% per purchase, no load fee/.test(wc) || !/31 US states/.test(wc) || !/Using: the network link/.test(wc)) note('bug', B + '/wallet', 'Wallet card missing or wrong copy: ' + wc.slice(0, 120)); const goHref = await page.$eval('#bixWalletGo', e => e.getAttribute('href')).catch(() => ''); if (!/\/go\/bixpay\?s=wallet/.test(goHref)) note('bug', B + '/wallet', 'button is not the counted /go link: ' + goHref); await domChecks(page, B + '/wallet'); await page.screenshot({ path: OUT + '/my-wallet-bixpay.png' }).catch(() => {}); await page.click('.bo-menu [data-pane="overview"]'); await page.waitForTimeout(800); if (!(await page.evaluate(() => { const c = document.getElementById('bixCard'); return !!(c && !c.hidden && /Visa card for your POL/.test(c.textContent) && c.querySelector('.card-x')); }))) note('bug', B + '/overview', 'announcement card missing or not dismissable'); // profile: the customer link is refused, the partner link saves, the wallet card switches to "your link" await page.click('.bo-menu [data-pane="profile"]'); await page.waitForTimeout(800); await hide(page); if (!(await page.$('#pfBixCard:not([hidden])'))) note('bug', B + '/profile', 'BixPay card section hidden while live'); await page.fill('#pfBixLink', 'https://bix.ibportal.io/auth/register?e=boUGQ_dC9B472D9LGfzxPKvgfBw1iyqx-xffnx1kqPM&a=1&appId=3'); await page.click('#pfBixSave'); await page.waitForTimeout(900); if (!/card-customer link/.test(await page.$eval('#pfBixStatus', e => e.textContent).catch(() => ''))) note('bug', B + '/profile', 'customer link (appId=3) was not refused with the message'); await page.fill('#pfBixLink', 'https://bix.ibportal.io/auth/register?e=QAwalkTOKENqawalkTOKENqawalkTOKENqawalkTOK&a=1'); await page.click('#pfBixSave'); await page.waitForTimeout(1200); if (!/Saved/.test(await page.$eval('#pfBixStatus', e => e.textContent).catch(() => ''))) note('bug', B + '/profile', 'partner link did not save'); await page.screenshot({ path: OUT + '/my-profile-bixpay.png' }).catch(() => {}); const me2 = await page.evaluate(() => fetch('/api/me').then(r => r.json())); if (!me2.bix || me2.bix.whose !== 'you' || !/e=QAwalkTOKEN/.test(me2.bix.link)) note('bug', B + '/api/me', 'resolved link is not the member’s own after saving: ' + JSON.stringify(me2.bix || {}).slice(0, 160)); await page.click('.bo-menu [data-pane="wallet"]'); await page.waitForTimeout(600); if (!/Using: your link/.test(await page.$eval('#bixWalletCard', e => e.textContent).catch(() => ''))) note('bug', B + '/wallet', 'Wallet card did not switch to "Using: your link"'); // promo tab await page.click('.bo-menu [data-pane="promo"]'); await page.waitForTimeout(600); const bpill = await page.$('.promo-pills [data-promo="bixpay"]:not([hidden])'); if (!bpill) note('bug', B + '/promo', 'BixPay pill hidden while live'); else { await bpill.click(); await page.waitForTimeout(900); const sec = await page.evaluate(() => { const s = document.getElementById('promo-bixpay'); return s && !s.hidden ? { posts: s.querySelectorAll('#bixPromoPosts .promo-block').length, swipe: s.querySelectorAll('#bixPromoSwipe .promo-block').length, banners: s.querySelectorAll('#bixPromoBanners .promo-block').length, link: document.getElementById('bixPromoLink').textContent, go: document.getElementById('bixPromoGo').textContent, text: s.textContent } : null; }); if (!sec) note('bug', B + '/promo', 'BixPay section did not show'); else { if (sec.posts !== 3 || sec.swipe !== 1 || sec.banners !== 4) note('bug', B + '/promo', 'expected 3 posts, 1 swipe, 4 banners; got ' + sec.posts + '/' + sec.swipe + '/' + sec.banners); if (!/e=QAwalkTOKEN/.test(sec.link)) note('bug', B + '/promo', 'partner link box is not the member’s own'); if (!/\/go\/bixpay\?s=promo&m=/.test(sec.go)) note('bug', B + '/promo', 'tracked link missing: ' + sec.go); if (/—/.test(sec.text)) note('bug', B + '/promo', 'em dash in BixPay promo copy'); } await domChecks(page, B + '/promo'); await page.screenshot({ path: OUT + '/my-promo-bixpay.png', fullPage: true }).catch(() => {}); } // the counted redirect + the public guide const go = await page.request.get(LOCAL + '/go/bixpay?s=promo&m=' + tok, { maxRedirects: 0 }); if (go.status() !== 302 || !/e=QAwalkTOKEN/.test(go.headers().location || '')) note('bug', B + '/go', 'expected a 302 to the member’s partner link, got ' + go.status() + ' ' + (go.headers().location || '')); const me3 = await page.evaluate(() => fetch('/api/me').then(r => r.json())); if (!me3.bix || !me3.bix.clicks || !(me3.bix.clicks.promo >= 1)) note('bug', B + '/go', 'promo click was not counted for the member'); const gp = await page.request.get(LOCAL + '/bixpay?ref=' + tok); const gb = await gp.text(); if (gp.status() !== 200 || !/Get your BixPay card/.test(gb) || !/BixPay is a separate company/.test(gb)) note('bug', B + '/guide', '/bixpay did not serve with the CTA and the compliance box: ' + gp.status()); const pub = await (await page.request.get(LOCAL + '/api/public/bixpay?ref=' + tok)).json(); if (!pub.live || pub.whose !== 'you' || !/\/go\/bixpay\?s=guide&m=/.test(pub.go || '')) note('bug', B + '/guide', 'public resolver did not resolve the ?ref member: ' + JSON.stringify(pub).slice(0, 160)); const gctx = await browser.newContext({ viewport: { width: 1280, height: 900 } }); const gpage = await gctx.newPage(); const gbag = watch(gpage, LOCAL); await gpage.goto(LOCAL + '/bixpay?ref=' + tok, { waitUntil: 'networkidle' }); await gpage.waitForTimeout(800); await domChecks(gpage, B + '/guide'); flush(gbag, B + '/guide'); await gpage.screenshot({ path: OUT + '/bixpay-guide.png', fullPage: true }).catch(() => {}); await gctx.close(); // clean up: link removed, switch back off, everything hidden again await page.evaluate(() => fetch('/api/my/bixpay', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: '{"link":""}' }).then(r => r.json())); // read the body before navigating, or the walk logs its own aborted request await page.request.patch(LOCAL + '/api/admin/site', { headers: ADM, data: { bixpayLive: '0' } }).catch(() => {}); if ((await page.request.get(LOCAL + '/bixpay')).status() !== 404) note('bug', B + '/off', '/bixpay still served after switching off'); await page.goto(LOCAL + '/my#promo'); await page.reload({ waitUntil: 'load' }); await page.waitForTimeout(2500); await hide(page); if (await page.$('.promo-pills [data-promo="bixpay"]:not([hidden])')) note('bug', B + '/off', 'BixPay pill still shows after switching off'); flush(bag, B); console.log('ok BixPay: wallet card, overview card, profile field, promo tab, /go, /bixpay'); } await page.click('.bo-menu [data-pane="promo"]'); await page.waitForTimeout(800); if (!(await page.$$('#promoPosts .promo-block')).length) note('bug', L + 'promo', 'no post cards rendered'); // viral links: the builder renders a ?ref= link; any page + ?ref= redirects clean and sets the sponsor cookie; an unknown ref sets nothing await page.click('.promo-pills [data-promo="viral"]'); await page.waitForTimeout(1200); const vl = await page.$eval('#viralLink', e => e.textContent).catch(() => ''); if (!/^https:\/\/instantadpay\.com\/.*[?&]ref=[a-z0-9_]+$/i.test(vl)) note('bug', L + 'promo/viral', 'builder link not rendered: ' + vl); const me = await page.evaluate(() => fetch('/api/me').then(r => r.json())); const tok = me.username || me.refCode; // served in place (no redirect: Facebook drops the name otherwise), cookie on the response, og:url carries the ref const rr = await page.request.get(LOCAL + '/?ref=' + tok + '&x=1', { maxRedirects: 0 }); const sc = (rr.headersArray().filter(h => h.name.toLowerCase() === 'set-cookie').map(h => h.value)).join('; '); const rb = await rr.text(); if (rr.status() !== 200 || !//.test(rb)) note('bug', L + 'viral/inplace', 'expected the page at the decorated address, got ' + rr.status()); if (!new RegExp('iap\\.sponsor=' + tok + ';').test(sc) || !/iap\.angle=page;/.test(sc)) note('bug', L + 'viral/cookie', 'sponsor/angle cookie not set: ' + sc); if (!new RegExp('property="og:url" content="[^"]*[?&]ref=' + tok + '"').test(rb)) note('bug', L + 'viral/og', 'og:url does not carry the ref'); const ru = await page.request.get(LOCAL + '/?ref=nobody_zz9', { maxRedirects: 0 }); const su = (ru.headersArray().filter(h => h.name.toLowerCase() === 'set-cookie').map(h => h.value)).join('; '); const ub = await ru.text(); if (ru.status() !== 200 || /iap\.sponsor=/.test(su) || /ref=nobody_zz9/.test(ub)) note('bug', L + 'viral/unknown', 'unknown ref must serve the plain page with no cookie and a clean og:url: ' + ru.status() + ' ' + su); const rj = await page.request.get(LOCAL + '/join/' + tok + '?ref=' + tok, { maxRedirects: 0 }); if (rj.status() !== 200) note('bug', L + 'viral/join', '/join keeps its own ?ref handling, got ' + rj.status()); console.log('ok viral links: builder + redirect + cookie'); // help desk (2026-10-16): Help pane -> new ticket -> thread -> reply; the ref is reused by the admin Support walk below let helpRef = ''; await page.click('.bo-menu [data-pane="help"]'); await page.waitForTimeout(800); await hide(page); await page.click('#helpNewBtn').catch(() => note('bug', L + 'my#help', 'no New ticket button')); await page.waitForTimeout(300); await page.click('#hnSend'); await page.waitForTimeout(600); if (!(await page.$eval('#hnMsg', e => e.textContent.trim()).catch(() => ''))) note('warn', L + 'my#help', 'empty ticket showed no validation message'); await page.selectOption('#hnCat', 'Wallet & payouts').catch(() => {}); await page.fill('#hnSubject', 'QA walk: payout question'); await page.fill('#hnBody', 'This is the QA walk testing the help desk. Line two.\nhttps://instantadpay.com/ledger'); await page.click('#hnSend'); await page.waitForTimeout(1500); await hide(page); helpRef = (/#help\?t=((?:IAP|LS)-\d+)/.exec(page.url()) || [])[1] || ''; if (!helpRef || !(await page.$('#hrSend'))) note('bug', L + 'my#help', 'new ticket did not open its thread: ' + page.url()); else { await page.fill('#hrBody', 'QA walk follow-up reply.'); await page.click('#hrSend'); await page.waitForTimeout(1200); const n = await page.$$eval('#helpBody .sup-msg', els => els.length).catch(() => 0); if (n < 2) note('bug', L + 'my#help', 'reply did not show in the thread (' + n + ' messages)'); await page.click('#helpBack'); await page.waitForTimeout(900); if (!(await page.$('#helpBody .sup-row[data-ref="' + helpRef + '"]'))) note('bug', L + 'my#help', 'ticket missing from the list'); await domChecks(page, L + 'my#help (ticket)'); console.log('ok Help pane ticket', helpRef); } flush(bag, L + 'my#help (ticket)'); await page.screenshot({ path: OUT + '/my-help-ticket.png' }).catch(() => {}); // theme switch (2026-11-01): the header control and the Profile card both exist, a click flips data-theme at once and saves to the account { const label = L + 'theme switch'; await page.evaluate(() => document.querySelectorAll('.chat-drawer,.modal-back,.lgate').forEach(m => m.hidden = true)); await page.click('.bo-menu [data-pane="profile"]'); await page.waitForTimeout(600); await hide(page); const seg = await page.$('#boTheme [data-theme="dark"]'); const prof = await page.$('#pane-profile .theme-seg [data-theme="light"]'); if (!seg) note('bug', label, 'no Light/Dark/Auto control in the member-area header'); if (!prof) note('bug', label, 'no Light/Dark/Auto control on the Profile pane'); if (seg && prof) { const saved1 = page.waitForResponse(r => r.url().includes('/api/my/profile'), { timeout: 10000 }).catch(() => null); await seg.click(); await saved1; await page.waitForTimeout(300); const t1 = await page.evaluate(() => [document.documentElement.getAttribute('data-theme'), localStorage.getItem('iap.theme')]); if (t1[0] !== 'dark' || t1[1] !== 'dark') note('bug', label, 'Dark did not apply (data-theme=' + t1[0] + ', iap.theme=' + t1[1] + ')'); await page.waitForTimeout(600); const acct = await (await page.request.get(LOCAL + '/api/me')).json(); if (acct.theme !== 'dark') note('bug', label, 'account did not store the theme (got ' + acct.theme + ')'); const onProfile = await page.evaluate(() => { const b = document.querySelector('#pane-profile .theme-seg [data-theme="dark"]'); return b && b.classList.contains('on'); }); if (!onProfile) note('bug', label, 'Profile control did not repaint after a header change'); const saved2 = page.waitForResponse(r => r.url().includes('/api/my/profile'), { timeout: 10000 }).catch(() => null); await prof.click(); await saved2; await page.waitForTimeout(300); const t2 = await page.evaluate(() => document.documentElement.getAttribute('data-theme')); if (t2 !== 'light') note('bug', label, 'Light from the Profile card did not apply (data-theme=' + t2 + ')'); const acct2 = await (await page.request.get(LOCAL + '/api/me')).json(); if (acct2.theme !== 'light') note('bug', label, 'account did not follow the Profile card (got ' + acct2.theme + ')'); if (acct2.username !== acct.username) note('bug', label, 'a theme save touched the username'); // restore the walk's theme so the remaining screenshots match the set await page.evaluate(t => { if (t) window.IAPTheme.set(t); else { localStorage.removeItem('iap.theme'); window.IAPTheme.apply(); } }, THEME); await page.evaluate(t => fetch('/api/my/profile', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ theme: t || null }) }).then(r => r.status), THEME); // awaited: a save still in flight would abort on the next navigation await page.waitForTimeout(400); } await page.screenshot({ path: OUT + '/my-profile-theme' + SUF + '.png' }).catch(() => {}); flush(bag, label); console.log('ok', label); } // public home, the member's wall and a campaign (join) page on the local copy, in this theme for (const p of ['/', '/wall/qawalker', '/join/qawalker', '/join/qawalker?v=instant']) { const label = L + p; await page.goto(LOCAL + p, { waitUntil: 'domcontentloaded' }).catch(e => note('bug', label, 'navigation failed: ' + e.message.slice(0, 120))); await page.waitForTimeout(1500); await hide(page); await domChecks(page, label); flush(bag, label); await page.screenshot({ path: OUT + '/public' + p.replace(/[^a-z0-9]+/gi, '-').replace(/-$/, '') + SUF + '.png', fullPage: p === '/' }).catch(() => {}); console.log('ok', label); } await page.goto(LOCAL + '/my', { waitUntil: 'load' }); await page.waitForTimeout(2500); await hide(page); // load, not networkidle: a signed-in member area keeps polling const chat = await page.$('#chatMenuBtn'); if (chat) { await chat.click(); await page.waitForTimeout(800); await domChecks(page, L + 'messages'); flush(bag, L + 'messages'); } const lo = await page.$('#logoutLink'); if (lo) { await lo.click(); await page.waitForTimeout(1000); } if (!(await page.$('#authArea:not([hidden])'))) note('bug', L + 'logout', 'auth card not shown after log out'); flush(bag, L + 'logout'); // admin await page.goto(LOCAL + '/admin', { waitUntil: 'networkidle' }); await page.fill('#adEmail', process.env.ADMIN_EMAIL || 'martybostick@gmail.com'); await page.click('#adSend'); await page.waitForSelector('#adVerify:not([hidden])'); await page.click('#adVerify'); await page.waitForTimeout(1200); for (const pn of ['overview', 'house', 'campaigns', 'members', 'support', 'reports', 'traffic', 'blog', 'releases', 'pnl', 'gamepass', 'kb', 'settings']) { const label = L + 'admin#' + pn; await page.click('.bo-menu [data-pane="' + pn + '"]'); await page.waitForTimeout(1200); const vis = await page.evaluate(id => { const el = document.getElementById('pane-' + id); return el && !el.hidden && el.offsetHeight > 40; }, pn); if (!vis) note('bug', label, 'pane did not render'); await domChecks(page, label); flush(bag, label); await page.screenshot({ path: OUT + '/admin-' + pn + SUF + '.png' }).catch(() => {}); console.log('ok', label); } // admin Support pane: the member's ticket is listed, opens, takes an internal note and a reply; the member then sees the reply and an unread badge if (helpRef) { await page.click('.bo-menu [data-pane="support"]'); await page.waitForTimeout(1000); if (!(await page.$('#spTable [data-spref="' + helpRef + '"]'))) note('bug', L + 'admin#support', 'ticket ' + helpRef + ' not in the open list'); const badge = await page.$eval('#supBadge', e => e.hidden ? '' : e.textContent).catch(() => ''); if (!badge) note('bug', L + 'admin#support', 'no open-count badge in the menu'); await page.click('#spTable [data-spref="' + helpRef + '"]').catch(() => {}); await page.waitForTimeout(1000); if (!(await page.$('#spBody'))) note('bug', L + 'admin#support', 'ticket view did not open'); else { if (!/member account/.test(await page.$eval('#spView', e => e.textContent))) note('bug', L + 'admin#support', 'requester not recognised as a member'); await page.check('#spInternal'); await page.fill('#spBody', 'QA internal note, never shown to the member.'); await page.click('#spSend'); await page.waitForTimeout(1000); await page.selectOption('#spTpl', '0').catch(() => {}); await page.waitForTimeout(200); if (!(await page.$eval('#spBody', e => e.value).catch(() => ''))) note('bug', L + 'admin#support', 'saved reply did not insert'); await page.click('#spSend'); await page.waitForTimeout(400); const ok = await page.$('#dlgOk'); if (ok) await ok.click(); else note('bug', L + 'admin#support', 'no in-page confirm before sending'); await page.waitForTimeout(1200); const txt = await page.$eval('#spView', e => e.textContent).catch(() => ''); if (!/internal note/.test(txt) || !/Waiting on member/.test(await page.$eval('#spSt', e => e.selectedOptions[0].textContent).catch(() => ''))) note('bug', L + 'admin#support', 'note/reply/status not reflected'); await page.selectOption('#spPr', 'high'); await page.waitForTimeout(800); await domChecks(page, L + 'admin#support (ticket)'); console.log('ok admin Support ticket', helpRef); // "Save as KB entry" under the reply: a prefilled knowledge-base draft (question from the member, answer from the reply) that saves flush(bag, L + 'admin#support (ticket)'); const save = await page.$('#spView [data-kbsave]'); if (!save) note('bug', L + 'admin#support', 'no "Save as KB entry" button under the sent reply'); else { await save.click(); await page.waitForTimeout(1200); const draft = await page.evaluate(() => ({ q: (document.getElementById('kbQs') || {}).value || '', a: (document.getElementById('kbAns') || {}).value || '', vis: !document.getElementById('kbEdit').hidden })); if (!draft.vis || !draft.q.trim() || !draft.a.trim()) note('bug', L + 'admin#kb', 'Save as KB entry did not open a prefilled draft ' + JSON.stringify(draft).slice(0, 160)); await domChecks(page, L + 'admin#kb (draft from ticket)'); await page.click('#kbSave'); await page.waitForTimeout(1200); const listed = await page.$eval('#kbTable', e => e.textContent).catch(() => ''); if (!/from a ticket/.test(listed)) note('bug', L + 'admin#kb', 'entry saved from the ticket is not in the list'); flush(bag, L + 'admin#kb (saved from ticket)'); console.log('ok admin Save as KB entry'); } } flush(bag, L + 'admin#support (ticket)'); await page.screenshot({ path: OUT + '/admin-support-ticket.png' }).catch(() => {}); await page.goto(LOCAL + '/admin#support?t=' + helpRef, { waitUntil: 'networkidle' }); await page.waitForTimeout(1000); if (!(await page.$('#spBody'))) note('bug', L + 'admin#support', 'deep link #support?t=<ref> did not open the ticket'); flush(bag, L + 'admin#support (deep link)'); } await page.click('.bo-menu [data-pane="house"]'); await page.waitForTimeout(500); for (const t of ['banner', 'text', 'login', 'solo', 'video', 'featured', 'visits']) { await page.selectOption('#hType', t); await page.waitForTimeout(120); } await page.selectOption('#hType', 'text'); await page.click('#hCreate'); await page.waitForTimeout(800); if (!(await page.$('#hErr:not([hidden])'))) note('warn', L + 'admin house form', 'empty submit showed no validation message'); flush(bag, L + 'admin house form'); // member sees Marty's reply: badge, thread without the internal note if (helpRef) { await page.goto(LOCAL + '/my', { waitUntil: 'networkidle' }); if (await page.$('#mcEmail:not([hidden])') && await page.$('#authArea:not([hidden])')) { await page.fill('#mcEmail', 'qa-walk@example.com'); await page.click('#mcSendBtn'); await page.waitForSelector('#mcVerifyBtn:not([hidden])'); await page.click('#mcVerifyBtn'); await page.waitForTimeout(2000); } await hide(page); await page.waitForTimeout(800); if (!(await page.$eval('#helpBadge', e => !e.hidden).catch(() => false))) note('bug', L + 'my#help', 'no unread badge after the admin replied'); await page.waitForTimeout(1500); await page.goto(LOCAL + '/my#help?t=' + helpRef); await page.waitForTimeout(1500); // same document: the hash change opens the ticket await hide(page); const th = await page.$eval('#helpBody', e => e.textContent).catch(() => ''); if (!/Marty, InstantAdPay support/.test(th)) note('bug', L + 'my#help', 'admin reply not shown to the member'); if (/QA internal note/.test(th)) note('bug', L + 'my#help', 'INTERNAL NOTE LEAKED to the member'); flush(bag, L + 'my#help (reply seen)'); console.log('ok member sees reply, no internal note'); } // public /support (signed out): the form, the guard, the private ticket link. Members only since 2026-10-24 (962cdf0): // a signed-out ticket needs an email that has an account (qa-walk@example.com signed up above); others get a 403 { const pctx = await browser.newContext({ viewport: { width: 390, height: 844 }, isMobile: true }); await pctx.addInitScript(() => { try { sessionStorage.setItem('iap.welcome.v1', '1'); } catch (e) {} }); const pp = await pctx.newPage(); const pbag = watch(pp, LOCAL); await pp.goto(LOCAL + '/support', { waitUntil: 'networkidle' }); await pp.waitForTimeout(800); await domChecks(pp, L + '/support'); if (!(await pp.$('#supForm'))) note('bug', L + '/support', 'form did not render'); else { await pp.fill('#supName', 'QA Visitor'); await pp.fill('#supEmail', 'qa-walk@example.com'); await pp.fill('#supSubject', 'QA: cannot sign in'); await pp.fill('#supBody', 'The sign-in code never arrives. QA walk.'); await pp.click('#supSend'); await pp.waitForTimeout(3500); const tl = await pp.$eval('#supMain a.btn[href^="/support/t/"]', e => e.getAttribute('href')).catch(() => ''); if (!tl) note('bug', L + '/support', 'no confirmation with a private ticket link: ' + (await pp.$eval('#supMsg', e => e.textContent).catch(() => ''))); else { await pp.goto(LOCAL + tl, { waitUntil: 'networkidle' }); await pp.waitForTimeout(800); if (!(await pp.$('#tkSend'))) note('bug', L + '/support/t', 'private ticket page did not render'); else { await pp.fill('#tkBody', 'Adding one more detail.'); await pp.click('#tkSend'); await pp.waitForTimeout(1000); if ((await pp.$$('.sup-msg')).length < 2) note('bug', L + '/support/t', 'reply on the private link did not show'); } await domChecks(pp, L + '/support/t'); console.log('ok /support + private link'); const bad = await pp.request.get(LOCAL + '/api/support/t/' + tl.split('/').pop().slice(0, -4) + 'AAAA'); if (bad.status() !== 404) note('bug', L + '/support/t', 'a tampered token was accepted: ' + bad.status()); } const nm = await pp.request.post(LOCAL + '/api/support', { data: { email: 'qa-visitor@example.com', name: 'QA', subject: 'QA: not a member', category: 'Other', body: 'Not a member, should be refused.', fage: 9000 } }); const nmj = await nm.json().catch(() => ({})); if (nm.status() !== 403 || !nmj.membersOnly) note('bug', L + '/api/support', 'a non-member email was not refused (members-only): ' + nm.status()); const bot = await pp.request.post(LOCAL + '/api/support', { data: { email: 'qa-walk@example.com', subject: 'x bot', body: 'bot body here', fts: Date.now(), fage: 10 } }); if (bot.status() !== 400) note('bug', L + '/api/support', 'instant (form-age 10ms) post was not refused: ' + bot.status()); } await pp.screenshot({ path: OUT + '/support-public.png' }).catch(() => {}); flush(pbag, L + '/support'); await pctx.close(); } await ctx.close(); } await browser.close(); const bugs = findings.filter(f => f.sev === 'bug'), warns = findings.filter(f => f.sev === 'warn'); const lines = ['===== QA WALK (' + MODE + ') ' + new Date().toISOString() + ' =====', 'bugs: ' + bugs.length + ' | warnings: ' + warns.length, ...findings.map(f => '[' + f.sev + '] ' + f.where + ' :: ' + f.what)]; console.log('\n' + lines.join('\n')); fs.writeFileSync(OUT + '/walk-report.txt', lines.join('\n') + '\n'); process.exit(bugs.length ? 1 : 0);