Skip to content

Commit 86c6c80

Browse files
Add Playwright e2e tests for CLI argument handling
- Test that transport and serverUrl parameters are correctly passed via URL - Verify SSE and streamable-http transport types are handled - Test default STDIO behavior
1 parent 0f6f811 commit 86c6c80

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

client/e2e/cli-arguments.spec.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { test, expect } from "@playwright/test";
2+
3+
// These tests verify that CLI arguments correctly set URL parameters
4+
// The CLI should parse config files and pass transport/serverUrl as URL params
5+
test.describe("CLI Arguments @cli", () => {
6+
test("should pass transport parameter from command line", async ({
7+
page,
8+
}) => {
9+
// Simulate: npx . --transport sse --server-url http://localhost:3000/sse
10+
await page.goto("http://localhost:6274/?transport=sse&serverUrl=http://localhost:3000/sse");
11+
12+
// Wait for the Transport Type dropdown to be visible
13+
const selectTrigger = page.getByLabel("Transport Type");
14+
await expect(selectTrigger).toBeVisible();
15+
16+
// Verify transport dropdown shows SSE
17+
await expect(selectTrigger).toContainText("SSE");
18+
19+
// Verify URL field is visible and populated
20+
const urlInput = page.locator("#sse-url-input");
21+
await expect(urlInput).toBeVisible();
22+
await expect(urlInput).toHaveValue("http://localhost:3000/sse");
23+
});
24+
25+
test("should pass transport parameter for streamable-http", async ({
26+
page,
27+
}) => {
28+
// Simulate config with streamable-http transport
29+
await page.goto("http://localhost:6274/?transport=streamable-http&serverUrl=http://localhost:3000/mcp");
30+
31+
// Wait for the Transport Type dropdown to be visible
32+
const selectTrigger = page.getByLabel("Transport Type");
33+
await expect(selectTrigger).toBeVisible();
34+
35+
// Verify transport dropdown shows Streamable HTTP
36+
await expect(selectTrigger).toContainText("Streamable HTTP");
37+
38+
// Verify URL field is visible and populated
39+
const urlInput = page.locator("#sse-url-input");
40+
await expect(urlInput).toBeVisible();
41+
await expect(urlInput).toHaveValue("http://localhost:3000/mcp");
42+
});
43+
44+
test("should not pass transport parameter for stdio config", async ({
45+
page,
46+
}) => {
47+
// Simulate stdio config (no transport param needed)
48+
await page.goto("http://localhost:6274/");
49+
50+
// Wait for the Transport Type dropdown to be visible
51+
const selectTrigger = page.getByLabel("Transport Type");
52+
await expect(selectTrigger).toBeVisible();
53+
54+
// Verify transport dropdown defaults to STDIO
55+
await expect(selectTrigger).toContainText("STDIO");
56+
57+
// Verify command/args fields are visible
58+
await expect(page.locator("#command-input")).toBeVisible();
59+
await expect(page.locator("#arguments-input")).toBeVisible();
60+
});
61+
});

0 commit comments

Comments
 (0)