import { chromium } from '@playwright/test'; const b = await chromium.launch({ executablePath: '/usr/bin/chromium' }); const p = await b.newPage(); await p.addInitScript({ path: '/mnt/vault/dev/golang/yellowjacket/.playwright/init-events.js' }); await p.goto('http://localhost:34115', { waitUntil: 'load' }); await p.evaluate(() => window.__yjEvents.ready(30000)); const out = await p.evaluate(async () => { const time = async (label, path, args, n = 5) => { const ms = []; for (let i = 0; i < n; i++) { const t0 = performance.now(); await window.__yjEvents.call(path, args, 60000); ms.push(performance.now() - t0); } ms.sort((a, b) => a - b); return { label, medianMs: Math.round(ms[Math.floor(n / 2)]), all: ms.map((m) => Math.round(m)) }; }; return [ await time('GetTrackTable(0)', 'library.Library.GetTrackTable', [0], 4), await time('GetAlbums(0)', 'library.Library.GetAlbums', [0], 4), await time('SearchLocal(tide)', 'explore.Service.SearchLocal', ['tide'], 4), await time('SearchLocal(rock)', 'explore.Service.SearchLocal', ['rock'], 4), await time('SearchTracks(tide)', 'library.Library.SearchTracks', ['tide', 0], 4), ]; }); console.log(JSON.stringify(out, null, 1)); await b.close();