fix: 增加任务详情自动刷新
This commit is contained in:
@@ -42,6 +42,31 @@ def test_index_page_lists_existing_tasks():
|
||||
assert "运行中" in response.text
|
||||
|
||||
|
||||
def test_running_task_detail_page_auto_polls_current_task():
|
||||
with make_test_client() as (client, engine):
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
with Session(engine) as session:
|
||||
session.add(
|
||||
Task(
|
||||
id="task-running",
|
||||
platform="xiaohongshu",
|
||||
status="running",
|
||||
hotspot_limit=1,
|
||||
item_limit_per_hotspot=1,
|
||||
comment_limit_per_item=10,
|
||||
)
|
||||
)
|
||||
session.commit()
|
||||
|
||||
response = client.get("/tasks/task-running")
|
||||
|
||||
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
|
||||
|
||||
|
||||
def seed_result_data(engine):
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
@@ -119,7 +144,7 @@ def test_result_pages_render_seeded_data():
|
||||
|
||||
assert task_response.status_code == 200
|
||||
assert "热点标题" in task_response.text
|
||||
assert 'onclick="window.location.href=\'/\'"' in task_response.text
|
||||
assert 'onclick="window.location.reload()"' in task_response.text
|
||||
assert hotspot_response.status_code == 200
|
||||
assert "热点总结" in hotspot_response.text
|
||||
assert item_response.status_code == 200
|
||||
|
||||
Reference in New Issue
Block a user