(app: ElectronApplication, runDir: string, home: string)
| 72 | }; |
| 73 | |
| 74 | const closeWithVideo = async (app: ElectronApplication, runDir: string, home: string) => { |
| 75 | const page = app.windows()[0]; |
| 76 | const video = page?.video(); |
| 77 | await app.close().catch(() => {}); |
| 78 | const recordedPath = await video?.path().catch(() => undefined); |
| 79 | if (recordedPath && existsSync(recordedPath)) { |
| 80 | await promisify(execFile)("ffmpeg", [ |
| 81 | "-y", |
| 82 | "-i", |
| 83 | recordedPath, |
| 84 | "-c:v", |
| 85 | "libx264", |
| 86 | "-preset", |
| 87 | "veryfast", |
| 88 | "-crf", |
| 89 | "26", |
| 90 | "-pix_fmt", |
| 91 | "yuv420p", |
| 92 | "-movflags", |
| 93 | "+faststart", |
| 94 | join(runDir, "session.mp4"), |
| 95 | ]).catch(() => {}); |
| 96 | } |
| 97 | rmSync(join(runDir, ".video-tmp"), { recursive: true, force: true }); |
| 98 | rmSync(home, { recursive: true, force: true }); |
| 99 | }; |
| 100 | |
| 101 | // --------------------------------------------------------------------------- |
| 102 | // A. MCP browser approval through the desktop app |
no test coverage detected