Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

test(e2e): smoke flows for agent-bridge + traffic-inspector + cross (F9)

diegosouzapw48c31c4ce50c
diff --git a/tests/e2e/agent-bridge-traffic-cross.spec.ts b/tests/e2e/agent-bridge-traffic-cross.spec.ts
new file mode 100644
index 0000000000..bfca6857e3
--- /dev/null
+++ b/tests/e2e/agent-bridge-traffic-cross.spec.ts
@@ -0,0 +1,155 @@
+/**
+ * E2E — Cross-page smoke: AgentBridge → Traffic Inspector
+ *
+ * Verifies that the integration between AgentBridge and Traffic Inspector
+ * works end-to-end:
+ * 1. AgentBridge page is accessible
+ * 2. "View in Traffic Inspector" link/button navigates to the Inspector
+ * 3. Traffic Inspector receives/shows source=agent-bridge entries when
+ * an AgentBridge capture is active
+ *
+ * CI behaviour: marked `.skip` unless `RUN_CROSS_E2E=1` is set.
+ * These tests are best-effort: they verify page-level integration, not
+ * live MITM traffic (which requires real IDE agent activity).
+ *
+ * To run locally:
+ * RUN_CROSS_E2E=1 npx playwright test tests/e2e/agent-bridge-traffic-cross.spec.ts
+ */
+import { test, expect, type Page } from "@playwright/test";
+
+const SKIP = !process.env["RUN_CROSS_E2E"];
+
+// ---------------------------------------------------------------------------
+// Helpers
+// ---------------------------------------------------------------------------
+
+async function isAuthenticated(page: Page): Promise<boolean> {
+ return !page.url().includes("/login");
+}
+
+// ---------------------------------------------------------------------------
+// Tests
+// ---------------------------------------------------------------------------
+
+test.describe("AgentBridge ↔ Traffic Inspector cross-page integration", () => {
+ test.skip(SKIP, "Set RUN_CROSS_E2E=1 to run cross-page E2E tests");
+
+ test("sidebar shows both agent-bridge and traffic-inspector entries", async ({ page }) => {
+ await page.goto("/dashboard");
+ await page.waitForLoadState("networkidle");
+ if (!(await isAuthenticated(page))) {
+ test.skip();
+ return;
+ }
+ // Both Tools items should be in the sidebar
+ const agentBridgeLink = page.locator(
+ "a[href*='agent-bridge'], [data-testid='sidebar-agent-bridge']"
+ ).first();
+ const inspectorLink = page.locator(
+ "a[href*='traffic-inspector'], [data-testid='sidebar-traffic-inspector']"
+ ).first();
+
+ await expect(agentBridgeLink).toBeVisible({ timeout: 5000 });
+ await expect(inspectorLink).toBeVisible({ timeout: 5000 });
+ });
+
+ test("View in Traffic Inspector link from AgentBridge navigates correctly", async ({ page }) => {
+ await page.goto("/dashboard/tools/agent-bridge");
+ await page.waitForLoadState("networkidle");
+ if (!(await isAuthenticated(page))) {
+ test.skip();
+ return;
+ }
+ // Look for a "View traffic" / "Traffic Inspector" link on the AgentBridge page
+ const viewTrafficLink = page.locator(
+ "a[href*='traffic-inspector'], a:has-text('Traffic Inspector'), [data-testid='view-traffic-link']"
+ ).first();
+ const isVisible = await viewTrafficLink.isVisible({ timeout: 5000 }).catch(() => false);
+ if (!isVisible) {
+ // Quick links section may not render without providers configured
+ test.skip();
+ return;
+ }
+ await viewTrafficLink.click();
+ await page.waitForLoadState("networkidle");
+ expect(page.url()).toContain("traffic-inspector");
+ });
+
+ test("Traffic Inspector source filter includes agent-bridge option", async ({ page }) => {
+ await page.goto("/dashboard/tools/traffic-inspector");
+ await page.waitForLoadState("networkidle");
+ if (!(await isAuthenticated(page))) {
+ test.skip();
+ return;
+ }
+ // Source filter dropdown should list agent-bridge as an option
+ const sourceFilter = page.locator(
+ "[data-testid='source-filter'], select[name='source'], [aria-label*='source']"
+ ).first();
+ const isVisible = await sourceFilter.isVisible({ timeout: 5000 }).catch(() => false);
+ if (!isVisible) {
+ test.skip();
+ return;
+ }
+ // Open the dropdown
+ await sourceFilter.click();
+ const agentBridgeOption = page.locator(
+ "option[value='agent-bridge'], [data-value='agent-bridge'], li:has-text('Agent Bridge'), li:has-text('agent-bridge')"
+ ).first();
+ await expect(agentBridgeOption).toBeVisible({ timeout: 3000 });
+ });
+
+ test("AgentBridge server control buttons exist and are interactable", async ({ page }) => {
+ await page.goto("/dashboard/tools/agent-bridge");
+ await page.waitForLoadState("networkidle");
+ if (!(await isAuthenticated(page))) {
+ test.skip();
+ return;
+ }
+ // Start / Stop / Restart buttons should be present in server card
+ const startBtn = page.locator(
+ "button:has-text('Start'), button:has-text('Start Server'), [data-testid='start-server-btn']"
+ ).first();
+ const isVisible = await startBtn.isVisible({ timeout: 5000 }).catch(() => false);
+ if (!isVisible) {
+ test.skip();
+ return;
+ }
+ // Verify button is not disabled in an error state
+ const disabled = await startBtn.getAttribute("disabled");
+ // We just check it exists and is rendered — not clicking (would spawn the MITM server)
+ await expect(startBtn).toBeVisible();
+ expect(disabled === null || disabled === "false").toBe(true);
+ });
+
+ test("navigating from Inspector back to AgentBridge preserves state", async ({ page }) => {
+ // Navigate to Inspector first
+ await page.goto("/dashboard/tools/traffic-inspector");
+ await page.waitForLoadState("networkidle");
+ if (!(await isAuthenticated(page))) {
+ test.skip();
+ return;
+ }
+ // Then navigate to AgentBridge
+ await page.goto("/dashboard/tools/agent-bridge");
+ await page.waitForLoadState("networkidle");
+ // Page should render without errors
+ const errorBoundary = page.locator("[data-testid='error-boundary'], text=Something went wrong");
+ await expect(errorBoundary).not.toBeVisible();
+ await expect(page.locator("body")).toBeVisible();
+ });
+
+ test("Traffic Inspector shows AgentBridge mode as always-on in capture sources", async ({ page }) => {
+ await page.goto("/dashboard/tools/traffic-inspector");
+ await page.waitForLoadState("networkidle");
+ if (!(await isAuthenticated(page))) {
+ test.skip();
+ return;
+ }
+ // AgentBridge capture mode should be shown as active/always-on
+ const agentBridgeToggle = page.locator(
+ "[data-testid='capture-agent-bridge'], [aria-label*='AgentBridge'], text=AgentBridge"
+ ).first();
+ await expect(agentBridgeToggle).toBeVisible({ timeout: 5000 });
+ });
+});
diff --git a/tests/e2e/agent-bridge.spec.ts b/tests/e2e/agent-bridge.spec.ts
new file mode 100644
index 0000000000..2c64df9766
--- /dev/null
+++ b/tests/e2e/agent-bridge.spec.ts
@@ -0,0 +1,160 @@
+/**
+ * E2E — AgentBridge page smoke tests
+ *
+ * These tests require the OmniRoute server to be running at http://localhost:20128
+ * (or the URL in PLAYWRIGHT_BASE_URL / baseURL in playwright.config.ts).
+ *
+ * CI behaviour: tests are marked `.skip` unless the env var
+ * `RUN_AGENT_BRIDGE_E2E=1` is set, since they require a full server process
+ * AND port 443 privileges (or mock). In CI the unit/integration suites provide
+ * functional coverage; the E2E layer verifies UI navigation and wiring.
+ *
+ * To run locally:
+ * RUN_AGENT_BRIDGE_E2E=1 npx playwright test tests/e2e/agent-bridge.spec.ts
+ */
+import { test, expect, type Page } from "@playwright/test";
+
+const SKIP = !process.env["RUN_AGENT_BRIDGE_E2E"];
+
+// ---------------------------------------------------------------------------
+// Helpers
+// ---------------------------------------------------------------------------
+
+async function navigateToAgentBridge(page: Page): Promise<void> {
+ await page.goto("/dashboard/tools/agent-bridge");
+ // Wait for the page to settle (auth redirect or dashboard render)
+ await page.waitForLoadState("networkidle");
+}
+
+// ---------------------------------------------------------------------------
+// Tests
+// ---------------------------------------------------------------------------
+
+test.describe("AgentBridge page", () => {
+ test.skip(SKIP, "Set RUN_AGENT_BRIDGE_E2E=1 to run AgentBridge E2E tests");
+
+ test("page renders and shows heading", async ({ page }) => {
+ await navigateToAgentBridge(page);
+ // Should render AgentBridge heading (login may redirect first — tolerate both)
+ const url = page.url();
+ if (url.includes("/login")) {
+ // Server is auth-protected; the page route itself exists
+ await expect(page.locator("body")).toBeVisible();
+ return;
+ }
+ await expect(page.locator("h1, [data-testid='agent-bridge-heading']").first()).toBeVisible();
+ });
+
+ test("page renders 9 agent cards (or empty-providers state)", async ({ page }) => {
+ await navigateToAgentBridge(page);
+ const url = page.url();
+ if (url.includes("/login")) {
+ test.skip();
+ return;
+ }
+ // Either: 9 agent cards are visible
+ // OR: empty-providers state is shown (no providers configured yet)
+ const agentCards = page.locator("[data-testid='agent-card']");
+ const emptyState = page.locator("[data-testid='empty-providers-state'], [data-testid='agent-bridge-empty']");
+
+ const cardCount = await agentCards.count();
+ const emptyVisible = await emptyState.isVisible().catch(() => false);
+
+ expect(cardCount === 9 || emptyVisible).toBe(true);
+ });
+
+ test("each agent card shows agent name", async ({ page }) => {
+ await navigateToAgentBridge(page);
+ const url = page.url();
+ if (url.includes("/login")) {
+ test.skip();
+ return;
+ }
+ const agentCards = page.locator("[data-testid='agent-card']");
+ const count = await agentCards.count();
+ if (count === 0) {
+ // Empty providers state — skip the rest
+ test.skip();
+ return;
+ }
+ expect(count).toBe(9);
+ // Spot-check: Antigravity and GitHub Copilot cards exist
+ await expect(page.locator("text=Antigravity").first()).toBeVisible();
+ await expect(page.locator("text=Copilot, text=GitHub Copilot").first()).toBeVisible().catch(async () => {
+ // Accept either name variant
+ await expect(page.locator("text=Copilot").first()).toBeVisible();
+ });
+ });
+
+ test("AgentBridge Server Card is visible", async ({ page }) => {
+ await navigateToAgentBridge(page);
+ const url = page.url();
+ if (url.includes("/login")) {
+ test.skip();
+ return;
+ }
+ const serverCard = page.locator(
+ "[data-testid='agent-bridge-server-card'], [data-testid='server-card']"
+ );
+ await expect(serverCard.first()).toBeVisible();
+ });
+
+ test("Setup wizard opens when Setup button is clicked", async ({ page }) => {
+ await navigateToAgentBridge(page);
+ const url = page.url();
+ if (url.includes("/login")) {
+ test.skip();
+ return;
+ }
+ const agentCards = page.locator("[data-testid='agent-card']");
+ const count = await agentCards.count();
+ if (count === 0) {
+ test.skip();
+ return;
+ }
+ // Click "Setup wizard" on the first card that has one visible
+ const setupButton = page.locator("[data-testid='setup-wizard-btn'], button:has-text('Setup wizard')").first();
+ const isVisible = await setupButton.isVisible().catch(() => false);
+ if (!isVisible) {
+ // All agents already set up — skip wizard open test
+ test.skip();
+ return;
+ }
+ await setupButton.click();
+ // Wizard modal should appear
+ const wizard = page.locator("[data-testid='setup-wizard'], [role='dialog']").first();
+ await expect(wizard).toBeVisible({ timeout: 5000 });
+ });
+
+ test("DNS toggle interaction does not crash the page", async ({ page }) => {
+ await navigateToAgentBridge(page);
+ const url = page.url();
+ if (url.includes("/login")) {
+ test.skip();
+ return;
+ }
+ const dnsToggle = page.locator("[data-testid='dns-toggle']").first();
+ const isVisible = await dnsToggle.isVisible().catch(() => false);
+ if (!isVisible) {
+ test.skip();
+ return;
+ }
+ // Click the toggle — may show a sudo prompt modal or update state
+ await dnsToggle.click();
+ // Page should not crash (no error boundary)
+ await expect(page.locator("[data-testid='error-boundary']")).not.toBeVisible();
+ await page.waitForTimeout(500);
+ await expect(page.locator("body")).toBeVisible();
+ });
+
+ test("redirect from /dashboard/system/mitm-proxy to agent-bridge", async ({ page }) => {
+ // Old mitm-proxy URL should redirect or show moved notice
+ await page.goto("/dashboard/system/mitm-proxy");
+ await page.waitForLoadState("networkidle");
+ const url = page.url();
+ // Should redirect to agent-bridge or show a moved banner
+ const isRedirected = url.includes("agent-bridge");
+ const hasBanner = await page.locator("text=moved, text=AgentBridge").first().isVisible().catch(() => false);
+ expect(isRedirected || hasBanner).toBe(true);
+ });
+});
diff --git a/tests/e2e/traffic-inspector.spec.ts b/tests/e2e/traffic-inspector.spec.ts
new file mode 100644
index 0000000000..3afe4c131a
--- /dev/null
+++ b/tests/e2e/traffic-inspector.spec.ts
@@ -0,0 +1,212 @@
+/**
+ * E2E — Traffic Inspector page smoke tests
+ *
+ * These tests require the OmniRoute server to be running at the configured base URL.
+ * The WebSocket tests use a mock event source rather than a live MITM capture to
+ * avoid needing port 443 privileges.
+ *
+ * CI behaviour: marked `.skip` unless `RUN_TRAFFIC_INSPECTOR_E2E=1` is set.
+ *
+ * To run locally:
+ * RUN_TRAFFIC_INSPECTOR_E2E=1 npx playwright test tests/e2e/traffic-inspector.spec.ts
+ */
+import { test, expect, type Page } from "@playwright/test";
+
+const SKIP = !process.env["RUN_TRAFFIC_INSPECTOR_E2E"];
+
+// ---------------------------------------------------------------------------
+// Helpers
+// ---------------------------------------------------------------------------
+
+async function navigateToInspector(page: Page): Promise<void> {
+ await page.goto("/dashboard/tools/traffic-inspector");
+ await page.waitForLoadState("networkidle");
+}
+
+async function isAuthenticated(page: Page): Promise<boolean> {
+ return !page.url().includes("/login");
+}
+
+// ---------------------------------------------------------------------------
+// Tests
+// ---------------------------------------------------------------------------
+
+test.describe("Traffic Inspector page", () => {
+ test.skip(SKIP, "Set RUN_TRAFFIC_INSPECTOR_E2E=1 to run Traffic Inspector E2E tests");
+
+ test("page renders with heading", async ({ page }) => {
+ await navigateToInspector(page);
+ if (!(await isAuthenticated(page))) {
+ await expect(page.locator("body")).toBeVisible();
+ return;
+ }
+ await expect(
+ page.locator("h1, [data-testid='traffic-inspector-heading']").first()
+ ).toBeVisible();
+ });
+
+ test("capture sources toolbar is visible", async ({ page }) => {
+ await navigateToInspector(page);
+ if (!(await isAuthenticated(page))) {
+ test.skip();
+ return;
+ }
+ const toolbar = page.locator(
+ "[data-testid='capture-sources-toolbar'], [data-testid='capture-toolbar']"
+ ).first();
+ await expect(toolbar).toBeVisible({ timeout: 5000 });
+ });
+
+ test("filter bar is visible (profile selector + pause + clear)", async ({ page }) => {
+ await navigateToInspector(page);
+ if (!(await isAuthenticated(page))) {
+ test.skip();
+ return;
+ }
+ // Profile selector
+ const profileSelector = page.locator(
+ "[data-testid='profile-selector'], [aria-label*='profile'], text=LLM only"
+ ).first();
+ await expect(profileSelector).toBeVisible({ timeout: 5000 });
+
+ // Pause or Clear button should exist
+ const pauseOrClear = page.locator(
+ "button:has-text('Pause'), button:has-text('Clear'), [data-testid='pause-btn'], [data-testid='clear-btn']"
+ ).first();
+ await expect(pauseOrClear).toBeVisible();
+ });
+
+ test("request list panel renders (may be empty)", async ({ page }) => {
+ await navigateToInspector(page);
+ if (!(await isAuthenticated(page))) {
+ test.skip();
+ return;
+ }
+ // Left panel should be present (virtualized list container)
+ const requestList = page.locator(
+ "[data-testid='request-list'], [data-testid='streaming-list']"
+ ).first();
+ await expect(requestList).toBeVisible({ timeout: 5000 });
+ });
+
+ test("detail pane and tabs are visible", async ({ page }) => {
+ await navigateToInspector(page);
+ if (!(await isAuthenticated(page))) {
+ test.skip();
+ return;
+ }
+ const detailPane = page.locator(
+ "[data-testid='detail-pane'], [data-testid='details-panel']"
+ ).first();
+ await expect(detailPane).toBeVisible({ timeout: 5000 });
+
+ // At least Headers and Request tabs should exist
+ const headersTab = page.locator(
+ "button[role='tab']:has-text('Headers'), [data-testid='tab-headers']"
+ ).first();
+ await expect(headersTab).toBeVisible();
+
+ const requestTab = page.locator(
+ "button[role='tab']:has-text('Request'), [data-testid='tab-request']"
+ ).first();
+ await expect(requestTab).toBeVisible();
+ });
+
+ test("clicking a request row (if any) updates the detail pane", async ({ page }) => {
+ await navigateToInspector(page);
+ if (!(await isAuthenticated(page))) {
+ test.skip();
+ return;
+ }
+ // Wait for any rows to appear (up to 5s)
+ const firstRow = page.locator(
+ "[data-testid='request-row'], [data-testid='request-list'] > *"
+ ).first();
+ const hasRows = await firstRow.isVisible({ timeout: 5000 }).catch(() => false);
+ if (!hasRows) {
+ // Empty buffer — skip row interaction test
+ test.skip();
+ return;
+ }
+ await firstRow.click();
+ // Detail pane should now show non-empty content
+ const detailPane = page.locator("[data-testid='detail-pane'], [data-testid='details-panel']").first();
+ await expect(detailPane).not.toBeEmpty();
+ });
+
+ test("Record session button starts recording", async ({ page }) => {
+ await navigateToInspector(page);
+ if (!(await isAuthenticated(page))) {
+ test.skip();
+ return;
+ }
+ const recBtn = page.locator(
+ "button:has-text('Record session'), button:has-text('REC'), [data-testid='rec-btn']"
+ ).first();
+ const isVisible = await recBtn.isVisible().catch(() => false);
+ if (!isVisible) {
+ test.skip();
+ return;
+ }
+ await recBtn.click();
+ // Should show recording indicator
+ const recIndicator = page.locator(
+ "[data-testid='rec-indicator'], text=REC, [data-testid='session-recorder-bar']"
+ ).first();
+ await expect(recIndicator).toBeVisible({ timeout: 3000 });
+
+ // Stop recording
+ const stopBtn = page.locator(
+ "button:has-text('Stop'), [data-testid='stop-rec-btn']"
+ ).first();
+ if (await stopBtn.isVisible().catch(() => false)) {
+ await stopBtn.click();
+ }
+ });
+
+ test("Export .har button is present", async ({ page }) => {
+ await navigateToInspector(page);
+ if (!(await isAuthenticated(page))) {
+ test.skip();
+ return;
+ }
+ const exportBtn = page.locator(
+ "button:has-text('.har'), button:has-text('Export'), [data-testid='export-har-btn']"
+ ).first();
+ await expect(exportBtn).toBeVisible({ timeout: 5000 });
+ });
+
+ test("WebSocket live indicator is shown (connected or disconnected)", async ({ page }) => {
+ await navigateToInspector(page);
+ if (!(await isAuthenticated(page))) {
+ test.skip();
+ return;
+ }
+ // Either a green "live" dot or a "disconnected" message should be visible
+ const liveIndicator = page.locator(
+ "[data-testid='ws-status'], text=live, text=Disconnected, [data-testid='live-indicator']"
+ ).first();
+ await expect(liveIndicator).toBeVisible({ timeout: 8000 });
+ });
+
+ test("Replay button appears when a request is selected", async ({ page }) => {
+ await navigateToInspector(page);
+ if (!(await isAuthenticated(page))) {
+ test.skip();
+ return;
+ }
+ const firstRow = page.locator(
+ "[data-testid='request-row']"
+ ).first();
+ const hasRows = await firstRow.isVisible({ timeout: 5000 }).catch(() => false);
+ if (!hasRows) {
+ test.skip();
+ return;
+ }
+ await firstRow.click();
+ const replayBtn = page.locator(
+ "button:has-text('Replay'), [data-testid='replay-btn']"
+ ).first();
+ await expect(replayBtn).toBeVisible({ timeout: 3000 });
+ });
+});