import pathlib ROOT=pathlib.Path(__file__).resolve().parents[1] def test_version_393(): assert (ROOT/"VERSION").read_text(encoding="utf-8").strip()=="4.6.15" def test_frontend_lifecycle_progress(): js=(ROOT/"static"/"js"/"app.js").read_text(encoding="utf-8") for name in ("ensureChatLifecycle","updateChatLifecycle","startChatLifecycleTimer","finishChatLifecycle"): assert f"function {name}" in js assert "秒没有收到新的服务事件" in js assert "1/5 · 解析请求" in js def test_backend_structured_stage_events(): rt=(ROOT/"services"/"chat_runtime.py").read_text(encoding="utf-8") assert '"step":2' in rt assert '"step":3' in rt assert '"step":4' in rt def test_download_progress_still_present(): js=(ROOT/"static"/"js"/"app.js").read_text(encoding="utf-8") assert "function downloadWithProgress" in js assert "seconds_since_activity" in js or "秒无新字节" in js def test_lifecycle_css(): css=(ROOT/"static"/"css"/"app.css").read_text(encoding="utf-8") assert ".chat-task-progress" in css assert ".chat-task-progress.stale" in css assert ".chat-task-progress.done" in css