Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): preview click timeouts identify the target #23489

Mergedjuliusmarmingemerged 8 commits intomain fromrefs/pull/23489/headmerged by juliusmarminge View on GitHub

Showing 5 changed files with 70 additions and 0 deletions (loading 2).

x
0 of 5 viewed, 5 left
37 additions and 0 deletionsapps/server/src/mcp/PreviewAutomationBroker.test.tsModified
View file
@@ -335,6 +335,43 @@
​
+it.effect("names the click target that matched nothing when the server browser times out", () =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const broker = yield* makeBroker;
+ const clientId = SERVER_BROWSER_AUTOMATION_CLIENT_ID;
+ const requests = requestsFrom(yield* broker.connect(makeHost({ clientId })));
+ yield* Stream.runForEach(requests, (request) =>
+ broker.respond({
+ clientId,
+ connectionId: request.connectionId,
+ requestId: request.requestId,
+ ok: false,
+ error: {
+ _tag: "PreviewAutomationTimeoutError",
+ message: "No element matches the target.",
+ detail: { reason: 'No element matches ".definitely-no-such-t3-target".' },
+ },
+ }),
+ ).pipe(Effect.forkScoped);
+ yield* Effect.yieldNow;
+​
+ const error = yield* broker
+ .invoke<void>({
+ scope,
+ operation: "click",
+ input: { selector: ".definitely-no-such-t3-target", timeoutMs: 15_000 },