Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): a hidden agent browser keeps painting while the agent drives it #35160

Openjuliusmarmingewants to merge 1 commit intomain fromrefs/pull/35160/headopened View on GitHub

Showing 2 changed files with 41 additions and 4 deletions.

x
0 of 2 viewed, 2 left
34 additions and 0 deletionsapps/desktop/src/preview/DesktopBrowserHost.test.tsModified
View file
@@ -964,6 +964,40 @@
}).pipe(Effect.scoped),
​
+ it.effect("paints a hidden guest the agent drives until its turn ends", () =>
+ Effect.gen(function* () {
+ const host = yield* DesktopBrowserHost.make;
+ const debuggee = makeDebuggee();
+ host.attach(key, debuggee.tab);
+ const painting = yield* watchPainting(host);
+ const turn = (active: boolean) =>
+ host.handleCommandLine(encodeJson({ type: "turn", threadId: key.threadId, active }));
+​
+ yield* turn(true);
+ // Playwright's actionability check awaits the page's next frame.
+ yield* command(host, 1, "Runtime.callFunctionOn");
+ yield* settle;
+ expect(painting).toEqual([true]);
+​
+ debuggee.release();
+ yield* settle;
+ yield* TestClock.adjust("1 minute");
+ expect(painting).toEqual([true]);
+​
+ yield* turn(false);
+ expect(painting).toEqual([true, false]);
+​
+ // Outside a turn it paints until the agent goes idle.
+ yield* command(host, 2, "Input.dispatchMouseEvent");
+ yield* settle;