"""Short (3s) MP4 export smoke test in headless Chromium -> /tmp/x.mp4""" import asyncio, base64 from playwright.async_api import async_playwright async def main(): async with async_playwright() as p: b = await p.chromium.launch(args=["--use-gl=angle","--use-angle=swiftshader","--enable-unsafe-swiftshader"]) pg = await b.new_page() pg.on("console", lambda m: print(m.text[:300]) if "INFO" in m.text or m.type=="error" else None) await pg.goto("http://localhost:5173/preview/production/ed5ba841-ed53-4eec-a8c5-93237d26b7ab/?xdebug=1") await pg.wait_for_function("window.__done === true", timeout=400000) d = await pg.evaluate("window.__mp4 || ''") if d: open("/tmp/x.mp4","wb").write(base64.b64decode(d)) await b.close() asyncio.run(main())