feat(platform): surface customer next best actions
This commit is contained in:
@@ -238,6 +238,89 @@ test('dashboard keeps advanced customer workbench collapsed behind the service p
|
||||
expect(within(details as HTMLElement).getByText('车辆地图态势')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('dashboard gives a customer next best action directly on the first screen', async () => {
|
||||
window.history.replaceState(null, '', '/#/dashboard');
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
||||
const path = String(input);
|
||||
if (path.includes('/api/ops/health')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: {
|
||||
linkHealth: [],
|
||||
kafkaLag: 0,
|
||||
activeConnections: 15,
|
||||
redisOnlineKeys: 92,
|
||||
tdengineWritable: true,
|
||||
mysqlWritable: true,
|
||||
runtime: { requestTimeoutMs: 5000, amapWebJsConfigured: true, amapSecurityProxyEnabled: true, amapSecurityCodeExposed: false }
|
||||
},
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
if (path.includes('/api/dashboard/summary')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: {
|
||||
onlineVehicles: 92,
|
||||
activeToday: 120,
|
||||
frameToday: 21000,
|
||||
issueVehicles: 7,
|
||||
kafkaLag: 0,
|
||||
protocols: [],
|
||||
serviceStatuses: [],
|
||||
linkHealth: []
|
||||
},
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
if (path.includes('/api/vehicle-service/summary')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: {
|
||||
totalVehicles: 1033,
|
||||
boundVehicles: 988,
|
||||
onlineVehicles: 92,
|
||||
singleSourceVehicles: 170,
|
||||
multiSourceVehicles: 220,
|
||||
noDataVehicles: 15,
|
||||
identityRequiredVehicles: 9,
|
||||
serviceStatuses: [],
|
||||
protocols: [],
|
||||
missingSources: []
|
||||
},
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: { items: [], total: 0, limit: 8, offset: 0 },
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
});
|
||||
|
||||
render(<App />);
|
||||
|
||||
expect(await screen.findByRole('heading', { name: '客户车辆服务路径' })).toBeInTheDocument();
|
||||
const nextActionRegion = screen.getByLabelText('建议下一步');
|
||||
expect(within(nextActionRegion).getByText('建议下一步')).toBeInTheDocument();
|
||||
expect(within(nextActionRegion).getByText('先处理告警车辆')).toBeInTheDocument();
|
||||
expect(within(nextActionRegion).getByRole('button', { name: '建议下一步 优先 先处理告警车辆 进入告警' })).toBeInTheDocument();
|
||||
expect(within(nextActionRegion).getByRole('button', { name: '建议下一步 范围 选择一辆车复盘 车辆中心' })).toBeInTheDocument();
|
||||
expect(within(nextActionRegion).getByRole('button', { name: '建议下一步 时间窗 按同一范围交付数据 复制复盘包' })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('topbar frames customer work as a vehicle service delivery strip', () => {
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async () => ({
|
||||
ok: true,
|
||||
|
||||
Reference in New Issue
Block a user