diff options
Diffstat (limited to 'tools/mention-ac-test.js')
| -rw-r--r-- | tools/mention-ac-test.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/mention-ac-test.js b/tools/mention-ac-test.js index 52ba1ef..04d7e12 100644 --- a/tools/mention-ac-test.js +++ b/tools/mention-ac-test.js @@ -2,7 +2,7 @@ // people — the ones you follow first, then the search — and picking one puts // nostr:npub… in the text; the post goes out with their p tag. // Run: bun tools/mention-ac-test.js -import puppeteer from './puppeteer.js'; +import puppeteer, { seedWords, skipSeedCheck } from './puppeteer.js'; import { cacheKeyFor } from '../src/wallet.js'; import { generateSecretKey, getPublicKey } from 'nostr-tools/pure'; import { npubEncode } from 'nostr-tools/nip19'; @@ -59,9 +59,9 @@ try { await page.reload({ waitUntil: 'domcontentloaded' }); await sleep(400); await click('create a new wallet'); await sleep(600); - await page.waitForSelector('.words .w .t'); + await seedWords(page); const mn = (await page.$$eval('.words .w .t', (l) => l.map((e) => e.textContent.trim()))).join(' '); - await click('skip verification'); + await skipSeedCheck(page); await waitText('receive', 20000); await sleep(3000); // a new wallet's starter follows land first; ours go over them const base = cacheKeyFor(mn + '\n'); @@ -106,11 +106,16 @@ try { await sleep(300); check('...and on a second line, in place', /\ncc nostr:npub1[a-z0-9]+ $/.test(await value()) && !(await value()).includes('@glo'), JSON.stringify((await value()).slice(-90))); + // a name typed out in full and never picked from the list + await page.keyboard.type('ty @globetrotter and @nobody9 ok'); + await sleep(300); + console.log('\n[posting]'); await page.evaluate(() => { window.__published = []; [...document.querySelectorAll('.post-actions button')].find((b) => /^post$/i.test(b.textContent.trim())).click(); }); await waitFor(() => window.__published.some((e) => e.kind === 1), 8000); const ev = (await page.evaluate(() => window.__published)).find((e) => e.kind === 1); check('the post carries both p tags', !!ev && [FRIEND, STRANGER].every((pk) => ev.tags.some((x) => x[0] === 'p' && x[1] === pk)), JSON.stringify(ev && ev.tags)); + check('a followed name typed out, not picked, goes out as their npub', !!ev && ev.content.endsWith('ty nostr:' + npubEncode(FRIEND) + ' and @nobody9 ok'), JSON.stringify(ev && ev.content.slice(-110))); check('no page errors', errs.length === 0, errs.slice(0, 2).join(' | ')); } finally { await browser.close(); server.stop(true); } console.log(ok ? '\n✅ @mentions suggest people and tag them' : '\n❌ failed'); |
