Skip to content

Commit b416c3e

Browse files
its-mashclaude
andcommitted
fix: add diagnostic logging to TC-SH-014 and TC-SH-015 E2E tests
Log response status and body before assertions to debug failures. Read response as text first, then parse JSON, so CI output shows the actual error returned by the gateway. Signed-off-by: Myko <myko@mcpmux.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Mohammod Al Amin Ashik <maa.ashik00@gmail.com>
1 parent 294dc1a commit b416c3e

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

tests/e2e/specs/streamable-http.wdio.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ describe('Streamable HTTP: OAuth MCP Client Flow', function () {
345345
// --------------------------------------------------------------------------
346346
it('TC-SH-014: Authenticated initialize request to /mcp', async () => {
347347
const token = await obtainAccessToken(clientId, 'http://localhost:0/callback', gatewayPort);
348+
console.log('[test] Token obtained, length:', token.length);
348349

349350
// Send MCP initialize request
350351
const res = await fetch(`http://localhost:${gatewayPort}/mcp`, {
@@ -368,10 +369,17 @@ describe('Streamable HTTP: OAuth MCP Client Flow', function () {
368369
}),
369370
});
370371

371-
console.log('[test] Initialize response status:', res.status);
372-
expect(res.ok).toBe(true);
372+
console.log('[test] Initialize response status:', res.status, res.statusText);
373+
const responseText = await res.text();
374+
console.log('[test] Initialize response body:', responseText.substring(0, 1000));
373375

374-
const body = await res.json() as {
376+
// If response is not OK, provide detailed failure info
377+
if (!res.ok) {
378+
console.log('[test] FAILURE: /mcp returned', res.status, '- body:', responseText);
379+
}
380+
expect(res.status).toBeLessThan(400);
381+
382+
const body = JSON.parse(responseText) as {
375383
jsonrpc: string;
376384
id: number;
377385
result?: {
@@ -414,6 +422,7 @@ describe('Streamable HTTP: OAuth MCP Client Flow', function () {
414422
// --------------------------------------------------------------------------
415423
it('TC-SH-015: Session ID returned and usable', async () => {
416424
const token = await obtainAccessToken(clientId, 'http://localhost:0/callback', gatewayPort);
425+
console.log('[test] Token for session test, length:', token.length);
417426

418427
// Initialize to get session ID
419428
const initRes = await fetch(`http://localhost:${gatewayPort}/mcp`, {
@@ -434,7 +443,13 @@ describe('Streamable HTTP: OAuth MCP Client Flow', function () {
434443
}),
435444
});
436445

437-
expect(initRes.ok).toBe(true);
446+
console.log('[test] Session init status:', initRes.status, initRes.statusText);
447+
const initText = await initRes.text();
448+
console.log('[test] Session init body:', initText.substring(0, 1000));
449+
if (!initRes.ok) {
450+
console.log('[test] FAILURE: /mcp returned', initRes.status, '- body:', initText);
451+
}
452+
expect(initRes.status).toBeLessThan(400);
438453

439454
// Check for Mcp-Session-Id in response headers
440455
const sessionId = initRes.headers.get('mcp-session-id');

0 commit comments

Comments
 (0)