diff options
| author | Adam Soltys <[email protected]> | 2026-10-07 08:34:45 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-07 08:34:45 -0700 |
| commit | 8dfc629d129c6c1a8a3ed38a935e659eee9f67c7 (patch) | |
| tree | e85c955e7014e1cf4b22166077d41e3d5c2bc4bd /tools/moderation-test.js | |
| parent | 1d6786265f4d86b2260b30060df473a51774fb72 (diff) | |
| download | coinosv3-8dfc629d129c6c1a8a3ed38a935e659eee9f67c7.tar.gz coinosv3-8dfc629d129c6c1a8a3ed38a935e659eee9f67c7.zip | |
Feed tests: open the Feed from the bottom nav, on Following
The feed left the chat home for a bottom-nav tab, and a wallet with no
feed remembered opens on Popular, so these tests click the Feed tab and
seed Following as the wallet's last feed. Also brought up to date:
- feed-live: the pill lands on the oldest new post; arrivals at the top go
in above the first post (held still), not behind the pill; scroll up a
screen at a time (one jump lands before the windowed rows are back)
- feed-custom: only the feeds' chips are counted (not All/Images/…); the
follows box is not the first checkbox any more; the last feed is
remembered across a reload; the pack shows in the feed's editor (the chat
home no longer lists the feed)
- feed-follow: Feed tab + Following chip instead of the messages-home row;
the feed opens at ten posts (tall ones, so a page doesn't fill the screen)
- moderation: nos.lol is a local stand-in (a relay that won't connect held
the mute list back past the checks)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'tools/moderation-test.js')
| -rw-r--r-- | tools/moderation-test.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/moderation-test.js b/tools/moderation-test.js index 1f4deb8..d6df879 100644 --- a/tools/moderation-test.js +++ b/tools/moderation-test.js @@ -33,7 +33,12 @@ const REPLIES = [reply(OTHER, 'reply from ok person', 200), reply(MUTED, 'reply const LONG = 'buy the dip now, best exchange ever, sign up with my link and get free sats today!!!'; const html = await buildHtml({ minify: true, pwa: false }); -const server = Bun.serve({ port: 5299, fetch: () => new Response(html, { headers: { 'content-type': 'text/html' } }) }); +// nos.lol (one of the relays the mute list is read from) is a stand-in +// served here — an empty relay — so a real one that won't connect can't hold +// the list back past the checks +const server = Bun.serve({ port: 5299, + fetch: (req, srv) => (new URL(req.url).pathname === '/relay' && srv.upgrade(req) ? undefined : new Response(html, { headers: { 'content-type': 'text/html' } })), + websocket: { message: (ws, data) => { try { const m = JSON.parse(data); if (m[0] === 'REQ') ws.send(JSON.stringify(['EOSE', m[1]])); } catch {} } } }); const browser = await puppeteer.launch({ executablePath: '/usr/bin/google-chrome', headless: 'new', args: ['--no-sandbox'] }); const page = await browser.newPage(); await page.evaluateOnNewDocument((fx) => { @@ -46,6 +51,7 @@ await page.evaluateOnNewDocument((fx) => { ws.dispatchEvent(new MessageEvent('message', { data: JSON.stringify(['EOSE', id]) })); }, 0); window.WebSocket = function (...a) { + if (/^wss:\/\/nos\.lol\/?$/.test(String(a[0]))) a[0] = 'ws://localhost:5299/relay'; const ws = new Real(...a); const send = ws.send.bind(ws); ws.send = (data) => { @@ -96,9 +102,8 @@ const waitText = async (x, ms = 25000) => { for (let i = 0; i < ms / 250; i++) { const waitFor = async (fn, ms = 10000) => { for (let i = 0; i < ms / 250; i++) { if (await page.evaluate(fn)) return true; await sleep(250); } return false; }; const has = async (x) => (await text()).includes(x); const openFeed = async () => { - await page.evaluate(() => { const b = [...document.querySelectorAll('button')].find((e) => /message/i.test(e.getAttribute('aria-label') || '')); if (b) b.click(); }); - await sleep(800); - await page.evaluate(() => { const e = [...document.querySelectorAll('.item')].find((n) => (n.querySelector('.chat-name') || {}).textContent === 'Feed'); if (e) e.click(); }); + // the Feed is a tab in the bottom nav (it was a row on the chat home) + await page.evaluate(() => [...document.querySelectorAll('.app-nav-button')].find((b) => b.getAttribute('aria-label') === 'Feed')?.click()); await sleep(1200); }; @@ -122,6 +127,7 @@ try { await page.evaluate(([k, pk, ns]) => { localStorage.setItem(k + ':follows', JSON.stringify({ tags: [['p', pk]], c: '', at: Math.floor(Date.now() / 1000) })); localStorage.setItem(k + ':feedNotes', JSON.stringify(ns)); + localStorage.setItem('btc-wallet-feed:' + k, 'following'); // a wallet with no feed remembered opens on Popular }, [base, AUTHOR.pk, seeded]); await page.reload({ waitUntil: 'domcontentloaded' }); await waitText('receive', 20000); |
