make mcp agent e2e test provider-aware

This commit is contained in:
Mohamed Boudra
2025-12-24 08:45:02 +00:00
parent e1f79c1d6f
commit e37d50e938
@@ -95,16 +95,22 @@ async function settleAgentRun(client: McpClient, agentId: string): Promise<void>
} }
} }
const hasClaudeCredentials = Boolean(
process.env.CLAUDE_CODE_OAUTH_TOKEN || process.env.ANTHROPIC_API_KEY
);
const hasCodexCredentials = Boolean( const hasCodexCredentials = Boolean(
process.env.OPENAI_API_KEY || process.env.OPENAI_API_KEY ||
process.env.CODEX_API_KEY || process.env.CODEX_API_KEY ||
process.env.OPENROUTER_API_KEY process.env.OPENROUTER_API_KEY
); );
const hasAgentCredentials = hasClaudeCredentials || hasCodexCredentials;
const agentType = hasClaudeCredentials ? "claude" : "codex";
const agentMode = agentType === "claude" ? "bypassPermissions" : "full-access";
describe("agent MCP end-to-end", () => { describe("agent MCP end-to-end", () => {
const runTest = hasCodexCredentials ? test : test.skip; const runTest = hasAgentCredentials ? test : test.skip;
runTest( runTest(
"creates a codex agent and writes a file", "creates an agent and writes a file",
async () => { async () => {
const paseoHome = await mkdtemp(path.join(os.tmpdir(), "paseo-home-")); const paseoHome = await mkdtemp(path.join(os.tmpdir(), "paseo-home-"));
const staticDir = await mkdtemp(path.join(os.tmpdir(), "paseo-static-")); const staticDir = await mkdtemp(path.join(os.tmpdir(), "paseo-static-"));
@@ -177,8 +183,8 @@ describe("agent MCP end-to-end", () => {
args: { args: {
cwd: agentCwd, cwd: agentCwd,
title: "MCP e2e smoke", title: "MCP e2e smoke",
agentType: "codex", agentType,
initialMode: "full-access", initialMode: agentMode,
background: false, background: false,
}, },
})) as McpToolResult; })) as McpToolResult;
@@ -199,7 +205,7 @@ describe("agent MCP end-to-end", () => {
args: { args: {
agentId, agentId,
prompt, prompt,
sessionMode: "full-access", sessionMode: agentMode,
background: false, background: false,
}, },
})) as McpToolResult; })) as McpToolResult;