import assert from 'node:assert/strict' import { createRequire } from 'node:module' import { mkdir, writeFile, unlink } from 'node:fs/promises' import { resolve } from 'node:path' const require = createRequire(import.meta.url) const { chromium } = require(process.env.PM_PLAYWRIGHT || 'C:/Users/Administrator/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules/playwright') const frontend = process.env.PM_FRONTEND_URL || 'http://127.0.0.1:8093' const file = resolve('ruoyi-ui-vue3/node_modules/.vite-pm/flow-view-render.html') const stages = ['方案设计', '前端开发', '后端开发', '验收发布'].map((name, index) => ({ id: index + 1, name, sortOrder: [2, 3, 3, 4][index], ownerId: 1, ownerName: '张浩', description: '', version: 0, counts: { total: 0, READY: 0, IN_PROGRESS: 0, COMPLETED: 0, CANCELLED: 0, blocked: 0, scheduleIncomplete: 0 }, plannedStartAt: '2026-10-20T09:00:00+08:00', plannedEndAt: '2026-10-24T18:00:00+08:00', fullyScheduled: 0 })) const names = ['客户门户升级', '技术方案设计', '前端页面开发', '接口开发', '联调与验收测试', '版本发布'] const items = names.map((title, index) => ({ id: index + 1, projectId: 1, stageId: [1, 1, 2, 3, 4, 4][index], type: index ? 'TASK' : 'REQUIREMENT', title, description: '', assigneeId: 1, priority: 'MEDIUM', status: index < 2 ? 'COMPLETED' : index === 2 ? 'IN_PROGRESS' : 'READY', version: 0, timezone: 'Asia/Shanghai', plannedStartAt: '2026-10-20T09:00:00+08:00', plannedEndAt: '2026-10-24T18:00:00+08:00', actualStartAt: null, actualEndAt: null, canStart: index === 3, blockedReasons: [], dependencyConditions: [], dependencyBlocked: index > 3, scheduleConstraints: { scheduleValidationStatus: 'VALID', sources: [], scheduleBlockedReasons: [], earliestPlannedStartAt: null } })) const layout = { version: 0, positions: {}, collapsedStages: [], viewport: null, filters: null } const view = { stages, items, unassigned: { counts: { total: 0 }, fullyScheduled: 0 }, dependencies: [[2, 3], [2, 4], [3, 5], [4, 5], [5, 6]].map(([source, target], index) => ({ id: index + 1, predecessorTaskId: source, successorTaskId: target, version: 0 })), sharedLayout: layout, personalLayout: layout } for (const item of items) { item.dependencyConditions = view.dependencies.filter(edge => edge.successorTaskId === item.id).map(edge => { const source = items.find(other => other.id === edge.predecessorTaskId); return { id: edge.id, version: 0, conditionType: 'TASK_COMPLETED', sourceId: source.id, sourceWorkItemId: source.id, sourceName: source.title, currentStatus: source.status, expectedStatus: 'COMPLETED', satisfied: source.status === 'COMPLETED', participatesInSchedule: true } }); const stage = stages.find(value => value.id === item.stageId); stage.counts.total++; stage.counts[item.status]++; stage.counts.blocked += Number(item.dependencyBlocked); stage.fullyScheduled++ } // 仅视觉/第三方真实画布验收夹具,不替代 flow-view-ui-check 的真实登录与数据库业务验收。 const html = `