Skip to content

Commit 3970581

Browse files
committed
修复小程序蓝本测试返回bugs和steps详情+step_number
1 parent 6b4651b commit 3970581

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

src/api/routes.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,7 @@ def _to_action(s: str) -> ActionType:
654654
severity=BugSeverity.MEDIUM,
655655
title=f"步骤{r.get('step')}失败: {r.get('action')}",
656656
description=r.get("error", ""),
657+
step_number=r.get("step"),
657658
))
658659

659660
total = len(steps_results)
@@ -676,6 +677,8 @@ def _to_action(s: str) -> ActionType:
676677
)
677678

678679
pass_rate = passed / total * 100 if total > 0 else 0
680+
681+
from src.api.models import StepDetail, BugDetail
679682
return TestReportResponse(
680683
test_name=report.test_name,
681684
url=report.url,
@@ -686,6 +689,27 @@ def _to_action(s: str) -> ActionType:
686689
pass_rate=pass_rate,
687690
duration_seconds=report.duration_seconds,
688691
report_markdown=report.report_markdown,
692+
steps=[
693+
StepDetail(
694+
step=r.step,
695+
action=r.action.value if hasattr(r.action, 'value') else str(r.action),
696+
description=r.description,
697+
status=r.status.value if hasattr(r.status, 'value') else str(r.status),
698+
duration_seconds=r.duration_seconds,
699+
error_message=r.error_message,
700+
screenshot_path=r.screenshot_path,
701+
)
702+
for r in steps_results
703+
],
704+
bugs=[
705+
BugDetail(
706+
severity=b.severity.value if hasattr(b.severity, 'value') else str(b.severity),
707+
title=b.title,
708+
description=b.description,
709+
step_number=b.step_number,
710+
)
711+
for b in bugs
712+
],
689713
)
690714
except HTTPException:
691715
raise

0 commit comments

Comments
 (0)