Co-authored-by: Hdandria <henri.dandria@mistral.ai> Co-authored-by: Liam Lyons <65613603+lyons-liam@users.noreply.github.com> Co-authored-by: Mathias Gesbert <mathias.gesbert@mistral.ai> Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai> Co-authored-by: Quentin <quentin.torroba@mistral.ai> Co-authored-by: allansimon-mistral <allan.simon@ext.mistral.ai> Co-authored-by: angelapopopo <angele.lenglemetz@mistral.ai> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
51 lines
1.4 KiB
Python
51 lines
1.4 KiB
Python
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.session_picker import SessionPickerApp
|
|
from vibe.core.session.resume_sessions import ResumeSessionInfo
|
|
|
|
_SESSIONS = [
|
|
ResumeSessionInfo(
|
|
session_id="local-session-0001",
|
|
source="local",
|
|
cwd="/test/workdir",
|
|
title="Refactor the auth module",
|
|
end_time=None,
|
|
),
|
|
ResumeSessionInfo(
|
|
session_id="remote-session-0002",
|
|
source="remote",
|
|
cwd="",
|
|
title="Vibe Code",
|
|
end_time=None,
|
|
status="RUNNING",
|
|
),
|
|
]
|
|
|
|
_LATEST_MESSAGES = {
|
|
_SESSIONS[0].option_id: "Refactor the auth module",
|
|
_SESSIONS[1].option_id: "Vibe Code (running)",
|
|
}
|
|
|
|
|
|
class SessionPickerTestApp(BaseSnapshotTestApp):
|
|
async def on_mount(self) -> None:
|
|
await super().on_mount()
|
|
picker = SessionPickerApp(
|
|
sessions=_SESSIONS, latest_messages=_LATEST_MESSAGES, cwd="/test/workdir"
|
|
)
|
|
await self._switch_from_input(picker)
|
|
|
|
|
|
def test_snapshot_session_picker_header(snap_compare: SnapCompare) -> None:
|
|
async def run_before(pilot: Pilot) -> None:
|
|
await pilot.pause(0.2)
|
|
|
|
assert snap_compare(
|
|
"test_ui_snapshot_session_picker.py:SessionPickerTestApp",
|
|
terminal_size=(100, 36),
|
|
run_before=run_before,
|
|
)
|