Files
2025-12-26 13:38:04 +01:00

42 lines
1.1 KiB
JavaScript

// Simple Playwright smoke to ensure pages render without console errors.
const { chromium } = require('playwright')
const BASE = process.env.FRONTEND_URL || 'http://localhost:3000'
async function checkPage(page, path) {
const errors = []
page.on('console', (msg) => {
const type = msg.type()
if (['error', 'warning'].includes(type)) {
errors.push({ type, text: msg.text() })
}
})
await page.goto(`${BASE}${path}`, { waitUntil: 'networkidle', timeout: 30000 })
return errors
}
;(async () => {
const browser = await chromium.launch({ headless: true })
const page = await browser.newPage()
const paths = ['/', '/connect', '/dashboard', '/designs']
let failed = false
for (const p of paths) {
const errs = await checkPage(page, p)
if (errs.length) {
failed = true
console.error(`Errors on ${p}:`)
errs.forEach((e) => console.error(` [${e.type}] ${e.text}`))
} else {
console.log(`OK ${p}`)
}
}
await browser.close()
if (failed) process.exit(1)
})().catch((err) => {
console.error(err)
process.exit(1)
})