aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-28 22:41:01 -0700
committerAdam Soltys <[email protected]>2026-09-28 22:41:01 -0700
commit5676ffff812e2e1c3459d52128883b7494d5ebff (patch)
treeb2b0b3ae90520cda6e59f80043574195f5fd1736 /tools
parent615e8fa6ea643660ae6b6d35e669d6ad4816728a (diff)
downloadcoinosv3-5676ffff812e2e1c3459d52128883b7494d5ebff.tar.gz
coinosv3-5676ffff812e2e1c3459d52128883b7494d5ebff.zip
A quoted note that was slow to arrive turns into its card instead of staying a "view note" link.
A feed row keeps its first look, and a quote that missed the readiness gate froze as a link — with nothing asking for the note again. The frozen row now keeps asking (the existing 30s retry) and takes the card once the note and its own avatar/pictures are warm. quote-card-test: reach the feed through the bottom nav, seed the author's profile, and --slow drops the first ask for the quote to cover this. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Du1qT1wbkYwYK6zkGH79Rp
Diffstat (limited to 'tools')
-rw-r--r--tools/quote-card-test.js23
1 files changed, 20 insertions, 3 deletions
diff --git a/tools/quote-card-test.js b/tools/quote-card-test.js
index 27a1b22..91edf3b 100644
--- a/tools/quote-card-test.js
+++ b/tools/quote-card-test.js
@@ -30,6 +30,18 @@ const html = await buildHtml({ minify: true, pwa: false });
const server = Bun.serve({ port: 5269, fetch: () => new Response(html, { headers: { 'content-type': 'text/html' } }) });
const browser = await puppeteer.launch({ executablePath: '/usr/bin/google-chrome', headless: 'new', args: ['--no-sandbox'] });
const page = await browser.newPage();
+// --slow: the relays miss the quoted note the first time it is asked for
+// (ours was down for an evening once), so the row freezes with the fallback
+// link; the next ask, half a minute on, finds it.
+const SLOW_MS = 32000;
+await page.evaluateOnNewDocument((id) => {
+ const send = WebSocket.prototype.send;
+ const t0 = Date.now();
+ WebSocket.prototype.send = function (d) {
+ if (localStorage.getItem('__slowQuote') && typeof d === 'string' && d.includes(id) && d.startsWith('["REQ"') && Date.now() - t0 < 20000) return;
+ return send.call(this, d);
+ };
+}, target.id);
const click = (t) => page.evaluate((x) => { const e = [...document.querySelectorAll('button')].find((n) => n.textContent.trim().toLowerCase().includes(x)); if (e) { e.click(); return true; } return false; }, t);
const waitText = async (x, ms = 25000) => { for (let i = 0; i < ms/250; i++) { if ((await page.evaluate(() => document.body.innerText)).toLowerCase().includes(x)) return true; await sleep(250); } return false; };
try {
@@ -52,13 +64,18 @@ try {
localStorage.setItem(k + ':feedNotes', JSON.stringify([
{ id: 'd'.repeat(64), pubkey: pk, kind: 1, created_at: Math.floor(Date.now()/1000), content: 'what he said nostr:' + ref, tags: [] },
]));
+ localStorage.setItem(k + ':profiles', JSON.stringify({ [pk]: { name: 'Quoter', t: Date.now() } }));
}, [base, A, nevent]);
+ if (process.argv.includes('--slow')) await page.evaluate(() => localStorage.setItem('__slowQuote', '1'));
await page.reload({ waitUntil: 'domcontentloaded' });
await waitText('receive', 20000);
- await page.evaluate(() => { const b = [...document.querySelectorAll('button')].find((e) => /message/i.test(e.getAttribute('aria-label') || '')); if (b) b.click(); });
- await sleep(1000);
- await page.evaluate(() => { const e = [...document.querySelectorAll('.item')].find((n) => /feed/i.test(n.textContent)); if (e) e.click(); });
+ await page.evaluate(() => document.querySelector('.app-bottom-nav .app-nav-button').click());
await sleep(7000);
+ if (process.argv.includes('--slow')) {
+ for (let i = 0; i < 40 && !(await page.evaluate(() => document.body.innerText.includes('view note'))); i++) await sleep(250);
+ check('a late quote first paints as a link', await page.evaluate(() => document.body.innerText.includes('view note')));
+ await sleep(SLOW_MS + 4000);
+ }
const card = await page.evaluate(() => {
const q = document.querySelector('.quote-card');