Files
orca/tests/e2e/helpers/electron-launch-args.ts
T
OrcaWin 82412dab8b Persist profile state in SQLite with background writes (#22612)
Migrate profile state to SQLite and move writes and backups into a background worker. Acknowledge terminal, SSH and automation changes only after durable saves. Preserve JSON import, recovery, rollback and compatibility exports.

Validate migration, worker failures, maintenance, cross-profile moves and terminal lifetime races with unit, integration and end-to-end coverage.
2026-09-25 22:47:33 -07:00

47 lines
1.8 KiB
TypeScript

import { dirname } from 'node:path'
export function getElectronIsolatedKeychainArgs(): string[] {
// Isolated macOS profiles must not invoke the system keychain UI.
return process.platform === 'darwin' ? ['--password-store=basic', '--use-mock-keychain'] : []
}
export function getOrcaElectronLaunchArgs(mainPath: string, headful: boolean): string[] {
// Launch through package.json so app version and resource paths match a packaged app.
const appPath = dirname(dirname(dirname(mainPath)))
const keychainArgs = getElectronIsolatedKeychainArgs()
if (process.platform === 'darwin') {
// Crash tests must not block later launches on AppKit's saved-window recovery dialog.
return [...keychainArgs, appPath, '-ApplePersistenceIgnoreState', 'YES']
}
if (headful && process.platform === 'linux' && process.env.CI) {
// Hosted runners have no GPU; SwiftShader keeps WebGL assertions from silently skipping.
return [
'--use-gl=angle',
'--use-angle=swiftshader',
'--enable-unsafe-swiftshader',
'--disable-gpu-sandbox',
appPath
]
}
if (headful || process.platform !== 'linux') {
return [...keychainArgs, appPath]
}
// Why: Ubuntu CI cannot run Electron's setuid chrome-sandbox (not root-owned
// mode 4755 in node_modules). Playwright's electron.launch injects
// --no-sandbox automatically; raw spawn() paths (e.g. second-instance
// activation) must match or Chromium aborts with SIGTRAP before handshake.
// GPU flags keep headless under Xvfb on a software path when the GPU
// subprocess cannot initialize.
return [
'--no-sandbox',
'--disable-gpu',
'--disable-gpu-compositing',
'--disable-gpu-sandbox',
'--disable-dev-shm-usage',
'--in-process-gpu',
...keychainArgs,
appPath
]
}