Add Electron E2E harness launcher
This commit is contained in:
1 parent
fa8c52b239
commit
00ee563311
4 files changed
+47
-6
No files matched your search
@@ -0,0 +1,21 @@
|
||||
const { spawnSync } = require('node:child_process')
|
||||
|
||||
const electron = require('electron')
|
||||
const args = process.argv.slice(2)
|
||||
|
||||
if (!args.length) {
|
||||
console.error('usage: node scripts/run-electron-harness.cjs <script> [args...]')
|
||||
process.exit(2)
|
||||
}
|
||||
|
||||
const env = { ...process.env }
|
||||
delete env.ELECTRON_RUN_AS_NODE
|
||||
env.ELECTRON_DISABLE_SANDBOX = '1'
|
||||
|
||||
const res = spawnSync(electron, ['--no-sandbox', ...args], {
|
||||
stdio: 'inherit',
|
||||
env,
|
||||
argv0: electron,
|
||||
})
|
||||
|
||||
process.exit(res.status ?? 1)
|
||||
@@ -1,5 +1,5 @@
|
||||
// Runs the desktop-render verification harnesses (Phase A/B of
|
||||
// electron-rendering-integration-plan_2.md) under Electron and aggregates the
|
||||
// 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)
|
||||
@@ -11,6 +11,10 @@ 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'],
|
||||
@@ -26,8 +30,9 @@ const harnesses = [
|
||||
let failures = 0
|
||||
for (const [name, file, desc] of harnesses) {
|
||||
process.stdout.write(`\n=== ${name}: ${desc} ===\n`)
|
||||
const res = spawnSync(electron, [path.join(__dirname, file)], {
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user