From 86d9818abfc160dac031bb292abe28d6f28fc624 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 7 Oct 2026 12:02:51 -0700 Subject: Browser tests: public relays answered in the page, never reached A suite run let ~90 throwaway test wallets subscribe and publish on public relays from one home address, and nos.lol and relay.damus.io banned it. tools/puppeteer.js wraps puppeteer-core: every socket to a non-local host gets an in-page stand-in relay (EVENT -> OK, REQ -> EOSE). Tests that read real content launch with { relays: 'read' } (real reads, publishes answered in place); feed-live, chat-layout and cordn-ui launch with { relays: 'live' }. LIVE_RELAYS=read|1|host,... overrides per run. profile-key-qr: measure the QR again if a repaint swapped it out. Co-Authored-By: Claude Opus 5.5 --- tools/emoji-test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools/emoji-test.js') diff --git a/tools/emoji-test.js b/tools/emoji-test.js index d661329..c91cec0 100644 --- a/tools/emoji-test.js +++ b/tools/emoji-test.js @@ -4,7 +4,7 @@ // installs the pack. Read-only: nothing is posted. // // Run: bun tools/emoji-test.js [screenshot.png] -import puppeteer from 'puppeteer-core'; +import puppeteer from './puppeteer.js'; import { generateMnemonic } from '@scure/bip39'; import { wordlist } from '@scure/bip39/wordlists/english'; import { buildHtml } from '../build.js'; @@ -16,7 +16,7 @@ const check = (n, c, d = '') => { console.log(` ${c ? '✓' : '✗'} ${n}${d ? ' const html = await buildHtml({ minify: true, pwa: false }); const server = Bun.serve({ port: 5231, 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 browser = await puppeteer.launch({ relays: 'read', executablePath: '/usr/bin/google-chrome', headless: 'new', args: ['--no-sandbox'] }); const page = await browser.newPage(); page.on('pageerror', (e) => console.log(' [pageerror]', e.message)); const click = (sel, t) => page.evaluate((s, x) => { const e = [...document.querySelectorAll(s)].find((n) => n.textContent.trim().toLowerCase().includes(x.toLowerCase())); if (e) { e.click(); return true; } return false; }, sel, t); -- cgit v1.2.3