My line: section pills and 10-row pages on every list
A sticky pill row at the top of My line jumps to each section (built from the cards marked data-jump; hidden cards get no pill; the one in view is lit). Every list on the page pages at 10: your line, downline levels, holding tank, coach directs, prospects, both link-stats tables; upline messages at 5. qa/line-pager.mjs checks it in a real browser. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+39
-3
@@ -236,6 +236,36 @@
|
||||
// opts per (default 25); tail: a selector for a drawer that follows its row and pages
|
||||
// with it; focus: a row predicate, opens on whichever page holds that row
|
||||
const PAGE_SIZE = 25;
|
||||
// My line is the longest page on the dashboard: its lists page at 10 (Marty, 2026-09-26)
|
||||
const LINE_PER = 10;
|
||||
// Section pills at the top of My line: one per visible card marked data-jump, the one in view lit up.
|
||||
// Cards that show or hide themselves (sponsor, upline messages) rebuild the row when they change.
|
||||
let lineJumpObs = null;
|
||||
function buildLineJump() {
|
||||
const nav = document.getElementById('lineJump'); const pane = document.getElementById('pane-line'); if (!nav || !pane) return;
|
||||
const cards = [...pane.querySelectorAll(':scope > .card[data-jump]')].filter(c => !c.hidden);
|
||||
nav.innerHTML = cards.map(c => '<button type="button" class="chip-t" data-jumpto="' + c.id + '">' + esc(c.dataset.jump) + '</button>').join('');
|
||||
nav.hidden = cards.length < 2;
|
||||
const top = document.querySelector('.bo-top'); nav.style.setProperty('--jumpTop', (top ? top.offsetHeight : 0) + 'px'); pane.style.setProperty('--jumpTop', (top ? top.offsetHeight : 0) + 'px');
|
||||
nav.querySelectorAll('[data-jumpto]').forEach(b => b.addEventListener('click', () => {
|
||||
const c = document.getElementById(b.dataset.jumpto); if (!c) return;
|
||||
c.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
nav.querySelectorAll('.chip-t').forEach(x => x.classList.toggle('on', x === b));
|
||||
}));
|
||||
if (lineJumpObs) lineJumpObs.disconnect();
|
||||
if ('IntersectionObserver' in window) {
|
||||
const seen = new Map();
|
||||
lineJumpObs = new IntersectionObserver(ents => {
|
||||
for (const e of ents) seen.set(e.target.id, e.isIntersecting ? e.boundingClientRect.top : null);
|
||||
let best = null; for (const [id, t] of seen) if (t != null && (best == null || t < seen.get(best))) best = id;
|
||||
if (best) { nav.querySelectorAll('.chip-t').forEach(x => x.classList.toggle('on', x.dataset.jumpto === best)); const on = nav.querySelector('.chip-t.on'); if (on && nav.scrollWidth > nav.clientWidth) nav.scrollLeft = on.offsetLeft - 16; }
|
||||
}, { rootMargin: '-120px 0px -55% 0px' });
|
||||
cards.forEach(c => lineJumpObs.observe(c));
|
||||
}
|
||||
}
|
||||
{ const pane = document.getElementById('pane-line');
|
||||
if (pane && 'MutationObserver' in window) new MutationObserver(() => buildLineJump()).observe(pane, { subtree: false, childList: false, attributes: true, attributeFilter: ['hidden'] });
|
||||
if (pane) pane.querySelectorAll(':scope > .card[data-jump]').forEach(c => { if ('MutationObserver' in window) new MutationObserver(() => buildLineJump()).observe(c, { attributes: true, attributeFilter: ['hidden'] }); }); }
|
||||
const PAGE_AT = {};
|
||||
function pageList(key, host, rowSel, opts) {
|
||||
if (!host) return; opts = opts || {}; const per = opts.per || PAGE_SIZE;
|
||||
@@ -602,7 +632,7 @@
|
||||
+ '<td>' + new Date(r.joined).toLocaleDateString() + '</td>'
|
||||
+ '<td><span class="badge' + (r.status === 'joined free' ? ' amber' : '') + '">' + r.status + '</span></td></tr>').join('');
|
||||
wrap.appendChild(t);
|
||||
pageList('roster', wrap, 'table.roster tr');
|
||||
pageList('roster', wrap, 'table.roster tr', { per: LINE_PER });
|
||||
}
|
||||
// overview recent-activity widget: chain events + line joins, newest first
|
||||
try {
|
||||
@@ -697,7 +727,7 @@
|
||||
if (name === 'earn') setEarnSub(earnSub); // refresh whichever sub-tab is active
|
||||
else if (vidState.token) stopVideo();
|
||||
if (name === 'profile') loadLineBanner();
|
||||
if (name === 'line') { loadLineage(); loadUplineMessages(); loadCoach(); loadLinkStats(); loadProspects(); }
|
||||
if (name === 'line') { buildLineJump(); loadLineage(); loadUplineMessages(); loadCoach(); loadLinkStats(); loadProspects(); }
|
||||
if (name === 'campaigns') ['cTarget', 'cImage', 'cVideoUrl'].forEach(id => { if ($(id)) $(id).value = ''; }); // no residual URL between visits
|
||||
if (name === 'training') loadTraining();
|
||||
if (name === 'pipeline') loadPipeline();
|
||||
@@ -1457,6 +1487,7 @@
|
||||
+ '<span class="em">joined ' + ago(w.joined) + '</span>'
|
||||
+ '<span class="dt">last sign-in: <b>' + ago(w.lastSeen) + '</b></span>'
|
||||
+ (r.eligible ? '<button class="btn small" type="button" data-adopt="' + esc(w.username || w.email) + '" data-aname="' + esc(w.name) + '">Adopt</button>' : '') + '</div>').join('');
|
||||
pageList('tank', el, ':scope > .lin-row', { per: LINE_PER });
|
||||
el.querySelectorAll('[data-adopt]').forEach(b => b.addEventListener('click', async () => {
|
||||
const note = await IAP.ask({ title: 'Adopt ' + b.dataset.aname, text: 'Your first message to ' + b.dataset.aname + ' (sent as a chat and an email):', type: 'textarea', ok: 'Adopt and send', value: 'Hi, I picked you up from the InstantAdPay holding tank so you have a sponsor who will actually help. Reply here and I will walk you through the first three steps.' });
|
||||
if (note === null) return;
|
||||
@@ -1548,6 +1579,7 @@
|
||||
+ (x.free && x.address ? ' <button class="btn small" type="button" title="Pay it forward: send POL from your wallet to theirs for their first package" data-pif="' + esc(x.email) + '" data-pname="' + esc(x.name) + '" data-paddr="' + esc(x.address) + '">PIF</button>' : '')
|
||||
+ (x.free && x.rescue ? ' <button class="btn sec small" type="button" title="Reached them by phone, text or in person? Mark it so the rescue clock resets." data-contacted="' + esc(x.email) + '" data-cname="' + esc(x.name) + '">Contacted them</button>' : '')
|
||||
+ (x.free ? ' <button class="btn sec small" type="button" title="Pay it forward: give this free member to the holding tank so another member can coach them" data-release="' + esc(x.email) + '" data-rname="' + esc(x.name) + '">Release to tank</button>' : '') + '</div>').join('');
|
||||
pageList('coach', el, ':scope > .lin-row', { per: LINE_PER });
|
||||
el.querySelectorAll('[data-contacted]').forEach(b => b.addEventListener('click', async () => {
|
||||
try { await api('/api/my/tank/contacted', { email: b.dataset.contacted }); IAP.status('Marked: you have contacted ' + b.dataset.cname + '.', 'ok'); loadCoach(); }
|
||||
catch (e) { IAP.status(e.message, 'bad'); }
|
||||
@@ -1610,7 +1642,9 @@
|
||||
st.innerHTML = src.length ? '<tr><th>Source</th><th>Views (30d)</th><th>Views (all)</th><th>Joined</th><th>Qualifying buyers</th></tr>'
|
||||
+ src.map(x => '<tr><td>' + esc(x.source) + '</td><td class="mono">' + x.views30 + '</td><td class="mono">' + x.views + '</td><td class="mono">' + x.joins + '</td><td class="mono">' + x.buyers + '</td></tr>').join('')
|
||||
: '<tr><td class="muted small">Sources appear as visits arrive.</td></tr>';
|
||||
pageList('linksrc', st.parentElement, 'table tr:has(td)', { per: LINE_PER });
|
||||
}
|
||||
pageList('linkangles', t.parentElement, 'table tr:has(td)', { per: LINE_PER });
|
||||
} catch (e) {}
|
||||
}
|
||||
// ── prospects: the member's own follow-up list ──
|
||||
@@ -1704,6 +1738,7 @@
|
||||
+ '<input type="date" class="small" data-pnext="' + p.id + '" value="' + (p.nextTs ? new Date(p.nextTs).toISOString().slice(0, 10) : '') + '">'
|
||||
+ '<button class="btn sec small" type="button" data-pdel="' + p.id + '">Remove</button></div>'; }).join('');
|
||||
const save = async (id, patch) => { const p = list.find(x => x.id === Number(id)); if (!p) return; try { await api('/api/my/prospects', Object.assign({}, p, patch)); } catch (e) { IAP.status(e.message, 'bad'); } };
|
||||
pageList('prospects', el, ':scope > .lin-row', { per: LINE_PER });
|
||||
el.querySelectorAll('[data-pstatus]').forEach(s => s.addEventListener('change', () => save(s.dataset.pstatus, { status: s.value })));
|
||||
el.querySelectorAll('[data-pnext]').forEach(i => i.addEventListener('change', () => save(i.dataset.pnext, { next: i.value, nextTs: i.value ? Date.parse(i.value + 'T12:00:00') : null })));
|
||||
el.querySelectorAll('[data-pdel]').forEach(b => b.addEventListener('click', async () => { try { await api('/api/my/prospects/remove', { id: b.dataset.pdel }); loadProspects(); } catch (e) { IAP.status(e.message, 'bad'); } }));
|
||||
@@ -1768,7 +1803,7 @@
|
||||
b.addEventListener('click', () => openConvo(b.dataset.cemail, b.dataset.cname)));
|
||||
el.querySelectorAll('[data-act]').forEach(b => b.addEventListener('click', () => toggleLineActivity(b)));
|
||||
const focusRef = LINE_FOCUS_REF ? LINE_FOCUS_REF.replace(/"/g, '') : null;
|
||||
el.querySelectorAll('.lin-lvl').forEach((lv, i) => pageList('line-' + i, lv, ':scope > .lin-row', { tail: '.lin-act', focus: focusRef ? row => !!row.querySelector('[data-act="' + focusRef + '"]') : null }));
|
||||
el.querySelectorAll('.lin-lvl').forEach((lv, i) => pageList('line-' + i, lv, ':scope > .lin-row', { per: LINE_PER, tail: '.lin-act', focus: focusRef ? row => !!row.querySelector('[data-act="' + focusRef + '"]') : null }));
|
||||
if (LINE_FOCUS_REF) {
|
||||
const ref = LINE_FOCUS_REF; LINE_FOCUS_REF = null;
|
||||
const b = el.querySelector('[data-act="' + ref.replace(/"/g, '') + '"]');
|
||||
@@ -1813,6 +1848,7 @@
|
||||
+ '<div style="display:flex;justify-content:space-between;gap:10px"><b>' + esc(i.subject) + '</b>'
|
||||
+ '<span class="small muted">' + esc(i.fromName) + ' · ' + new Date(i.sent).toLocaleDateString() + '</span></div>'
|
||||
+ '<div class="ib-rich" style="margin-top:8px">' + (i.body || '') + '</div></div>').join('');
|
||||
pageList('upmsg', list, ':scope > .promo-block', { per: 5 });
|
||||
// opening the pane marks them read
|
||||
for (const i of r.items) if (!i.read) fetch('/api/my/messages/' + i.id + '/read', { method: 'POST' }).catch(() => {});
|
||||
} catch (e) {}
|
||||
|
||||
@@ -790,3 +790,11 @@ img{max-width:100%}
|
||||
/* Five Dollar Friday strip (landing) */
|
||||
.fdf{margin:18px auto 0;max-width:760px;padding:12px 16px;border-radius:12px;background:rgba(67,232,195,.08);border:1px solid rgba(67,232,195,.35);color:var(--ink,#eafffa);font-size:14px;line-height:1.5;text-align:center}
|
||||
.fdf a{color:#43e8c3;font-weight:600}
|
||||
|
||||
/* My line: section pills, sticky under the top bar (Marty, 2026-09-26) */
|
||||
.line-jump{position:sticky;top:var(--jumpTop,64px);z-index:4;margin:0 0 14px;padding:10px 0;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;
|
||||
background:rgba(6,10,8,.88);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);border-bottom:1px solid var(--line)}
|
||||
.line-jump::-webkit-scrollbar{display:none}
|
||||
.line-jump .chip-t{flex:none;white-space:nowrap}
|
||||
#pane-line > .card[data-jump]{scroll-margin-top:calc(var(--jumpTop,64px) + 64px)}
|
||||
.tablewrap > .pgr{margin-top:10px}
|
||||
|
||||
+14
-12
@@ -5,7 +5,7 @@
|
||||
<title>Member area | InstantAdPay</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&display=swap">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=20260925a">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=20260926a">
|
||||
</head>
|
||||
<body class="bo-body">
|
||||
|
||||
@@ -289,13 +289,15 @@
|
||||
</div>
|
||||
|
||||
<div class="pane" id="pane-line" hidden>
|
||||
<div class="card" id="sponsorMsgCard" hidden>
|
||||
<!-- section pills (Marty, 2026-09-26): built from the cards marked data-jump; hidden cards get no pill -->
|
||||
<div class="chips line-jump" id="lineJump" role="navigation" aria-label="Jump to a section of My line"></div>
|
||||
<div class="card" id="sponsorMsgCard" data-jump="Sponsor" hidden>
|
||||
<h3>Your sponsor has your back</h3>
|
||||
<p class="muted small">Questions getting started? Message your sponsor <b id="sponsorMsgName"></b> directly.
|
||||
If they are online you chat live; if not, it lands in their inbox and they are notified.</p>
|
||||
<p><button class="btn" id="lineMsgSponsor" type="button">Message your sponsor</button></p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card" id="lineInviteCard" data-jump="Invite link">
|
||||
<h3>Your invite link, live from day one</h3>
|
||||
<p class="muted small">Share it anywhere, starting now. Everyone who joins through it becomes part of
|
||||
your line, and you earn 50 percent of every ad package they ever buy, plus levels 2 and 3 as you
|
||||
@@ -307,34 +309,34 @@
|
||||
</p>
|
||||
<p class="muted small" id="pitchPreview" hidden></p>
|
||||
</div>
|
||||
<div class="card" id="linkStatsCard">
|
||||
<div class="card" id="linkStatsCard" data-jump="Link stats">
|
||||
<h3>Your links: what is working</h3>
|
||||
<p class="muted small">Views, joins and qualifying buyers for each hook. Add <span class="mono">?v=instant</span>, <span class="mono">?v=adspend</span>, <span class="mono">?v=free</span>, <span class="mono">?v=ledger</span> or <span class="mono">?v=two</span> to the end of your link to pick the hook the page opens with.</p>
|
||||
<div class="tablewrap"><table id="linkStatsTable" class="small"></table></div>
|
||||
<p class="muted small" style="margin:14px 0 6px"><b>Where your visitors came from</b> (referring site of the first visit; "direct" is a typed or pasted link, a text message, or an email)</p>
|
||||
<div class="tablewrap"><table id="linkSrcTable" class="small"></table></div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card" id="lineRosterCard" data-jump="Your line">
|
||||
<h3>Your line</h3>
|
||||
<p class="muted small">Everyone who joined through your link, newest first. When they buy their
|
||||
first package of $20 or more, they count toward your qualification.</p>
|
||||
<div id="rosterWrap"><p class="muted small" id="rosterEmpty">Nobody yet. Your link is ready above; share it and this list starts filling.</p></div>
|
||||
</div>
|
||||
<div class="card" id="tankCard">
|
||||
<div class="card" id="tankCard" data-jump="Holding tank">
|
||||
<div class="card-head"><h3>Holding tank</h3><span class="sub" id="tankSub">members who arrived with no sponsor</span></div>
|
||||
<p class="muted small">People who joined without a sponsor wait here. Adopt one and you become their sponsor: a chat opens, they get an email with your message, and their first purchase binds to you on the contract. First come. At most <b id="tankCap">2</b> open adoptions at a time, and an adoption goes back to the tank after <b id="tankTtl">7</b> days if they have not linked a wallet or bought.</p>
|
||||
<p class="small" id="tankWhy" hidden></p>
|
||||
<div id="tankMine"></div>
|
||||
<div id="tankList"><p class="muted small">Loading…</p></div>
|
||||
</div>
|
||||
<div class="card" id="coachCard">
|
||||
<div class="card" id="coachCard" data-jump="Coach directs">
|
||||
<h3>Coach your directs</h3>
|
||||
<p class="muted small"><b>Reach your free referrals.</b> If there is no message from you to a free referral for 10 days, you get a warning; at 14 days they move to the holding tank so someone else can help them. A chat, a nudge, or tapping <b>Contacted them</b> resets the clock. Nothing on-chain ever moves.</p>
|
||||
<p class="muted small">Where each person you referred sits on the ladder, who has gone quiet, and what to say next. <b>Nudge</b> opens a chat with the message already written; edit it if you like, then send. Quiet members also get one automatic reminder email per step from InstantAdPay, so your nudge is the personal one.</p>
|
||||
<p class="small" id="coachSummary"></p>
|
||||
<div id="coachList"><p class="muted small">Loading…</p></div>
|
||||
</div>
|
||||
<div class="card" id="prospectCard">
|
||||
<div class="card" id="prospectCard" data-jump="Prospects">
|
||||
<h3>People you have talked to</h3>
|
||||
<p class="muted small">Your own follow-up list. Add anyone you mentioned InstantAdPay to, give them a status and a follow-up day, and the next conversation stays in front of you. Only you can see this.</p>
|
||||
<form id="prospectForm" style="display:flex;gap:8px;flex-wrap:wrap;align-items:flex-end;margin:0 0 12px">
|
||||
@@ -347,14 +349,14 @@
|
||||
<div id="prospectList"><p class="muted small">Nobody on the list yet.</p></div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card" id="lineDownCard" data-jump="Downline">
|
||||
<h3>Your downline, three levels deep</h3>
|
||||
<p class="muted small">Everyone below you across levels 1–3. The POL figure is what each person has paid you so far, straight from the ledger. You see email addresses for your
|
||||
direct referrals only; deeper levels show username and ID. Message your direct referrals right here.</p>
|
||||
<div id="lineageWrap"><p class="muted small">Loading…</p></div>
|
||||
</div>
|
||||
|
||||
<div class="card" id="broadcastCard">
|
||||
<div class="card" id="broadcastCard" data-jump="Message team">
|
||||
<h3>Message your team</h3>
|
||||
<p class="muted small">Send one broadcast a day to your downline. It lands in their on-site inbox
|
||||
and their email. Reaches the people who joined under you — they can't opt out of their sponsor,
|
||||
@@ -379,7 +381,7 @@
|
||||
<span class="small muted" id="bcHint"></span></p>
|
||||
</div>
|
||||
|
||||
<div class="card" id="upMsgCard" hidden>
|
||||
<div class="card" id="upMsgCard" data-jump="Upline messages" hidden>
|
||||
<h3>Messages from your upline</h3>
|
||||
<div id="upList"></div>
|
||||
</div>
|
||||
@@ -1079,7 +1081,7 @@
|
||||
<script src="/assets/common.js?v=20260923b"></script><script src="/assets/welcome.js?v=20260923b"></script>
|
||||
<script src="/assets/wallet.js?v=20260911a"></script>
|
||||
<script src="/assets/promo.js?v=20260925a"></script>
|
||||
<script src="/assets/my.js?v=20260926a"></script>
|
||||
<script src="/assets/my.js?v=20260926b"></script>
|
||||
<script src="/assets/chat.js?v=20260907l"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
// My line: section pills + 10-row pages (Marty, 2026-09-26). Boots a throwaway server, makes a member
|
||||
// with 23 prospects, then checks in a real browser that the prospect list pages at 10, the pager moves,
|
||||
// and a section pill scrolls its card into view. Screenshots in qa/out/line-*.png.
|
||||
// node qa/line-pager.mjs
|
||||
import { spawn } from 'node:child_process';
|
||||
import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
const PW = process.env.PW || 'D:/Projects/MarketingAgent/qa-tester/node_modules/playwright/index.js';
|
||||
const { chromium } = (await import('file:///' + PW.replace(/^\/+/, ''))).default;
|
||||
const PORT = 8798, B = 'http://127.0.0.1:' + PORT;
|
||||
const DATA = path.join(os.tmpdir(), 'iap-line-pager-' + Date.now()); fs.mkdirSync(DATA, { recursive: true });
|
||||
const ok = [], bad = []; const t = (n, c, x) => (c ? ok : bad).push(n + (c || !x ? '' : ' -> ' + x));
|
||||
const srv = spawn(process.execPath, ['server.js'], { env: { ...process.env, PORT: String(PORT), DATA_DIR: DATA, ADMIN_PASSWORD: 'localtest', ADMIN_EMAIL: 'admin@example.com', NODE_ENV: 'test' }, stdio: 'ignore' });
|
||||
const bye = c => { try { srv.kill(); } catch (e) {} fs.rmSync(DATA, { recursive: true, force: true }); process.exit(c); };
|
||||
for (let i = 0; i < 60; i++) { try { if ((await fetch(B + '/api/stats')).ok) break; } catch (e) {} await new Promise(r => setTimeout(r, 500)); }
|
||||
const DEV = 'c0ffee00c0ffee00c0ffee00c0ffee00';
|
||||
const jf = async (p, body, cookie) => { const r = await fetch(B + p, { method: body ? 'POST' : 'GET', headers: { 'Content-Type': 'application/json', Cookie: cookie }, body: body ? JSON.stringify(body) : undefined }); return { r, b: await r.json().catch(() => ({})) }; };
|
||||
const st = await jf('/api/auth/email/start', { email: 'pager@example.com', fts: Date.now() - 20000 }, 'iap.dev=' + DEV);
|
||||
const code = st.b.devCode || st.b.code; if (!code) { console.log('no dev code'); bye(2); }
|
||||
const vf = await jf('/api/auth/email/verify', { email: 'pager@example.com', code }, 'iap.dev=' + DEV);
|
||||
const sc = vf.r.headers.getSetCookie ? vf.r.headers.getSetCookie() : [vf.r.headers.get('set-cookie')];
|
||||
const jar = ['iap.dev=' + DEV, ...sc.map(c => String(c).split(';')[0])].join('; ');
|
||||
for (let i = 1; i <= 23; i++) await jf('/api/my/prospects', { name: 'Prospect ' + String(i).padStart(2, '0'), contact: 'p' + i + '@example.com', status: 'talking' }, jar);
|
||||
const pl = await jf('/api/my/prospects', null, jar); t('23 prospects seeded', (pl.b.prospects || []).length === 23, (pl.b.prospects || []).length);
|
||||
|
||||
const br = await chromium.launch(); const ctx = await br.newContext({ viewport: { width: 1280, height: 900 } });
|
||||
await ctx.addCookies(jar.split('; ').map(kv => { const [name, ...v] = kv.split('='); return { name, value: v.join('='), url: B }; }));
|
||||
await ctx.addInitScript(() => { try { sessionStorage.setItem('iap.welcome.v1', '1'); } catch (e) {} });
|
||||
const page = await ctx.newPage();
|
||||
await page.goto(B + '/my#line', { waitUntil: 'networkidle' }); await page.waitForTimeout(1500);
|
||||
// any onboarding modal out of the way
|
||||
for (const sel of ['#unameSkip', '[data-close]', '.modal .x']) { try { await page.click(sel, { timeout: 800 }); } catch (e) {} }
|
||||
await page.evaluate(() => { document.querySelectorAll('.modal-back,.lgate,.iap-welcome').forEach(m => m.hidden = true); const b = document.querySelector('[data-pane="line"]'); if (b) b.click(); }); await page.waitForTimeout(2500);
|
||||
const pills = await page.$$eval('#lineJump [data-jumpto]', xs => xs.map(x => x.textContent));
|
||||
t('section pills are built from the visible cards', pills.length >= 7 && pills.includes('Prospects') && pills.includes('Downline'), JSON.stringify(pills));
|
||||
t('hidden cards get no pill', !pills.includes('Sponsor') || await page.$eval('#sponsorMsgCard', e => !e.hidden), JSON.stringify(pills));
|
||||
await page.screenshot({ path: 'qa/out/line-top.png' });
|
||||
const vis = async () => page.$$eval('#prospectList > .lin-row', xs => xs.filter(x => !x.hidden).map(x => x.querySelector('.nm').textContent.trim()));
|
||||
const p1 = await vis(); t('prospects: 10 on page 1', p1.length === 10, p1.length);
|
||||
const bar = await page.$eval('#prospectList .pgr-n', e => e.textContent).catch(() => ''); t('pager says 1-10 of 23', /1.10\s*of 23/.test(bar), bar);
|
||||
await page.click('#lineJump [data-jumpto="prospectCard"]'); await page.waitForTimeout(1200);
|
||||
const top = await page.$eval('#prospectCard', e => e.getBoundingClientRect().top); t('the Prospects pill scrolls the card to the top (below the sticky bars)', top > 60 && top < 260, Math.round(top));
|
||||
const lit = await page.$eval('#lineJump .chip-t.on', e => e.dataset.jumpto).catch(() => ''); t('the Prospects pill is lit', lit === 'prospectCard', lit);
|
||||
const pillsTop = await page.$eval('#lineJump', e => e.getBoundingClientRect().top); t('the pill row stays stuck at the top while scrolled', pillsTop >= 0 && pillsTop < 120, Math.round(pillsTop));
|
||||
await page.screenshot({ path: 'qa/out/line-prospects.png' });
|
||||
await page.click('#prospectList .pgr-btn:last-child'); await page.waitForTimeout(800);
|
||||
const p2 = await vis(); t('Next shows 11-20', p2.length === 10 && p2[0] !== p1[0], p2[0]);
|
||||
await page.click('#prospectList .pgr-btn:last-child'); await page.waitForTimeout(800);
|
||||
const p3 = await vis(); t('the last page shows the remaining 3', p3.length === 3, p3.length);
|
||||
await page.screenshot({ path: 'qa/out/line-page3.png' });
|
||||
// phone width: the pill row scrolls sideways, the page does not
|
||||
const ph = await br.newContext({ viewport: { width: 390, height: 844 } }); await ph.addCookies(jar.split('; ').map(kv => { const [name, ...v] = kv.split('='); return { name, value: v.join('='), url: B }; }));
|
||||
await ph.addInitScript(() => { try { sessionStorage.setItem('iap.welcome.v1', '1'); } catch (e) {} });
|
||||
const pp = await ph.newPage(); await pp.goto(B + '/my#line', { waitUntil: 'networkidle' }); await pp.waitForTimeout(1200);
|
||||
await pp.evaluate(() => { document.querySelectorAll('.modal-back,.lgate,.iap-welcome').forEach(m => m.hidden = true); const b = document.querySelector('[data-pane="line"]'); if (b) b.click(); }); await pp.waitForTimeout(2000);
|
||||
const over = await pp.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth); t('phone: no sideways page scroll', over <= 1, over);
|
||||
await pp.screenshot({ path: 'qa/out/line-phone.png' });
|
||||
await br.close();
|
||||
console.log(ok.map(x => ' ok ' + x).join('\n')); if (bad.length) console.log(bad.map(x => ' FAIL ' + x).join('\n'));
|
||||
console.log(bad.length ? '\nFAILURES: ' + bad.length : '\nLINE PAGER: ALL PASS'); bye(bad.length ? 1 : 0);
|
||||
Reference in New Issue
Block a user