🌳
pt0/deployF/testsF/ensurePlaywrightAI.mts
1// Auto-install playwright chromium browser if missing
2import { chromium } from 'playwright'
3import { existsSync } from 'fs'
4import { execSync } from 'child_process'
6let installed = false
8export const ensurePlaywrightChromium = () => {
9 if (installed) return
10 const binPath = chromium.executablePath()
11 if (existsSync(binPath)) {
12 installed = true
13 return
14 }
15 console.log('Installing playwright chromium browser...')
16 execSync('npx playwright install chromium', {stdio: 'inherit'})
17 installed = true