Skip to content

Add integration test coverage for new server architecture #40

Description

@smartlabsAT

TL;DR: Add an automated integration test that exercises the new server architecture end-to-end via MCP protocol.

Context

Part of Epic #35 (v0.2.0 architecture cleanup). After #39 introduces the layered architecture, an integration test verifies the full chain: client connects via stdio → tool listing → tool execution → clean shutdown. The test uses the user-facing entry point (dist/mcp/server.cjs shim) to also verify backward compatibility.

Acceptance Criteria

  • New test file tests/integration/proxy-server.test.js covers server start, tool listing, tool execution, and clean shutdown
  • New npm script test:integration runs the test (separate from npm test to keep dev loop fast)
  • CI skip guard if Chromium not available (exit 0, not failure)

Scope

In Scope:

  • Create tests/integration/proxy-server.test.js using hand-rolled Node.js assertions (project convention — no test framework installed)
  • Add test:integration script to package.json
  • Chromium availability check with graceful skip
  • Test via dist/mcp/server.cjs (the shim path, verifying backward compat)

Out of Scope:

  • Test framework adoption (Jest, Vitest, etc.)
  • Testing of local tools (none registered in Epic 1)
  • Performance benchmarks (deferred to Epic 2)

Technical Implementation

  • Test structure (CJS, matches project convention):
    • Spawn server via StdioClientTransport pointing at dist/mcp/server.cjs
    • Connect with Client from @modelcontextprotocol/sdk/client/index.js (already installed, v1.17.4)
    • Assert tools/list returns ≥ 20 tools (lower bound allows minor upstream version drift; PoC confirmed 23)
    • Execute browser_navigate to about:blank, browser_snapshot, browser_close
    • Verify clean client disconnect
  • Pre-flight: Check Chromium availability; skip test with exit 0 if not installed
  • Prerequisite: npm run build must run before test:integration (tests the built artifact)
  • Directory: tests/integration/ exists (currently empty)

Architecture Reference

From Epic #35 Architecture Decisions:

  • Test uses the backward-compat shim path (dist/mcp/server.cjs) to verify .mcp.json compatibility

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    testingTest infrastructurev0.2.0v0.2.0 milestone work

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions