From ac4f82484b72f7f0fc8157d448af96fdad34da6e Mon Sep 17 00:00:00 2001 From: Marc Diaz Date: Mon, 16 Mar 2026 13:46:57 -0400 Subject: [PATCH] revert change --- tests/e2e/gif-export.spec.ts | 41 +++++++++++++++--------------------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/tests/e2e/gif-export.spec.ts b/tests/e2e/gif-export.spec.ts index 4e65078..b18fd44 100644 --- a/tests/e2e/gif-export.spec.ts +++ b/tests/e2e/gif-export.spec.ts @@ -1,4 +1,3 @@ -/// import fs from "node:fs"; import os from "node:os"; import path from "node:path"; @@ -14,7 +13,11 @@ test("exports a GIF from a loaded video", async () => { const outputPath = path.join(os.tmpdir(), `test-gif-export-${Date.now()}.gif`); const app = await electron.launch({ - args: [MAIN_JS], + args: [ + MAIN_JS, + // Required in CI sandbox environments (GitHub Actions, Docker, etc.) + "--no-sandbox", + ], env: { ...process.env, // Set HEADLESS=false to show windows while debugging. @@ -55,32 +58,22 @@ test("exports a GIF from a loaded video", async () => { ); }); - // ── 3. Attach the window listener BEFORE triggering the switch so a fast - // main-process response can't create the editor window before the - // listener is live (which would cause a 15s timeout waiting for an - // event that already fired). - const editorWindowPromise = app.waitForEvent("window", { + await hudWindow.evaluate((videoPath: string) => { + window.electronAPI.setCurrentVideoPath(videoPath); + try { + window.electronAPI.switchToEditor(); + } catch { + // Expected: HUD window closes during this call, killing the context. + } + }, TEST_VIDEO); + + // ── 3. Switch to the editor window. This closes the HUD and opens + // a new BrowserWindow with ?windowType=editor. + const editorWindow = await app.waitForEvent("window", { predicate: (w) => w.url().includes("windowType=editor"), timeout: 15_000, }); - // Set the video path first and wait for it to settle, then switch. - // Calling switchToEditor before setCurrentVideoPath resolves can open the - // editor without the expected video loaded. - await hudWindow.evaluate( - (videoPath: string) => window.electronAPI.setCurrentVideoPath(videoPath), - TEST_VIDEO, - ); - - hudWindow - .evaluate(() => window.electronAPI.switchToEditor()) - .catch(() => { - // Expected: the HUD window is destroyed mid-call, which kills the - // renderer context and rejects the evaluate promise. - }); - - const editorWindow = await editorWindowPromise; - // WebCodecs (VideoEncoder) may not be registered in the renderer on first // load of a second BrowserWindow. A single reload ensures the feature is // fully initialized before we start encoding.