Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): a stalled viewer screencast no longer locks its preview tab #33760

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

Showing 2 changed files with 85 additions and 12 deletions.

x
0 of 2 viewed, 2 left
64 additions and 0 deletionsapps/server/src/preview/ServerBrowser.test.tsModified
View file
@@ -2616,6 +2616,70 @@
).pipe(Effect.provide(layer)),
+it.effect(
+ "a viewer whose screencast Chromium never starts still attaches and lets snapshots run",
+ () =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const { browser, broker, tabId } = yield* ready;
+ const context = contexts[0]!;
+ const stalledStarts = yield* Queue.unbounded<void>();
+ const openSession = context.newCDPSession;
+ context.newCDPSession = async (target: unknown) => {
+ const session = await openSession(target);
+ const answer = session.send.getMockImplementation()!;
+ session.send.mockImplementation(async (method: string, input?: unknown) => {
+ if (method !== "Page.startScreencast") return answer(method, input);
+ Queue.offerUnsafe(stalledStarts, undefined);
+ return new Promise<never>(() => {});
+ });
+ return session;
+ };
+ const attaching = yield* browser
+ .attachViewer(viewerInput(tabId, true))
+ .pipe(Effect.forkScoped);
+ yield* Queue.take(stalledStarts);
+ yield* TestClock.adjust("5 seconds");
+ const viewer = yield* Fiber.join(attaching);
+ expect((yield* Queue.takeAll(viewer.output)).map((item) => item._tag)).toContain("frame");