45 lines
2.2 KiB
JavaScript
45 lines
2.2 KiB
JavaScript
// Runs the desktop-render verification harnesses (Phase A/B of
|
|
// 05_electron-rendering-integration-plan_2.md) under Electron and aggregates the
|
|
// results. Each harness exits 0 on PASS, non-zero on FAIL.
|
|
//
|
|
// npm run test:render-desktop (compiles electron TS first, then runs this)
|
|
//
|
|
// Requires a display (DISPLAY set), ffmpeg + ffprobe on PATH, and a built
|
|
// dist-electron/ (the npm script's `tsc` step handles the latter).
|
|
|
|
const { spawnSync } = require('node:child_process')
|
|
const path = require('node:path')
|
|
|
|
const electron = require('electron') // resolves to the electron binary path
|
|
const electronEnv = { ...process.env }
|
|
delete electronEnv.ELECTRON_RUN_AS_NODE
|
|
electronEnv.ELECTRON_DISABLE_SANDBOX = '1'
|
|
|
|
const harnesses = [
|
|
['capture', 'verify-capture.cjs', 'hidden-window capturePage produces advancing, non-blank frames (#1/#2)'],
|
|
['capture-fidelity', 'verify-capture-fidelity.cjs', 'capturePage matches render.html canvas pixels'],
|
|
['export', 'verify-export.cjs', 'real worker renders a playable H.264 MP4 with motion'],
|
|
['resolution', 'verify-resolution.cjs', 'MP4 dimensions match the requested canvas on HiDPI (#10)'],
|
|
['odd-dims', 'verify-odd-dims.cjs', 'odd canvas dimensions pad to an even MP4 instead of failing (#13)'],
|
|
['cancel', 'verify-cancel.cjs', 'cancel mid-export aborts cleanly, no partial file'],
|
|
['timeout', 'verify-timeout.cjs', 'inactivity watchdog aborts a wedged render (#3)'],
|
|
['assets', 'verify-assets.cjs', 'local data: assets load; remote http: blocked, no hang (#5)'],
|
|
['background', 'verify-bg.cjs', 'transparent regions flatten to white, not black (#4)'],
|
|
]
|
|
|
|
let failures = 0
|
|
for (const [name, file, desc] of harnesses) {
|
|
process.stdout.write(`\n=== ${name}: ${desc} ===\n`)
|
|
const res = spawnSync(electron, ['--no-sandbox', path.join(__dirname, file)], {
|
|
stdio: ['ignore', 'inherit', 'ignore'], // drop Electron's chatty stderr
|
|
env: electronEnv,
|
|
})
|
|
if (res.status !== 0) {
|
|
failures += 1
|
|
process.stdout.write(`*** ${name} FAILED (exit ${res.status})\n`)
|
|
}
|
|
}
|
|
|
|
process.stdout.write(`\n${failures === 0 ? 'ALL DESKTOP RENDER CHECKS PASSED' : failures + ' CHECK(S) FAILED'}\n`)
|
|
process.exit(failures === 0 ? 0 : 1)
|