"""End-to-end smoke test (TASK-05-06) — pytest entry point. Runs scripts/e2e_smoke.py::run_e2e and asserts the full loop: session → turns → branch → debrief → DB logged. """ from __future__ import annotations import asyncio import pytest from scripts.e2e_smoke import run_e2e def test_e2e_full_loop(tmp_db): """The full v0.1 loop completes and DB assertions pass (no live keys needed).""" result = asyncio.run(run_e2e(db_path=str(tmp_db))) assert result["branch_id"] in ("accept_resolution", "escalate") assert result["turns_logged"] == 4 assert result["cost_cents"] >= 0 assert result["debrief_chars"] > 0 # Latency is logged (within or over budget); the test asserts it's logged, # not that it's within budget (that requires live keys + real network). assert result["max_latency_ms"] > 0 assert result["budget_ms"] == 600.0 def test_e2e_debrief_non_empty(tmp_db): """The debrief text is non-empty (TASK-05-06 must-have).""" result = asyncio.run(run_e2e(db_path=str(tmp_db))) assert result["debrief_chars"] > 50 # a real debrief is more than a stub def test_e2e_cost_non_null(tmp_db): """cost_estimated_cents is non-null for a completed session (TASK-05-06 must-have).""" result = asyncio.run(run_e2e(db_path=str(tmp_db))) assert result["cost_cents"] is not None