aboutsummaryrefslogtreecommitdiffstats
path: root/tools/link-preview-test.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-07 12:02:51 -0700
committerAdam Soltys <[email protected]>2026-10-07 12:02:51 -0700
commit86d9818abfc160dac031bb292abe28d6f28fc624 (patch)
treea96983d60fb0f4dcb92a04c7aba50761da05cf9f /tools/link-preview-test.js
parentb415b1fb31bd734619e1da3c88ca7e3822151c87 (diff)
downloadcoinosv3-86d9818abfc160dac031bb292abe28d6f28fc624.tar.gz
coinosv3-86d9818abfc160dac031bb292abe28d6f28fc624.zip
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 <[email protected]>
Diffstat (limited to 'tools/link-preview-test.js')
-rw-r--r--tools/link-preview-test.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/link-preview-test.js b/tools/link-preview-test.js
index 0b9e863..52ddca1 100644
--- a/tools/link-preview-test.js
+++ b/tools/link-preview-test.js
@@ -4,7 +4,7 @@
// nothing to say stays a bare link; pictures and YouTube keep their own
// boxes.
// Run: bun tools/link-preview-test.js
-import puppeteer from 'puppeteer-core';
+import puppeteer from './puppeteer.js';
import { cacheKeyFor } from '../src/wallet.js';
import { generateSecretKey, getPublicKey, finalizeEvent } from 'nostr-tools/pure';
import { privateKeyFromSeedWords } from 'nostr-tools/nip06';
@@ -37,7 +37,7 @@ const server = Bun.serve({ port: 5311, fetch: (req) => {
if (u.pathname.startsWith('/punks') || u.pathname === '/verify-worker.js') return new Response(Bun.file('dist' + u.pathname));
return 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();
await page.evaluateOnNewDocument((posts, profile) => {
// the registrar's preview endpoint answers from this test's server