feat(platform): highlight customer service modules

This commit is contained in:
lingniu
2026-07-06 04:35:27 +08:00
parent 2aa7b394a6
commit aefd34bc59
3 changed files with 198 additions and 0 deletions

View File

@@ -403,6 +403,89 @@ test('dashboard exposes customer service scope delivery actions on the first scr
expect(within(scopeRegion).getByRole('button', { name: '客户服务范围 保存视图' })).toBeInTheDocument();
});
test('dashboard presents customer vehicle service modules before operations details', async () => {
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: 88,
activeToday: 119,
frameToday: 32000,
issueVehicles: 3,
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: 1000,
boundVehicles: 960,
onlineVehicles: 88,
singleSourceVehicles: 180,
multiSourceVehicles: 230,
noDataVehicles: 20,
identityRequiredVehicles: 10,
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 />);
const servicePath = await screen.findByLabelText('客户车辆服务路径');
const serviceOverview = within(servicePath).getByLabelText('客户服务总览');
expect(within(serviceOverview).getByText('客户服务总览')).toBeInTheDocument();
expect(within(serviceOverview).getByText('地图、轨迹、统计、导出是客户能直接使用的车辆服务;协议来源只进入证据和追溯。')).toBeInTheDocument();
expect(within(serviceOverview).getByRole('button', { name: '客户服务总览 车辆地图 进入地图' })).toBeInTheDocument();
expect(within(serviceOverview).getByRole('button', { name: '客户服务总览 轨迹回放 回放轨迹' })).toBeInTheDocument();
expect(within(serviceOverview).getByRole('button', { name: '客户服务总览 统计查询 查看统计' })).toBeInTheDocument();
expect(within(serviceOverview).getByRole('button', { name: '客户服务总览 历史数据 查询导出' })).toBeInTheDocument();
});
test('topbar frames customer work as a vehicle service delivery strip', () => {
vi.spyOn(globalThis, 'fetch').mockImplementation(async () => ({
ok: true,