From 3e6dff9c341177e5d6f9a4b0f44823803beaf408 Mon Sep 17 00:00:00 2001 From: Siddharth Date: Sun, 5 Apr 2026 16:34:35 -0700 Subject: [PATCH] fix: wrap evaluate in try/catch for expected HUD window close The HUD window now closes faster after switchToEditor, causing the Playwright page context to terminate before evaluate returns. --- tests/e2e/gif-export.spec.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/e2e/gif-export.spec.ts b/tests/e2e/gif-export.spec.ts index bf665d6..d1fa3f7 100644 --- a/tests/e2e/gif-export.spec.ts +++ b/tests/e2e/gif-export.spec.ts @@ -71,14 +71,15 @@ test("exports a GIF from a loaded video", async () => { fs.mkdirSync(recordingsDir, { recursive: true }); fs.copyFileSync(TEST_VIDEO, testVideoInRecordings); - await hudWindow.evaluate((videoPath: string) => { - window.electronAPI.setCurrentVideoPath(videoPath); - try { + try { + await hudWindow.evaluate((videoPath: string) => { + window.electronAPI.setCurrentVideoPath(videoPath); window.electronAPI.switchToEditor(); - } catch { - // Expected: HUD window closes during this call, killing the context. - } - }, testVideoInRecordings); + }, testVideoInRecordings); + } catch { + // Expected: switchToEditor() closes the HUD window, terminating + // the Playwright page context before evaluate() can resolve. + } // ── 3. Switch to the editor window. This closes the HUD and opens // a new BrowserWindow with ?windowType=editor.