Co-authored-by: Clément Drouin <clement.drouin@mistral.ai>
Co-authored-by: Clément Sirieix <clement.sirieix@mistral.ai>
Co-authored-by: Guillaume LE GOFF <guillaume.lgf@gmail.com>
Co-authored-by: Mert Unsal <mertunsal1905@gmail.com>
Co-authored-by: Michel Thomazo <51709227+michelTho@users.noreply.github.com>
Co-authored-by: Quentin <quentin.torroba@mistral.ai>
Co-authored-by: Val <102326092+vdeva@users.noreply.github.com>
Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com>
Co-authored-by: maximevoisin-pm <maxime.voisin@mistral.ai>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Mathias Gesbert 2026-05-27 17:10:40 +02:00 committed by GitHub
parent adb1ca74ce
commit cf3f4ca58f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
143 changed files with 3457 additions and 1351 deletions

View file

@ -1,22 +1,15 @@
from __future__ import annotations
from unittest.mock import patch
from textual.pilot import Pilot
from tests.snapshots.base_snapshot_test_app import BaseSnapshotTestApp, default_config
from tests.snapshots.snap_compare import SnapCompare
from tests.stubs.fake_connector_registry import FakeConnectorRegistry
from tests.stubs.fake_mcp_registry import (
FakeMCPRegistry,
FakeMCPRegistryWithBrokenServer,
)
from tests.stubs.fake_mcp_registry import FakeMCPRegistryWithBrokenServer
from vibe.core.config import MCPHttp, MCPStdio
from vibe.core.tools.connectors import ConnectorAuthAction
from vibe.core.tools.mcp.tools import RemoteTool
_MCP_PATCH = "vibe.core.agent_loop.MCPRegistry"
_FAKE_CONNECTORS = {
"gmail": [
RemoteTool(name="gmail_search", description="Search emails in Gmail"),
@ -55,7 +48,7 @@ class SnapshotTestAppWithBrokenMcpServer(BaseSnapshotTestApp):
),
MCPHttp(name="search", transport="http", url="http://localhost:8080"),
]
super().__init__(config=config)
super().__init__(config=config, mcp_registry=FakeMCPRegistryWithBrokenServer())
class SnapshotTestAppWithMcpServers(BaseSnapshotTestApp):
@ -92,24 +85,22 @@ def test_snapshot_mcp_broken_server(snap_compare: SnapCompare) -> None:
async def run_before(pilot: Pilot) -> None:
await _run_mcp_command(pilot, "/mcp")
with patch(_MCP_PATCH, FakeMCPRegistryWithBrokenServer):
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithBrokenMcpServer",
terminal_size=(120, 36),
run_before=run_before,
)
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithBrokenMcpServer",
terminal_size=(120, 36),
run_before=run_before,
)
def test_snapshot_mcp_overview(snap_compare: SnapCompare) -> None:
async def run_before(pilot: Pilot) -> None:
await _run_mcp_command(pilot, "/mcp")
with patch(_MCP_PATCH, FakeMCPRegistry):
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithMcpServers",
terminal_size=(120, 36),
run_before=run_before,
)
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithMcpServers",
terminal_size=(120, 36),
run_before=run_before,
)
def test_snapshot_mcp_overview_navigate_down(snap_compare: SnapCompare) -> None:
@ -118,12 +109,11 @@ def test_snapshot_mcp_overview_navigate_down(snap_compare: SnapCompare) -> None:
await pilot.press("down")
await pilot.pause(0.1)
with patch(_MCP_PATCH, FakeMCPRegistry):
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithMcpServers",
terminal_size=(120, 36),
run_before=run_before,
)
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithMcpServers",
terminal_size=(120, 36),
run_before=run_before,
)
def test_snapshot_mcp_enter_drills_into_server(snap_compare: SnapCompare) -> None:
@ -135,12 +125,11 @@ def test_snapshot_mcp_enter_drills_into_server(snap_compare: SnapCompare) -> Non
await pilot.pause(0.1)
await pilot.press("enter")
with patch(_MCP_PATCH, FakeMCPRegistry):
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithMcpServers",
terminal_size=(120, 36),
run_before=run_before,
)
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithMcpServers",
terminal_size=(120, 36),
run_before=run_before,
)
def test_snapshot_mcp_server_arg(snap_compare: SnapCompare) -> None:
@ -148,12 +137,11 @@ def test_snapshot_mcp_server_arg(snap_compare: SnapCompare) -> None:
await _run_mcp_command(pilot, "/mcp filesystem")
await pilot.pause(0.1)
with patch(_MCP_PATCH, FakeMCPRegistry):
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithMcpServers",
terminal_size=(120, 36),
run_before=run_before,
)
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithMcpServers",
terminal_size=(120, 36),
run_before=run_before,
)
def test_snapshot_mcp_backspace_returns_to_overview(snap_compare: SnapCompare) -> None:
@ -162,12 +150,11 @@ def test_snapshot_mcp_backspace_returns_to_overview(snap_compare: SnapCompare) -
await pilot.press("backspace")
await pilot.pause(0.1)
with patch(_MCP_PATCH, FakeMCPRegistry):
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithMcpServers",
terminal_size=(120, 36),
run_before=run_before,
)
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithMcpServers",
terminal_size=(120, 36),
run_before=run_before,
)
def test_snapshot_mcp_escape_closes(snap_compare: SnapCompare) -> None:
@ -176,12 +163,11 @@ def test_snapshot_mcp_escape_closes(snap_compare: SnapCompare) -> None:
await pilot.press("escape")
await pilot.pause(0.2)
with patch(_MCP_PATCH, FakeMCPRegistry):
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithMcpServers",
terminal_size=(120, 36),
run_before=run_before,
)
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithMcpServers",
terminal_size=(120, 36),
run_before=run_before,
)
def test_snapshot_mcp_refresh_shortcut(snap_compare: SnapCompare) -> None:
@ -190,12 +176,11 @@ def test_snapshot_mcp_refresh_shortcut(snap_compare: SnapCompare) -> None:
await pilot.press("r")
await pilot.pause(0.2)
with patch(_MCP_PATCH, FakeMCPRegistry):
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithMcpServers",
terminal_size=(120, 36),
run_before=run_before,
)
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithMcpServers",
terminal_size=(120, 36),
run_before=run_before,
)
# ---------------------------------------------------------------------------
@ -274,12 +259,11 @@ def test_snapshot_mcp_with_connectors_overview(snap_compare: SnapCompare) -> Non
async def run_before(pilot: Pilot) -> None:
await _run_mcp_command(pilot, "/mcp")
with patch(_MCP_PATCH, FakeMCPRegistry):
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithConnectors",
terminal_size=(120, 36),
run_before=run_before,
)
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithConnectors",
terminal_size=(120, 36),
run_before=run_before,
)
# ---------------------------------------------------------------------------
@ -399,12 +383,11 @@ def test_snapshot_mcp_drill_into_connector(snap_compare: SnapCompare) -> None:
await pilot.press("enter") # drill in
await pilot.pause(0.1)
with patch(_MCP_PATCH, FakeMCPRegistry):
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithConnectors",
terminal_size=(120, 36),
run_before=run_before,
)
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithConnectors",
terminal_size=(120, 36),
run_before=run_before,
)
def test_snapshot_mcp_connector_back_to_overview(snap_compare: SnapCompare) -> None:
@ -418,9 +401,8 @@ def test_snapshot_mcp_connector_back_to_overview(snap_compare: SnapCompare) -> N
await pilot.press("backspace")
await pilot.pause(0.1)
with patch(_MCP_PATCH, FakeMCPRegistry):
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithConnectors",
terminal_size=(120, 36),
run_before=run_before,
)
assert snap_compare(
"test_ui_snapshot_mcp_command.py:SnapshotTestAppWithConnectors",
terminal_size=(120, 36),
run_before=run_before,
)