Holding tank: 24-hour sign-up grace plus a Who invited you box, the same rules as InstantAdPay (Marty 2026-11-07: "24-hour grace plus the prompt"). One network tank, so both sites behave the same.
Grace: for 24 hours from an account's created time nobody can adopt the person by hand: an Opens in badge, no Adopt button, a plain refusal from adopt(). Auto-assign keeps its clock from the wallet link, so the 24-hour hold is not stretched. The wallet-ready post waits for the grace and says the time really left, is skipped when the rotation takes them in that tick, the arrivals post moves to when the grace ends (marks.claim per member), and the Overview note and weekly email count only people who are open. Prompt: LinkSpin members land on the Control Room, not the /tools Overview, so the box sits at the top of every Control Room screen, /tools included (cr-shell.js). Same checks as InstantAdPay, through setSponsor as a deliberate change with by 'invited', so it follows and clears the hold. With a wallet already linked the engine switches payouts on under the named sponsor right away, as an adoption does, and the confirm box says so first. Nobody invited me hides it everywhere and a small link on /tools brings it back. The named sponsor gets the referral email and an on-site notice (new hooks.notify). Chatbot canned + systemPrompt, KNOWLEDGE_DATE 2026-11-07. cr-shell.js, common.js, credits-screen.js, my.js, admin.js, admin-sponsorcheck.js ?v=20261107tg. qa/tank-hold.test.mjs and qa/sponsorfollow.test.cjs extended; qa/run.sh member now runs tank-hold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -65,6 +65,7 @@ elif [ "$MODE" = "launchweek" ]; then
|
||||
node qa/launchweek.test.cjs || 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/tank-hold.test.mjs || status=1
|
||||
node qa/profile-policy.test.cjs || status=1
|
||||
elif [ "$MODE" = "policy" ]; then
|
||||
node qa/profile-policy.test.cjs || status=1
|
||||
|
||||
@@ -173,6 +173,31 @@ async function network() {
|
||||
assert.strictEqual(P.chats.length, 1); assert.strictEqual(Q.chats.length, 0, 'no chat on the quiet side');
|
||||
const qr = await Q.tank.adopt('other@x.co', 'lead'); assert.ok(qr.error, 'cannot be adopted twice across the network');
|
||||
});
|
||||
await t('Who invited you: the member names a sponsor on one platform, the other follows and agrees (2026-11-07)', async () => {
|
||||
const P = platform('instantadpay', 'linkspin'), Q = platform('linkspin', 'instantadpay'); people(P, Q);
|
||||
const r = await P.tank.nameSponsor('lead@x.co', 'adopter'); assert.ok(r.ok, JSON.stringify(r));
|
||||
assert.strictEqual(P.store.get('lead@x.co').by, 'invited');
|
||||
const s = await settle(P, Q, ['lead@x.co', 'adopter@x.co']);
|
||||
assert.strictEqual(s.moves, 1); assert.strictEqual(await spOf(Q, 'lead@x.co'), 'adopter@x.co');
|
||||
assert.ok(!(await Q.tank.waiting()).some(w => w.email === 'lead@x.co'), 'gone from the other waiting list');
|
||||
assert.strictEqual(Q.store.get('lead@x.co').by, 'invited'); assert.strictEqual(Q.store.get('lead@x.co').origin, 'instantadpay');
|
||||
assert.ok((await Q.tank.adopt('other@x.co', 'lead')).error, 'nobody adopts them on the other side');
|
||||
assert.ok((await Q.tank.nameSponsor('lead@x.co', 'otheradopter')).error, 'the other side refuses a second name');
|
||||
});
|
||||
await t('Who invited you: a bound member on the other platform keeps that sponsor; reported, not moved', async () => {
|
||||
const P = platform('instantadpay', 'linkspin'), Q = platform('linkspin', 'instantadpay'); people(P, Q);
|
||||
Q.bound.add('lead@x.co');
|
||||
const r = await P.tank.nameSponsor('lead@x.co', 'adopter'); assert.ok(r.ok, JSON.stringify(r));
|
||||
const { d } = await deliver(P, Q, 'lead@x.co');
|
||||
assert.strictEqual(d.action, 'bound'); assert.strictEqual(await spOf(Q, 'lead@x.co'), null);
|
||||
});
|
||||
await t('sign-up grace holds on both platforms', async () => {
|
||||
const P = platform('instantadpay', 'linkspin'), Q = platform('linkspin', 'instantadpay'); people(P, Q);
|
||||
for (const X of [P, Q]) X.accounts.add('fresh@x.co', { username: 'fresh', created: Date.now() });
|
||||
for (const X of [P, Q]) assert.ok(/less than 24 hours/.test((await X.tank.adopt('adopter@x.co', 'fresh')).error || ''), X.name);
|
||||
assert.strictEqual(await spOf(P, 'fresh@x.co'), null); assert.strictEqual(await spOf(Q, 'fresh@x.co'), null);
|
||||
});
|
||||
|
||||
await t('ping-pong guard: the applied change comes back as "same" and settles in one round trip', async () => {
|
||||
const P = platform('instantadpay', 'linkspin'), Q = platform('linkspin', 'instantadpay'); people(P, Q);
|
||||
await P.tank.adopt('adopter@x.co', 'lead');
|
||||
|
||||
@@ -190,12 +190,157 @@ async function partA() {
|
||||
}
|
||||
|
||||
// ---------------- Part B ----------------
|
||||
// ---------------- Sign-up grace + "Who invited you?" (Marty approved 2026-11-07) ----------------
|
||||
async function partGrace() {
|
||||
console.log('-- Sign-up grace + Who invited you: tank.js with a mocked clock');
|
||||
const M = 60000;
|
||||
{ // hand adoption: blocked for 24 hours from created, open after, old members untouched
|
||||
const B = bench(); const { tank, accounts, env } = B; const t0 = env.now;
|
||||
B.buyer('ad@x.co', 11);
|
||||
accounts.add('new@x.co', { created: t0 - H }); accounts.add('old@x.co');
|
||||
const w = await tank.waiting(); const row = w.find(x => x.email === 'new@x.co');
|
||||
ok(row && row.opensAt === t0 + 23 * H, 'waiting(): new sign-up carries opensAt = created + 24 h', JSON.stringify(row));
|
||||
ok(w.find(x => x.email === 'old@x.co').opensAt === 0, 'waiting(): an old account is open now');
|
||||
ok(w[w.length - 1].email === 'new@x.co', 'waiting(): grace members sort after the open ones');
|
||||
ok((await tank.adoptable()).every(x => x.email !== 'new@x.co'), 'adoptable() leaves out grace members (Overview note, weekly email)');
|
||||
const r = await tank.adopt('ad@x.co', 'new', 'hi');
|
||||
ok(r.error && /less than 24 hours/.test(r.error) && /23 h 0 min/.test(r.error), 'grace blocks a hand adoption with a plain message', JSON.stringify(r));
|
||||
ok(!(await accounts.byEmail('new@x.co')).sponsorRef, '...and writes no sponsor');
|
||||
ok(!B.mails.length && !B.chats.length, '...and tells nobody');
|
||||
env.now = t0 + 23 * H - M;
|
||||
ok((await tank.adopt('ad@x.co', 'new', 'hi')).error, 'still blocked one minute before it opens');
|
||||
env.now = t0 + 23 * H + M;
|
||||
const r2 = await tank.adopt('ad@x.co', 'new', 'hi');
|
||||
ok(r2.ok, 'opens after 24 hours', JSON.stringify(r2));
|
||||
const r3 = await tank.adopt('ad@x.co', 'old', 'hi');
|
||||
ok(r3.ok, 'an old account is adoptable at once (back in the tank later = no grace)', JSON.stringify(r3));
|
||||
}
|
||||
{ // wallet in the first hour: hand adoption opens at 24 h, the safety net keeps its own clock
|
||||
const B = bench(); const { tank, accounts, env } = B; const t0 = env.now;
|
||||
B.buyer('ad@x.co', 11); B.buyer('ad2@x.co', 12);
|
||||
accounts.add('w@x.co', { created: t0 });
|
||||
env.now = t0 + H; accounts._by.get('w@x.co').address = addr(); accounts._by.get('w@x.co').lastSeen = env.now;
|
||||
const t1 = await tank.readyTick();
|
||||
ok(t1.fresh.length === 0, 'wallet in the first hour: no "adopt them" notice during the grace', JSON.stringify(t1.fresh));
|
||||
const h = await tank.holdFor(await accounts.byEmail('w@x.co'));
|
||||
ok(h.hold.since === t0 + H && h.hold.until === t0 + 25 * H, 'the hold clock runs from the wallet link, not stretched by the grace', JSON.stringify(h.hold));
|
||||
env.now = t0 + 23 * H; ok((await tank.readyTick()).fresh.length === 0, 'still no notice at 23 hours');
|
||||
ok((await tank.adopt('ad@x.co', 'w', 'hi')).error, 'hand adoption refused at 23 hours');
|
||||
env.now = t0 + 24 * H + M; for (const em of ['ad@x.co', 'ad2@x.co']) accounts._by.get(em).lastSeen = env.now;
|
||||
const t2 = await tank.readyTick();
|
||||
ok(t2.fresh.length === 1 && t2.fresh[0].until === t0 + 25 * H && !t2.assigned.length, 'grace over: notice once, with the real end of the hold', JSON.stringify(t2.fresh));
|
||||
ok(tank.leftText(t2.fresh[0].until - env.now) === '59 min', 'the notice text can say the time really left', tank.leftText(t2.fresh[0].until - env.now));
|
||||
ok((await tank.readyTick()).fresh.length === 0, '...and not twice');
|
||||
env.now = t0 + 25 * H - 10 * M;
|
||||
const t3 = await tank.readyTick();
|
||||
ok(t3.assigned.length === 1 && t3.assigned[0].adoptee === 'w@x.co', 'the rotation takes them inside 24 hours of the wallet link', JSON.stringify(t3.assigned));
|
||||
}
|
||||
{ // wallet in the first minutes: the rotation fires just before the grace ends, no notice ever goes out
|
||||
const B = bench(); const { tank, accounts, env } = B; const t0 = env.now;
|
||||
B.buyer('ad@x.co', 11);
|
||||
accounts.add('fast@x.co', { created: t0, address: addr() });
|
||||
env.now = t0 + 5 * M; ok((await tank.readyTick()).fresh.length === 0, 'wallet in minute 5: no notice');
|
||||
env.now = t0 + 24 * H - 5 * M; accounts._by.get('ad@x.co').lastSeen = env.now;
|
||||
const t = await tank.readyTick();
|
||||
ok(t.assigned.length === 1 && t.fresh.length === 0, 'auto path unaffected: assigned inside the grace (24 h from the wallet link), no adopt notice', JSON.stringify({ a: t.assigned, f: t.fresh }));
|
||||
ok((await accounts.byEmail('fast@x.co')).sponsorRef === 'ad', 'the safety net wrote the sponsor');
|
||||
}
|
||||
{ // grace ends in the last tick of the hold: the safety net takes them, nobody is told to adopt someone already gone
|
||||
const B = bench(); const { tank, accounts, env } = B; const t0 = env.now;
|
||||
B.buyer('ad@x.co', 11);
|
||||
accounts.add('mid@x.co', { created: t0 });
|
||||
env.now = t0 + 10 * M; accounts._by.get('mid@x.co').address = addr(); await tank.readyTick();
|
||||
env.now = t0 + 24 * H + M; accounts._by.get('ad@x.co').lastSeen = env.now; // 9 minutes of hold left: inside the last tick
|
||||
const t = await tank.readyTick();
|
||||
ok(t.assigned.length === 1 && t.fresh.length === 0, 'no notice for someone the rotation takes in the same tick', JSON.stringify({ a: t.assigned, f: t.fresh }));
|
||||
}
|
||||
{ // the arrivals post: announced when the grace ends
|
||||
const B = bench(); const { tank, env } = B; const t0 = env.now;
|
||||
const list = [{ email: 'a', joined: t0 - 24 * H - 5 * M }, { email: 'b', joined: t0 - 24 * H - 20 * M }, { email: 'c', joined: t0 - H }];
|
||||
ok(tank.openedSince(list, t0 - 15 * M).map(x => x.email).join() === 'a', 'openedSince: only people whose grace ended since the last check');
|
||||
}
|
||||
{ // Who invited you: every refusal, nothing written
|
||||
const B = bench(); const { tank, accounts, env } = B; const t0 = env.now;
|
||||
B.buyer('boss@x.co', 21);
|
||||
accounts.add('m@x.co', { username: 'mm1', created: t0 });
|
||||
accounts.add('kid@x.co', { username: 'kid', sponsorRef: 'mm1' }); // joined under m: a loop
|
||||
accounts.add('free@x.co', { username: 'free' }); // no payouts, nobody above them
|
||||
accounts.add('under@x.co', { username: 'under', sponsorRef: 'boss' }); // no payouts, but boss above them
|
||||
accounts.add('has@x.co', { username: 'hassp', sponsorRef: 'boss' });
|
||||
accounts.add('bound@x.co', { username: 'bound1', memberId: 55 });
|
||||
const say = async (e, who) => { const r = await tank.nameSponsor(e, who); return r.error || ''; };
|
||||
ok(/Type the username/.test(await say('m@x.co', ' ')), 'refused: empty');
|
||||
ok(/That is you/.test(await say('m@x.co', '@MM1')), 'refused: self (any case, leading @)');
|
||||
ok(/No member here/.test(await say('m@x.co', 'nosuchname')), 'refused: unknown username');
|
||||
ok(/No member here/.test(await say('m@x.co', 'bad name!')), 'refused: not a username');
|
||||
ok(/already have a sponsor/.test(await say('has@x.co', 'boss')), 'refused: already sponsored');
|
||||
ok(/locked on the contract/.test(await say('bound@x.co', 'boss')), 'refused: member id');
|
||||
ok(/in your own line/.test(await say('m@x.co', 'kid')), 'refused: chain loop (inDownlineOf)');
|
||||
ok(/nobody above them/.test(await say('m@x.co', 'free')), 'refused: nobody on the contract in that line (would fall to the company)');
|
||||
B.blocked.add(21);
|
||||
ok(/cannot take new members/.test(await say('m@x.co', 'boss')), 'refused: no-payout chain');
|
||||
B.blocked.delete(21);
|
||||
ok(!(await accounts.byEmail('m@x.co')).sponsorRef && !B.mails.length, 'no refusal wrote a sponsor or sent a notice');
|
||||
const c = await tank.nameSponsor('m@x.co', 'boss', { check: true });
|
||||
ok(c.ok && c.name === '@boss' && !(await accounts.byEmail('m@x.co')).sponsorRef && !B.mails.length, 'check mode validates and writes nothing', JSON.stringify(c));
|
||||
ok((await tank.nameSponsor('m@x.co', 'under', { check: true })).ok, 'a sponsor with no payouts but someone above them on the contract is allowed');
|
||||
B.net['m2@x.co'] = { sponsorEmail: 'boss@x.co', via: 'email' };
|
||||
accounts.add('m2@x.co', { username: 'mm2' });
|
||||
const al = await tank.nameSponsor('m2@x.co', 'under');
|
||||
ok(al.error && al.aligned && (await accounts.byEmail('m2@x.co')).sponsorRef === 'boss', 'the sponsor the network already knows comes first', JSON.stringify(al));
|
||||
}
|
||||
{ // Who invited you: success
|
||||
const B = bench(); const { tank, accounts, env } = B; const t0 = env.now;
|
||||
B.buyer('boss@x.co', 21); B.buyer('ad@x.co', 22);
|
||||
accounts.add('m@x.co', { username: 'mm1', created: t0 });
|
||||
const m0 = await accounts.byEmail('m@x.co');
|
||||
ok(tank.inviteAsk(m0) && tank.inviteAsk(m0).dismissed === false, 'inviteAsk: the card shows for a tank member');
|
||||
ok(tank.inviteAsk(await accounts.byEmail('boss@x.co')) === null, 'inviteAsk: no card for a member with a sponsor line / member id');
|
||||
tank.dismissInvite('m@x.co');
|
||||
ok(tank.inviteAsk(m0).dismissed === true, 'Nobody invited me: card dismissed');
|
||||
ok(!(await accounts.byEmail('m@x.co')).sponsorRef && (await tank.waiting()).some(w => w.email === 'm@x.co'), '...nothing else changes: still in the tank');
|
||||
const r = await tank.nameSponsor('m@x.co', '@Boss');
|
||||
ok(r.ok && r.name === '@boss', 'prompt success', JSON.stringify(r));
|
||||
const a = await accounts.byEmail('m@x.co');
|
||||
ok(a.sponsorRef === 'boss', 'sponsor written');
|
||||
ok((await tank.holdFor(a)) === null && tank.inviteAsk(a) === null, 'hold gone, card gone');
|
||||
ok(!(await tank.waiting()).some(w => w.email === 'm@x.co'), 'out of the waiting list');
|
||||
ok(B.mails.length === 1 && B.mails[0].to === 'boss@x.co' && /new referral/.test(B.mails[0].subject), 'the named sponsor gets the notice, nobody else', JSON.stringify(B.mails.map(x => x.to)));
|
||||
ok(!B.chats.length, 'no chat written in the sponsor\'s name');
|
||||
const v = await tank.adminView(); const rec = v.adoptions.find(x => x.adoptee === 'm@x.co');
|
||||
ok(rec && rec.status === 'invited' && rec.adopter === 'boss@x.co', 'admin record: status invited');
|
||||
ok((await tank.summaryFor('m@x.co')) === null, 'not an adoption: nothing counts toward the two, nothing open on the other site');
|
||||
const again = await tank.nameSponsor('m@x.co', 'ad');
|
||||
ok(/already have a sponsor/.test(again.error || '') && (await accounts.byEmail('m@x.co')).sponsorRef === 'boss', 'a second name is refused');
|
||||
env.now = t0 + 8 * 86400000; await tank.sweep();
|
||||
ok((await accounts.byEmail('m@x.co')).sponsorRef === 'boss', 'no 7-day window: still theirs after a week');
|
||||
}
|
||||
{ // a ready member names someone: the hold record clears the way an adoption does, no auto-assign
|
||||
const B = bench(); const { tank, accounts, env } = B; const t0 = env.now;
|
||||
B.buyer('boss@x.co', 21); B.buyer('ad@x.co', 22);
|
||||
accounts.add('r@x.co', { username: 'rr1', created: t0, address: addr() });
|
||||
await tank.readyTick();
|
||||
ok(tank.readyRec('r@x.co'), 'setup: on the 24-hour clock');
|
||||
const r = await tank.nameSponsor('r@x.co', 'boss');
|
||||
ok(r.ok && !tank.readyRec('r@x.co'), 'the hold record clears', JSON.stringify(r));
|
||||
env.now = t0 + 24 * H;
|
||||
for (const em of ['boss@x.co', 'ad@x.co']) accounts._by.get(em).lastSeen = env.now;
|
||||
ok(!(await tank.readyTick()).assigned.length && (await accounts.byEmail('r@x.co')).sponsorRef === 'boss', 'the rotation leaves them alone');
|
||||
await sleep(40);
|
||||
ok(B.sends.length === 1 && B.sends[0].sponsorId === 21, 'wallet linked: the engine switches payouts on under the named sponsor, same as an adoption', JSON.stringify(B.sends));
|
||||
const B2 = bench(); B2.buyer('boss@x.co', 21); const w = addr(); B2.accounts.add('c@x.co', { username: 'cc1', address: w }); B2.onchain.set(w, 77);
|
||||
ok(/locked on the contract/.test((await B2.tank.nameSponsor('c@x.co', 'boss')).error || ''), 'refused: wallet already on the contract, member number not saved yet');
|
||||
}
|
||||
}
|
||||
|
||||
async function partB() {
|
||||
console.log('-- Part B: local copy + mock InstantAdPay');
|
||||
const PORT = Number(process.env.TANKHOLD_PORT || 8803), IAPPORT = PORT + 1;
|
||||
const BASE = 'http://127.0.0.1:' + PORT; const ADMIN_PW = 'localtest-th';
|
||||
const DATA = fs.mkdtempSync(path.join(os.tmpdir(), 'ls-tankhold-srv-')); fs.mkdirSync(path.join(DATA, 'uploads'));
|
||||
const SECRET = crypto.randomBytes(24).toString('hex'); // throwaway
|
||||
{ const a = { email: 'qa-sponsor@example.com', pass: null, sponsorRef: '', code: 'cqasp1', username: 'qasponsor', address: null, created: Date.now() - 30 * 86400000, lastSeen: Date.now() - H, memberId: 42 }; // a member with a contract position, for the Who invited you checks
|
||||
fs.writeFileSync(path.join(DATA, 'accounts.json'), JSON.stringify({ v: 2, byEmail: { [a.email]: a }, byAddress: {}, byCode: { [a.code]: a.email }, joins: 0, positions: {} })); }
|
||||
const iapRows = {}; let factsCalls = 0;
|
||||
const mock = http.createServer((req, res) => { let d = ''; req.on('data', c => d += c); req.on('end', () => {
|
||||
const sig = crypto.createHmac('sha256', SECRET).update(String(req.headers['x-ls-ts'] || '') + '\n' + d).digest('hex');
|
||||
@@ -281,6 +426,48 @@ async function partB() {
|
||||
ok(!st.act && st.buy && !st.hold, 'Credits: no Switch on payouts button, Buy still there, no hold box on the buy side', JSON.stringify(st));
|
||||
try { fs.mkdirSync(path.join(SITE, 'qa/out'), { recursive: true }); await page.screenshot({ path: path.join(SITE, 'qa/out/tank-hold-credits.png'), fullPage: true }); } catch (e) {}
|
||||
ok(!errs.length, 'no page errors', errs.join(' | ').slice(0, 200));
|
||||
{ // Who invited you + the sign-up grace, on the real pages (2026-11-07)
|
||||
const nc = await signIn('qa-new@example.com'); await req('POST', '/api/my/profile', { cookie: nc, body: { username: 'qanewone' } });
|
||||
const m0 = (await req('GET', '/api/me', { cookie: nc })).json;
|
||||
ok(m0 && m0.inviteAsk && m0.inviteAsk.dismissed === false, '/api/me: inviteAsk for a tank member', JSON.stringify(m0 && m0.inviteAsk));
|
||||
const sc = await signIn('qa-sponsor@example.com');
|
||||
const tv = (await req('GET', '/api/my/tank', { cookie: sc })).json; const row6 = tv && tv.waiting.find(w => w.email === 'qa-new@example.com');
|
||||
ok(row6 && row6.opensAt > Date.now(), '/api/my/tank: a new sign-up is listed with opensAt', JSON.stringify(row6));
|
||||
const bad = await req('POST', '/api/my/tank/invited', { cookie: nc, body: { who: 'nosuchname' } });
|
||||
ok(bad.status === 400 && /No member here/.test(bad.json.error), 'POST invited: unknown username refused', JSON.stringify(bad.json));
|
||||
const self = await req('POST', '/api/my/tank/invited', { cookie: nc, body: { who: 'qanewone' } });
|
||||
ok(self.status === 400 && /That is you/.test(self.json.error), 'POST invited: self refused', JSON.stringify(self.json));
|
||||
ok((await req('POST', '/api/my/tank/invited', { body: { who: 'qasponsor' } })).status === 401, 'POST invited: signed out refused');
|
||||
const c2 = await browser.newContext({ viewport: { width: 390, height: 900 } });
|
||||
await c2.addInitScript(() => { try { sessionStorage.setItem('ls.la', '1'); } catch (e) {} });
|
||||
await c2.addCookies(nc.split('; ').filter(Boolean).map(kv => { const i = kv.indexOf('='); return { name: kv.slice(0, i), value: kv.slice(i + 1), domain: '127.0.0.1', path: '/' }; }));
|
||||
const pg = await c2.newPage(); pg.on('pageerror', e => errs.push(e.message));
|
||||
await pg.goto(BASE + '/links', { waitUntil: 'load' }); await pg.waitForSelector('#crInvite', { timeout: 15000 }).catch(() => {});
|
||||
const has = sel => pg.evaluate(s => !!document.querySelector(s), sel);
|
||||
ok(await has('#inviteWho'), 'Control Room (/links): Who invited you box shows');
|
||||
const over = await pg.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);
|
||||
ok(over <= 0, 'no sideways scroll at phone width', String(over));
|
||||
await pg.screenshot({ path: path.join(SITE, 'qa/out/tank-invite-card.png') }).catch(() => {});
|
||||
await pg.fill('#inviteWho', 'nosuchname'); await pg.click('#inviteGo'); await pg.waitForTimeout(700);
|
||||
ok(/No member here/.test(await pg.textContent('#inviteMsg')), 'box: the refusal shows in the box');
|
||||
await pg.click('#inviteNo'); await pg.waitForTimeout(500);
|
||||
ok(!(await has('#crInvite')), 'Nobody invited me: gone from the screen');
|
||||
await pg.goto(BASE + '/links', { waitUntil: 'load' }); await pg.waitForTimeout(2500);
|
||||
ok(!(await has('#crInvite')), 'stays gone on the next screen');
|
||||
await pg.goto(BASE + '/tools', { waitUntil: 'load' }); await pg.waitForSelector('#inviteBack', { timeout: 15000 }).catch(() => {});
|
||||
ok(await has('#inviteBack'), '/tools: the small link is there');
|
||||
await pg.click('#inviteBack'); await pg.fill('#inviteWho', '@qasponsor'); await pg.click('#inviteGo'); await pg.waitForSelector('#dlgNo', { timeout: 5000 });
|
||||
await pg.click('#dlgNo'); await pg.waitForTimeout(400);
|
||||
ok(!(await req('GET', '/api/me', { cookie: nc })).json.sponsorName, 'box: Not them writes nothing');
|
||||
await pg.click('#inviteGo'); await pg.waitForSelector('#dlgOk', { timeout: 5000 }); await pg.click('#dlgOk'); await pg.waitForTimeout(3000);
|
||||
const m1 = (await req('GET', '/api/me', { cookie: nc })).json;
|
||||
ok(m1 && m1.sponsorName === '@qasponsor' && !m1.inviteAsk, 'box: yes sets the sponsor, the box is gone', JSON.stringify({ n: m1 && m1.sponsorName, a: m1 && m1.inviteAsk }));
|
||||
ok(!(await has('#crInvite')), 'box: gone after the reload');
|
||||
const adm6 = (await req('GET', '/api/admin/tank', { headers: ADMIN })).json;
|
||||
ok(adm6.adoptions.some(a => a.adoptee === 'qa-new@example.com' && a.status === 'invited'), 'admin tank: the invited record shows');
|
||||
await c2.close();
|
||||
ok(!errs.length, 'no page errors (Who invited you)', errs.join(' | ').slice(0, 200));
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (browser) await browser.close().catch(() => {});
|
||||
@@ -291,6 +478,7 @@ async function partB() {
|
||||
}
|
||||
|
||||
await partA();
|
||||
await partGrace();
|
||||
if (process.argv[2] !== 'unit') await partB();
|
||||
console.log(fails ? '\n' + fails + ' FAILED' : '\nall passed');
|
||||
process.exit(fails ? 1 : 0);
|
||||
|
||||
Reference in New Issue
Block a user