feat(test-case): 测试耗时自动计算(逻辑同开发任务)

- TestCase 新增 startedAt / completedAt 字段
- 流转到"执行中"时记录 startedAt
- 流转到"通过/失败/阻塞"时记录 completedAt
- 回退到执行中时清除 completedAt
- 测试耗时 = startedAt → completedAt 工作日 × 8h
- 列表行显示耗时,详情抽屉显示开始/完成/耗时

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Script Generator
2026-06-12 15:38:48 +08:00
parent 452cbb4671
commit 8b3b3b7e21
4 changed files with 16 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ import { useTestCaseStore } from '@/stores/useTestCaseStore';
import { useBugStore } from '@/stores/useBugStore';
import { useRequirementStore } from '@/stores/useRequirementStore';
import { TC_ALLOWED_TRANSITIONS, TEST_CASE_STATUS_LABEL } from '@/lib/test-case';
import { calcActualHoursByDates } from '@/lib/dev-task';
import { BUG_SEVERITY_LABEL, BUG_SEVERITY_COLOR } from '@/lib/bug';
import type { TestCaseStatus } from '@/lib/test-case';
@@ -126,6 +127,9 @@ export function TestCaseDetailDrawer({ testCaseId, onClose, onCreateBug }: Props
<div><span className="text-[var(--ink-muted)]"></span><span className="text-[var(--ink)] font-medium">{tc.assigneeId || '-'}</span></div>
<div><span className="text-[var(--ink-muted)]"></span><span className="text-[var(--ink)]">{tc.createdBy}</span></div>
<div><span className="text-[var(--ink-muted)]"></span><span className="text-[var(--ink)]">{tc.createdAt.slice(0, 10)}</span></div>
{tc.startedAt && <div><span className="text-[var(--ink-muted)]"></span><span className="text-[var(--ink)]">{tc.startedAt}</span></div>}
{tc.completedAt && <div><span className="text-[var(--ink-muted)]"></span><span className="text-[var(--ink)]">{tc.completedAt}</span></div>}
{tc.startedAt && <div><span className="text-[var(--ink-muted)]"></span><span className="text-[var(--ink)] font-medium">{calcActualHoursByDates(tc.startedAt, tc.completedAt)}h</span></div>}
</div>
</div>