Help desk: support tickets for members (Help pane), the public /support page with private ticket links, chatbot hand-off, and an admin Support pane
- tickets.js: one shared desk (platform iap now, linkspin later), dual-mode store (MySQL tables tickets + ticket_messages, else support.json); refs IAP-<1000+id> / LS-; private no-login link /support/t/<ref>.<HMAC> signed with DATA_DIR/support.key (or SUPPORT_SECRET); ingestEmail() ready for the support@ intake step (threads by Message-ID, then [ref] in the subject from the same sender) - Member Help pane (/my#help): list with status + unread badge, new ticket (category, subject, message, up to 2 screenshots via /api/my/upload), thread + reply (a reply reopens a closed ticket) - Public /support: name, email, category, subject, message behind the sign-up walls (honeypot, form age, per-IP limits with the icon check, global cap) plus a per-email cap; confirmation email with the ref and the private link - Chatbot: CANNED + systemPrompt know the help desk; answers that cannot help (or "talk to a human") offer "Send this to support", which files the last turns as a ticket (members: Help pane; signed out: email + the same guard) - Admin Support pane: open / waiting / closed / all, platform, category, search; open-count badge; ticket view with requester account info, internal notes, status/priority/category, saved replies (site setting supportTemplates); deep link /admin#support?t=<ref> - Notifications: new ticket / member reply -> Telegram to Marty's private chat only (supportTelegramChat, default 1289244227, site bot then Hermes fallback, never a group or the Discord relay) + email to ADMIN_EMAIL, max one per ticket per 10 min; Marty's reply -> email "[IAP-1042] subject" + a 'notice' inbox message for members, bursts batched - support* settings are kept out of /api/config; Support link in the site footer, home footer, member page foot, terms and privacy; "Contact support" errors point at /support - QA walk: member Help ticket flow, admin Support pane + deep link, internal-note leak check, public /support + private link + tampered token + form-age refusal - Cache tags: common.js 20261016a, chat.js 20261016a, my.js 20261016r, admin.js 20261016sp, support.js 20261016a Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+95
-3
@@ -61,7 +61,7 @@ if (MODE === 'public' || MODE === 'all') {
|
||||
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', '/nope-404'];
|
||||
'/admin', '/my', '/shorts', '/presentation', '/presentation?ref=martbost', '/support', '/nope-404'];
|
||||
for (const p of PUBLIC) {
|
||||
const label = 'LIVE ' + p;
|
||||
try {
|
||||
@@ -101,7 +101,7 @@ if (MODE === 'member' || MODE === 'all') {
|
||||
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', 'games', 'wallet', 'profile'];
|
||||
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);
|
||||
@@ -147,6 +147,29 @@ if (MODE === 'member' || MODE === 'all') {
|
||||
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(() => {});
|
||||
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');
|
||||
@@ -154,7 +177,7 @@ if (MODE === 'member' || MODE === 'all') {
|
||||
// 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', 'reports', 'traffic', 'blog', 'releases', 'pnl', 'gamepass', 'settings']) {
|
||||
for (const pn of ['overview', 'house', 'campaigns', 'members', 'support', 'reports', 'traffic', 'blog', 'releases', 'pnl', 'gamepass', '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);
|
||||
@@ -163,11 +186,80 @@ if (MODE === 'member' || MODE === 'all') {
|
||||
await page.screenshot({ path: OUT + '/admin-' + pn + '.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);
|
||||
}
|
||||
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
|
||||
{
|
||||
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-visitor@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 bot = await pp.request.post(LOCAL + '/api/support', { data: { email: 'qa-bot@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();
|
||||
|
||||
Reference in New Issue
Block a user