Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions e2e/selfhost/connection-modal-dcr-card.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// Selfhost (browser, recorded): the add-connection modal for a transparent-DCR
// OAuth MCP integration must render its body card, not just a floating tab
// strip. A remote MCP integration that declares an oauth2 method is DCR-capable
// (supportsDynamicRegistration), so the modal skips the app picker. When the
// integration also offers the custom-method "+" the method tab strip renders.
//
// The regression this guards: the OAuth tab's TabsContent card (the "No app to
// choose / automatic setup" explainer) was gated out whenever DCR was active,
// leaving the tab strip with no card under it and a detached-looking border.
// The same gate also made that explainer unreachable dead code. The per-step
// screenshots are the artifact.
import { randomBytes } from "node:crypto";

import { Effect } from "effect";
import { composePluginApi } from "@executor-js/api/server";
import { mcpHttpPlugin } from "@executor-js/plugin-mcp/api";
import { makeGreetingMcpServer, serveMcpServer } from "@executor-js/plugin-mcp/testing";
import { IntegrationSlug } from "@executor-js/sdk/shared";

import { scenario } from "../src/scenario";
import { Api, Browser, Target } from "../src/services";

const api = composePluginApi([mcpHttpPlugin()] as const);

scenario(
"Connections · the add-connection modal for a transparent-DCR OAuth MCP renders its body card under the tab strip",
{},
Comment on lines +25 to +27

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 No needs capability declared for browser dependency

The scenario options are {} but the test yields Browser and drives a full browser session. The e2e/AGENTS.md anatomy examples declare required capabilities via needs (e.g. { needs: ["api"] }). If the runner gates service provisioning on that field, the test could silently skip or error on an environment that doesn't wire up Browser by default. Consider adding needs: ["browser"] (or the equivalent selfhost capability key) to make the dependency explicit and self-documenting.

Context Used: e2e/AGENTS.md (source)

Effect.scoped(
Effect.gen(function* () {
const target = yield* Target;
const browser = yield* Browser;
const { client: makeApiClient } = yield* Api;

// A remote MCP integration declaring an oauth2 method: remote + oauth2 is
// transparent-DCR (supportsDynamicRegistration true), so the modal skips
// the BYO-app picker. The server is never dialed here — opening the modal
// only reads the declared template.
const server = yield* serveMcpServer(() => makeGreetingMcpServer());
const identity = yield* target.newIdentity();
const client = yield* makeApiClient(api, identity);
const slug = `mcp-dcr-card-${randomBytes(3).toString("hex")}`;

yield* client.mcp.addServer({
payload: {
transport: "remote",
name: "DCR OAuth MCP",
endpoint: server.endpoint,
slug,
authenticationTemplate: [{ kind: "oauth2" }],
},
});

// Remove the integration afterward — selfhost identities share one tenant,
// so a leaked integration would bleed into other scenarios.
yield* Effect.gen(function* () {
yield* browser.session(identity, async ({ page, step }) => {
const dialog = page.getByRole("dialog");

await step("Open the integration's add-connection modal", async () => {
await page.goto(`/integrations/${slug}`, { waitUntil: "networkidle" });
await page.getByRole("button", { name: "Add connection" }).first().click();
await dialog.waitFor({ state: "visible" });
});

await step("The OAuth tab and the custom-method + are present", async () => {
await dialog.getByRole("tab", { name: "OAuth" }).waitFor();
await dialog.getByRole("button", { name: "Add authentication method" }).waitFor();
});

await step("The OAuth tab has its body card, not a floating tab strip", async () => {
// The card the fix restores: the DCR explainer that anchors the tab
// strip. Before the fix the TabsContent was gated out for DCR, so
// this copy was unreachable and the tabs floated with no card.
await dialog.getByText("No app to choose").waitFor({ timeout: 15_000 });
await dialog.getByText(/supports automatic setup/).waitFor({ timeout: 15_000 });
});
});
}).pipe(
Effect.ensuring(
client.mcp
.removeServer({ params: { slug: IntegrationSlug.make(slug) } })
.pipe(Effect.ignore),
),
);
}),
),
);
Loading
Loading