Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): a preview capture that never answers no longer blocks the tab #23515

ClosedDavidMendesOS(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/23515/headopened View on GitHub

Showing 2 changed files with 121 additions and 5 deletions.

x
0 of 2 viewed, 2 left
85 additions and 1 deletionapps/server/src/preview/ServerBrowserPage.test.tsModified
View file
@@ -5,7 +5,16 @@
type CDPSession,
type Page,
} from "playwright-core";
-import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from "vite-plus/test";
+import {
+ afterAll,
+ afterEach,
+ beforeAll,
+ beforeEach,
+ describe,
+ expect,
+ it,
+ vi,
+} from "vite-plus/test";
​
import * as ServerBrowserPage from "./ServerBrowserPage.ts";
​
@@ -388,3 +397,78 @@
});
});
+​
+describe("server browser capture", () => {
+ it("fails a capture the page never answers instead of waiting for it", async () => {
+ vi.useFakeTimers();
+ try {
+ const cdp = { send: () => new Promise(() => {}) } as unknown as CDPSession;
+ const capture = ServerBrowserPage.captureViewport(cdp, { format: "jpeg" }).then(