feat: 优化任务页面 UI 展示

This commit is contained in:
meijiali
2026-07-06 14:41:13 +08:00
parent da69819b56
commit 78cc5df73d
6 changed files with 158 additions and 42 deletions
+10 -7
View File
@@ -18,7 +18,8 @@ def test_index_page_renders_task_form_empty_state_and_default_scale():
assert 'name="item_limit_per_hotspot"' in response.text
assert 'name="comment_limit_per_item"' in response.text
assert "1250" in response.text
assert 'onclick="window.location.href=\'/\'"' in response.text
assert "手动刷新" not in response.text
assert 'onclick="window.location.href=\'/\'"' not in response.text
assert "还没有任何任务" in response.text
@@ -167,12 +168,13 @@ def test_running_task_detail_page_auto_polls_current_task():
assert response.status_code == 200
assert 'data-task-id="task-running"' in response.text
assert "pollTaskDetailStatus" in response.text
assert 'onclick="window.location.reload()"' in response.text
assert "手动刷新" not in response.text
assert 'onclick="window.location.reload()"' not in response.text
assert "已处理 1 / 共 2 条内容" in response.text
assert "AI 成功率 100%" in response.text
def test_task_detail_uses_short_number_title_and_keeps_full_uuid_for_diagnostics():
def test_task_detail_uses_short_number_title_and_hides_full_uuid():
task_id = "33333333-3333-4333-8333-333333333333"
with make_test_client() as (client, engine):
from sqlalchemy.orm import Session
@@ -197,8 +199,8 @@ def test_task_detail_uses_short_number_title_and_keeps_full_uuid_for_diagnostics
visible_text = BeautifulSoup(response.text, "html.parser").get_text(" ")
assert "<title>任务 1 - 热榜评论分析工具</title>" in response.text
assert "任务 1" in visible_text
assert "完整 ID" in visible_text
assert task_id in visible_text
assert "完整 ID" not in visible_text
assert task_id not in visible_text
assert "任务 #33333333-3333-4333-8333-333333333333" not in visible_text
assert "#" not in visible_text
assert "创建时间 2026-07-03 10:30" in visible_text
@@ -296,7 +298,7 @@ def test_running_task_detail_page_shows_stage_runtime_and_stale_progress_warning
response = client.get("/tasks/task-stale")
assert response.status_code == 200
assert "阶段AI 分析中" in response.text
assert "阶段 AI 分析中" in response.text
assert "运行时长" in response.text
assert "2小时5分钟" in response.text
assert "最近进度" in response.text
@@ -419,7 +421,8 @@ def test_result_pages_render_seeded_data():
assert task_response.status_code == 200
assert "热点标题" in task_response.text
assert "热点 1:热点标题" in BeautifulSoup(task_response.text, "html.parser").get_text(" ")
assert 'onclick="window.location.reload()"' in task_response.text
assert 'onclick="window.location.reload()"' not in task_response.text
assert "手动刷新" not in task_response.text
assert hotspot_response.status_code == 200
assert "热点总结" in hotspot_response.text
assert "downloadExport(" not in hotspot_response.text