106 lines
3.4 KiB
TypeScript
106 lines
3.4 KiB
TypeScript
import { expect, test } from '@playwright/test';
|
|
|
|
test('待人工审批任务显示状态与确认卡编号', async ({ page }) => {
|
|
await page.route('**/api/health', async route => {
|
|
await route.fulfill({
|
|
status: 200,
|
|
contentType: 'application/json',
|
|
body: JSON.stringify({ interfaceVersion: '1.0', authProvider: 'local', licenseProvider: 'local' }),
|
|
});
|
|
});
|
|
await page.route('**/api/auth/me', async route => {
|
|
await route.fulfill({
|
|
status: 200,
|
|
contentType: 'application/json',
|
|
body: JSON.stringify({
|
|
user: {
|
|
user_id: 'user-1', username: 'e2e', fullname: 'E2E', tenant_uuid: 'tenant-1',
|
|
roles: ['admin'], auth_kind: 'user',
|
|
},
|
|
provider: 'local',
|
|
license: null,
|
|
}),
|
|
});
|
|
});
|
|
await page.route('**/api/features', async route => {
|
|
await route.fulfill({
|
|
status: 200,
|
|
contentType: 'application/json',
|
|
body: JSON.stringify({
|
|
version: 1, source: 'default', path: '', error: null, unknown: [],
|
|
features: { mesh: { enabled: true, label: '多智能体编排' } },
|
|
}),
|
|
});
|
|
});
|
|
await page.route('**/api/workspace', async route => {
|
|
await route.fulfill({
|
|
status: 200,
|
|
contentType: 'application/json',
|
|
body: JSON.stringify({
|
|
projects: [],
|
|
sessions: [{
|
|
id: 'session-1', projectId: '__personal__', title: 'E2E', status: 'running',
|
|
updatedAt: '2026-09-12 10:00:00', scope: 'personal',
|
|
}],
|
|
files: [],
|
|
messages: { 'session-1': [] },
|
|
activeProjectId: '__personal__',
|
|
activeSessionId: 'session-1',
|
|
}),
|
|
});
|
|
});
|
|
await page.route('**/api/mesh/state', async route => {
|
|
await route.fulfill({
|
|
status: 200,
|
|
contentType: 'application/json',
|
|
body: JSON.stringify({
|
|
agents: [],
|
|
goals: [{
|
|
id: 'goal-1',
|
|
title: '锐扬排产全流程',
|
|
template: 'aps-full-flow',
|
|
status: 'ATTENTION',
|
|
createdBy: 'USER',
|
|
runId: 'run-1',
|
|
createdAt: '2026-09-12 10:00:00',
|
|
tasks: [{
|
|
id: 'task-1',
|
|
goalId: 'goal-1',
|
|
key: 'schedule',
|
|
title: '生成一版试排',
|
|
intent: 'flex.schedule',
|
|
role: 'scheduler',
|
|
params: {},
|
|
dependsOn: [],
|
|
status: 'AWAITING_APPROVAL',
|
|
assigneeAgentId: 'agent-1',
|
|
assigneeName: '柔性排产智能体-1',
|
|
attempts: 1,
|
|
result: '等待人工审批后继续',
|
|
error: null,
|
|
confirmationIds: ['confirm-123', 'confirm-456'],
|
|
startedAt: '2026-09-12 10:00:01',
|
|
finishedAt: null,
|
|
}],
|
|
watchdog: { stallTimeoutSec: 45, maxRetries: 1 },
|
|
}],
|
|
messages: [],
|
|
watchdog: { enabled: true, stallTimeoutSec: 45, maxRetries: 1, lastTickAt: null, alerts: [] },
|
|
roleTemplates: [],
|
|
goalTemplates: [],
|
|
}),
|
|
});
|
|
});
|
|
|
|
await page.goto('/');
|
|
const meshButton = page.locator('button[data-tip="多智能体编排"]');
|
|
await expect(meshButton).toBeVisible();
|
|
await meshButton.click();
|
|
|
|
await expect(page.locator('.mesh-panel')).toBeVisible();
|
|
await expect(page.getByText('待人工审批', { exact: true })).toBeVisible();
|
|
const approval = page.locator('.mesh-task-approval');
|
|
await expect(approval).toContainText('confirm-123');
|
|
await expect(approval).toContainText('confirm-456');
|
|
});
|