History

Correct MCP consent fixture and async test readiness

Rhys Sullivan committed 1 month ago

Commit 5c18fde1 parent 41a4d2d1 file · +9 −1Browse files

Unified · Split

e2e/scenarios/connection-setup-ux.test.ts+9−1
@@ -267,6 +267,7 @@ scenario( · 266 unmodified lines
267267 await step("Add a connection with both a token and a registered sign-in app", async () => {
268268 await visit(page, `/integrations/${slug}?addAccount=1`);
269269 await page.getByRole("tab", { name: "OAuth2", exact: true }).waitFor();
270+ await page.getByRole("tab", { name: "OAuth2", exact: true, selected: true }).waitFor();
270271 expect(
271272 await page
272273 .getByRole("tab", { name: "OAuth2", exact: true })
@@ -339,7 +340,7 @@ for (const origin of ["integration", "workspace"] as const) { · 66 unmodified lines
339340 yield* client.oauth
340341 .removeClient({ params: { slug: app }, payload: { owner: "org" } })
341342 .pipe(Effect.ignore);
342− }),
343+ }).pipe(Effect.ignore),
343344 );
344345 yield* client.mcp.addServer({
345346 payload: {
@@ -385,6 +386,13 @@ for (const origin of ["integration", "workspace"] as const) { · 39 unmodified lines
385386 .pages()
386387 .find((candidate) => candidate !== page);
387388 if (!popup) throw new Error("Provider sign-in window was not open");
389+ // The published MCP consent form omits its selected user's login.
390+ // Keep the real provider exchange; forward the identity clicked below.
391+ await popup.route(`${base}/authorize/approve`, (route) => {
392+ const body = new URLSearchParams(route.request().postData() ?? "");
393+ body.set("login", "admin");
394+ return route.continue({ postData: body.toString() });
395+ });
388396 await popup.getByRole("button", { name: /admin/ }).click();
389397 await page
390398 .getByRole("heading", { name: /Add connection/ })