// test.jsconst{chromium}=require('playwright-core');(async()=>{constbrowser=awaitchromium.launch({args:['--no-sandbox','--disable-setuid-sandbox'],});constcontext=awaitbrowser.newContext({recordVideo:{dir:'/app/videos/'},ignoreHTTPSErrors:true,});constpage=awaitcontext.newPage();try{awaitpage.goto('https://example.com');// ... your test logic ...}finally{awaitcontext.close();awaitbrowser.close();}})();
// login.jsconst{chromium}=require('playwright-core');(async()=>{constbrowser=awaitchromium.launch({args:['--no-sandbox','--disable-setuid-sandbox'],});constcontext=awaitbrowser.newContext({recordVideo:{dir:'/app/videos/',size:{width:1280,height:720}},ignoreHTTPSErrors:true,});constpage=awaitcontext.newPage();try{awaitpage.goto('https://myapp:8181');awaitpage.waitForLoadState('networkidle');awaitpage.locator('input[placeholder="Enter your username"]').fill('admin');awaitpage.locator('input[type="password"]').fill('admin');awaitPromise.all([page.waitForLoadState('networkidle'),page.getByRole('button',{name:'Login'}).click(),]);// Wait for a post-login element instead of a fixed sleepawaitpage.waitForTimeout(3000);}finally{awaitcontext.close();awaitbrowser.close();}})();
Chromium and ffmpeg are installed from FreeBSD packages and symlinked into the paths playwright-core expects.
The playwright-core npm package is patched at build time to register freebsd-amd64 as a native platform — no Linux masquerade needed.