MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / decideInBrowser

Function decideInBrowser

e2e/scenarios/browser-approval.test.ts:63–79  ·  view source on GitHub ↗
(
  browser: BrowserSurface,
  identity: Identity,
  approval: McpBrowserApproval,
  decision: "Approve" | "Decline",
)

Source from the content-addressed store, hash-verified

61
62/** Open the console approval page as `identity` and click Approve or Decline. */
63const decideInBrowser = (
64 browser: BrowserSurface,
65 identity: Identity,
66 approval: McpBrowserApproval,
67 decision: "Approve" | "Decline",
68): Effect.Effect<void> =>
69 browser.session(identity, async ({ page, step }) => {
70 await step(
71 `Open the approval page and ${decision.toLowerCase()} the paused action`,
72 async () => {
73 await page.goto(approval.approvalUrl, { waitUntil: "networkidle" });
74 await page.getByRole("button", { name: decision }).click();
75 // The page confirms the decision was recorded ("Approve sent" / "Decline sent").
76 await page.getByText(`${decision} sent`).waitFor();
77 },
78 );
79 });
80
81scenario(
82 "MCP · a gated action approved in the browser runs to completion",

Callers 1

Calls 1

stepFunction · 0.50

Tested by

no test coverage detected