2.0.0
Co-Authored-By: Quentin Torroba <quentin.torroba@mistral.ai> Co-Authored-By: Michel Thomazo <michel.thomazo@mistral.ai> Co-Authored-By: Clément Drouin <clement.drouin@mistral.ai> Co-Authored-By: Vincent Guilloux <vincent.guilloux@mistral.ai> Co-Authored-By: Clément Siriex <clement.sirieix@mistral.ai> Co-Authored-By: Kim-Adeline Miguel <kimadeline.miguel@mistral.ai> Co-Authored-By: Thaddee Tyl <thaddee.tyl@gmail.com> Co-Authored-By: David Brochart <david.brochart@gmail.com> Co-Authored-By: Joseph Guhlin <joseph.guhlin@gmail.com> Co-Authored-By: Thomas Kenbeek <thomaskenbeek@gmail.com> Co-Authored-By: Remenby31 <baptiste.cruvellier31@gmail.com>
This commit is contained in:
parent
79f215d91c
commit
d33db9fff8
217 changed files with 16911 additions and 4305 deletions
80
tests/snapshots/test_ui_snapshot_ask_user_question.py
Normal file
80
tests/snapshots/test_ui_snapshot_ask_user_question.py
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from textual.pilot import Pilot
|
||||
|
||||
from tests.snapshots.base_snapshot_test_app import BaseSnapshotTestApp
|
||||
from tests.snapshots.snap_compare import SnapCompare
|
||||
from vibe.cli.textual_ui.widgets.tools import ToolResultMessage
|
||||
from vibe.core.tools.builtins.ask_user_question import (
|
||||
Answer,
|
||||
AskUserQuestion,
|
||||
AskUserQuestionResult,
|
||||
)
|
||||
from vibe.core.types import ToolResultEvent
|
||||
|
||||
|
||||
class AskUserQuestionResultApp(BaseSnapshotTestApp):
|
||||
"""Test app that displays an AskUserQuestion tool result."""
|
||||
|
||||
async def on_mount(self) -> None:
|
||||
await super().on_mount()
|
||||
|
||||
result = AskUserQuestionResult(
|
||||
answers=[
|
||||
Answer(
|
||||
question="What programming language are you currently working with?",
|
||||
answer="Rust",
|
||||
is_other=False,
|
||||
),
|
||||
Answer(
|
||||
question="What type of project are you building?",
|
||||
answer="Web Application",
|
||||
is_other=False,
|
||||
),
|
||||
Answer(
|
||||
question="What editor or IDE do you prefer?",
|
||||
answer="VS Code",
|
||||
is_other=True,
|
||||
),
|
||||
],
|
||||
cancelled=False,
|
||||
)
|
||||
|
||||
event = ToolResultEvent(
|
||||
tool_name="ask_user_question",
|
||||
tool_class=AskUserQuestion,
|
||||
result=result,
|
||||
tool_call_id="test_call_id",
|
||||
)
|
||||
|
||||
messages_area = self.query_one("#messages")
|
||||
tool_result = ToolResultMessage(event, collapsed=True)
|
||||
await messages_area.mount(tool_result)
|
||||
|
||||
|
||||
def test_snapshot_ask_user_question_collapsed(snap_compare: SnapCompare) -> None:
|
||||
"""Test collapsed AskUserQuestion result shows summary."""
|
||||
|
||||
async def run_before(pilot: Pilot) -> None:
|
||||
await pilot.pause(0.1)
|
||||
|
||||
assert snap_compare(
|
||||
"test_ui_snapshot_ask_user_question.py:AskUserQuestionResultApp",
|
||||
terminal_size=(120, 20),
|
||||
run_before=run_before,
|
||||
)
|
||||
|
||||
|
||||
def test_snapshot_ask_user_question_expanded(snap_compare: SnapCompare) -> None:
|
||||
"""Test expanded AskUserQuestion result shows formatted Q&A pairs."""
|
||||
|
||||
async def run_before(pilot: Pilot) -> None:
|
||||
await pilot.pause(0.1)
|
||||
await pilot.press("ctrl+o")
|
||||
await pilot.pause(0.1)
|
||||
|
||||
assert snap_compare(
|
||||
"test_ui_snapshot_ask_user_question.py:AskUserQuestionResultApp",
|
||||
terminal_size=(120, 30),
|
||||
run_before=run_before,
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue