From 27853cc2c3069bad6d07ed60299e6d3cfd9a149a Mon Sep 17 00:00:00 2001 From: Adam <69064669+abres33@users.noreply.github.com> Date: Fri, 3 Apr 2026 02:32:47 -0500 Subject: [PATCH] fix: await setCurrentVideoPath and narrow catch in gif-export E2E test --- tests/e2e/gif-export.spec.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/e2e/gif-export.spec.ts b/tests/e2e/gif-export.spec.ts index c32d604..c3a0afb 100644 --- a/tests/e2e/gif-export.spec.ts +++ b/tests/e2e/gif-export.spec.ts @@ -59,13 +59,21 @@ test("exports a GIF from a loaded video", async () => { }); try { - await hudWindow.evaluate((videoPath: string) => { - window.electronAPI.setCurrentVideoPath(videoPath); + await hudWindow.evaluate(async (videoPath: string) => { + await window.electronAPI.setCurrentVideoPath(videoPath); window.electronAPI.switchToEditor(); }, TEST_VIDEO); - } catch { + } catch (error) { // Expected: switchToEditor() closes the HUD window, which terminates // the Playwright page context before evaluate() can resolve. + if ( + !( + error instanceof Error && + error.message.includes("Target page, context or browser has been closed") + ) + ) { + throw error; + } } // ── 3. Switch to the editor window. This closes the HUD and opens