Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix: await setCurrentVideoPath and narrow catch in gif-export E2E test

Adam27853cc2c306
diff --git a/tests/e2e/gif-export.spec.ts b/tests/e2e/gif-export.spec.ts
index c32d6042f..c3a0afbc4 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