import { render, screen } from "@testing-library/react"; import { expect, test } from "vitest"; import { WorkflowDetail } from "@/features/workflows/workflow-detail"; import type { WorkflowDetailVM } from "@/lib/types/view-models"; const BASE_WORKFLOW_DETAIL: WorkflowDetailVM = { orderId: 101, workflowId: "wf-101", workflowType: "mid_end", status: "waiting_review", statusMeta: { label: "待审核", tone: "warning", }, currentStep: "review", currentStepLabel: "人工审核", currentRevisionAssetId: null, currentRevisionVersion: null, latestRevisionAssetId: null, latestRevisionVersion: null, revisionCount: 0, reviewTaskStatus: null, pendingManualConfirm: false, createdAt: "2026-03-27T00:00:00Z", updatedAt: "2026-03-27T00:10:00Z", steps: [ { id: 11, workflowRunId: 9001, name: "fusion", label: "融合", status: "failed", statusMeta: { label: "失败", tone: "danger", }, input: null, output: null, errorMessage: "Temporal activity timed out.", startedAt: "2026-03-27T00:06:00Z", endedAt: "2026-03-27T00:07:00Z", containsMockAssets: false, mockAssetUris: [], previewUri: null, isCurrent: false, isFailed: true, }, { id: 12, workflowRunId: 9001, name: "review", label: "人工审核", status: "waiting", statusMeta: { label: "等待人工处理", tone: "warning", }, input: null, output: { preview_uri: "mock://fusion-preview", }, errorMessage: null, startedAt: "2026-03-27T00:09:00Z", endedAt: null, containsMockAssets: true, mockAssetUris: ["mock://fusion-preview"], previewUri: "mock://fusion-preview", isCurrent: true, isFailed: false, }, ], stepTimelineState: { kind: "ready", }, failureCount: 1, hasMockAssets: true, }; test("highlights failed steps and mock asset hints in the workflow timeline", () => { render(); expect(screen.getByText("失败步骤 1 个")).toBeInTheDocument(); expect(screen.getByText("Temporal activity timed out.")).toBeInTheDocument(); expect(screen.getByText("当前流程包含 mock 资产")).toBeInTheDocument(); }); test("renders image previews for real workflow step outputs", () => { render( , ); expect(screen.getByAltText("场景处理预览")).toBeInTheDocument(); });