| 1 | import { chromium } from 'playwright'; |
| 2 | const BASE = process.env.BASE || 'https://code.elffuss.com'; |
| 3 | const b = await chromium.launch({ args: ['--autoplay-policy=no-user-gesture-required'] }); |
| 4 | const ctx = await b.newContext(); |
| 5 | await ctx.addInitScript(() => { try { localStorage.setItem('elffusscode.model', 'rules'); } catch {} }); |
| 6 | const p = await ctx.newPage(); |
| 7 | const hits = []; |
| 8 | p.on('response', r => { |
| 9 | const u = r.url(); |
| 10 | if (/sndcdn|soundcloud/i.test(u) && /\.(mp3|m4a|ts|aac)|media\/|stream/i.test(u)) hits.push({ url: u, type: r.headers()['content-type'], status: r.status() }); |
| 11 | }); |
| 12 | await p.goto(BASE + '/?test-opfs', { waitUntil: 'domcontentloaded' }); |
| 13 | await p.waitForTimeout(1500); |
| 14 | await p.click('#activity img'); |
| 15 | console.log('esperando audio…'); |
| 16 | await p.waitForTimeout(8000); |
| 17 | console.log('hits:', JSON.stringify(hits.slice(0, 15), null, 2)); |
| 18 | await b.close(); |