feat(platform): add realtime time-window monitoring
This commit is contained in:
@@ -9106,6 +9106,22 @@ test('frames realtime page as one vehicle service with source evidence', async (
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('定位影响:1 辆有有效坐标'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('服务影响:0 辆降级 / 1 辆超时'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('地图能力:高德地图未配置,使用坐标预览'));
|
||||
expect(screen.getByText('自定义时间监控')).toBeInTheDocument();
|
||||
expect(screen.getByText('按车辆和时间窗复盘发生了什么')).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '时间窗监控 轨迹回放 打开轨迹' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '时间窗监控 历史数据 查询历史' })).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button', { name: /复制时间窗包/ }));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【客户时间窗监控包】'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('历史数据:http://localhost:3000/#/history-query?keyword=VIN-RT-SERVICE&protocol=GB32960'));
|
||||
fireEvent.click(screen.getByRole('button', { name: '时间窗监控 历史数据 查询历史' }));
|
||||
await waitFor(() => {
|
||||
const params = new URLSearchParams(window.location.hash.split('?')[1] ?? '');
|
||||
expect(window.location.hash).toContain('#/history-query?');
|
||||
expect(params.get('keyword')).toBe('VIN-RT-SERVICE');
|
||||
expect(params.get('protocol')).toBe('GB32960');
|
||||
expect(params.get('dateFrom')).toBeTruthy();
|
||||
expect(params.get('dateTo')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
test('refreshes realtime vehicle data from the monitoring workspace', async () => {
|
||||
@@ -9224,6 +9240,36 @@ test('shows realtime freshness status for recently updated and stale vehicles',
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
if (path.includes('/api/alert-events/summary')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: { issueVehicleCount: 0, issueRecordCount: 0, errorCount: 0, warningCount: 0, protocols: [], issueTypes: [] },
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
if (path.includes('/api/alert-events/notification-plan')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: { rules: [], policies: [], priorityIssues: [], activeRuleCount: 0, p0RuleCount: 0 },
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
if (path.includes('/api/alert-events')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: { items: [], total: 0, limit: 50, offset: 0 },
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
@@ -9285,6 +9331,20 @@ test('shows realtime freshness status for recently updated and stale vehicles',
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【地图客户决策说明】'));
|
||||
});
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('定位判断:2 辆有有效坐标 / 0 辆无坐标'));
|
||||
expect(screen.getByText('自定义时间监控')).toBeInTheDocument();
|
||||
expect(screen.getByText('按车辆和时间窗复盘发生了什么')).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button', { name: /复制时间窗包/ }));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【客户时间窗监控包】'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('告警通知:http://localhost:3000/#/alert-events?keyword=VIN-STALE-001&protocol=JT808'));
|
||||
fireEvent.click(screen.getByRole('button', { name: '时间窗监控 告警通知 查看告警' }));
|
||||
await waitFor(() => {
|
||||
const params = new URLSearchParams(window.location.hash.split('?')[1] ?? '');
|
||||
expect(window.location.hash).toContain('#/alert-events?');
|
||||
expect(params.get('keyword')).toBe('VIN-STALE-001');
|
||||
expect(params.get('protocol')).toBe('JT808');
|
||||
expect(params.get('dateFrom')).toBeTruthy();
|
||||
expect(params.get('dateTo')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
test('exports current realtime vehicles as CSV', async () => {
|
||||
|
||||
Reference in New Issue
Block a user