/**
 * Minimal Playwright launch smoke test.
 * If this hangs, it's a Windows permission/defender issue, not our code.
 */
import { chromium } from 'playwright'

async function main(): Promise<void> {
  process.stdout.write('launching chromium...\n')
  const t0 = Date.now()
  const browser = await chromium.launch({ headless: true })
  process.stdout.write(`launched in ${Date.now() - t0}ms\n`)
  const page = await browser.newPage()
  await page.goto('https://example.com', { timeout: 10000 })
  const title = await page.title()
  process.stdout.write(`title: ${title}\n`)
  await browser.close()
  process.stdout.write('done\n')
}

main().catch((err) => {
  process.stderr.write(`FAIL: ${err instanceof Error ? err.message : String(err)}\n`)
  process.exit(1)
})
