Overview: report liveness and a Source whose poll loop stopped
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// The overview.
|
||||
import { expect, it } from 'vitest'
|
||||
import { en, zh } from '../src/client/locales.ts'
|
||||
import { duration } from '../src/client/text.ts'
|
||||
import { usePanel, mount, remount, all, find, tab, click, text } from './fixtures/panel.tsx'
|
||||
import { server, droppedReply, threadSummary } from './fixtures/panel-server.ts'
|
||||
|
||||
@@ -10,7 +11,8 @@ it('leads the overview with the pending Tickets, then problems, the last day and
|
||||
await mount()
|
||||
expect(tab(zh['tab.overview']).getAttribute('aria-selected')).toBe('true')
|
||||
expect(all('[role="tab"]').map(tab => tab.textContent)).toEqual(['概览', '来源', '触发', '评估', '执行', '设置'])
|
||||
expect(all('.dt-section-title').map(title => title.textContent)).toEqual(['待处理工单2', '系统问题2', '过去 24 小时详情 ›', '执行器详情 ›'])
|
||||
expect(all('.dt-section-title').map(title => title.textContent)).toEqual(['待处理工单2', '系统问题2', '存活', '过去 24 小时详情 ›',
|
||||
'执行器详情 ›'])
|
||||
expect(all('.dt-cards .dt-ticket-stage').map(item => item.textContent)).toEqual(['待回答', '待处理失败'])
|
||||
expect(all('.dt-cards .dt-att-what').map(item => item.textContent)).toEqual(['飞书 来源异常', '评估未完成:这个文案好奇怪'])
|
||||
// Actions sit below the title and Threads, apart from the stage, each with its icon.
|
||||
@@ -18,7 +20,13 @@ it('leads the overview with the pending Tickets, then problems, the last day and
|
||||
&& [...row.querySelectorAll('.dt-ticket-actions button, .dt-ticket-actions a')].every(action => action.querySelector('svg')))).toBe(true)
|
||||
expect(text()).toContain('来源会在每次轮询时自动重试')
|
||||
expect(text()).toContain('需要确认按钮颜色')
|
||||
expect(all('.dt-stat').map(stat => stat.textContent)).toEqual(['到达12', '被过滤2', '已评估5', '接单或续做1', '执行中2 / 3', '排队0', '等待新触发1'])
|
||||
// Durations are formatted by the interface language, so the readout is asserted by label, and only the polling word verbatim.
|
||||
expect(all('.dt-stat-label').map(label => label.textContent)).toEqual([zh.livenessUptime, zh.livenessLastPoll, zh.livenessPolling,
|
||||
zh.flowReceivedLabel, zh.flowFilteredLabel, zh.flowJudgedLabel, zh.flowAcceptedLabel, zh.executingLabel, zh.queuedLabel,
|
||||
zh.idleLabel])
|
||||
expect(all('.dt-stat-value').map(value => value.textContent).slice(3)).toEqual(['12', '2', '5', '1', '2 / 3', '0', '1'])
|
||||
expect(all('.dt-stat-value').map(value => value.textContent).slice(0, 3)).toEqual([expect.stringContaining('小时'), expect
|
||||
.stringContaining('秒'), zh.livenessPolling])
|
||||
expect(all('.dt-chip').map(chip => chip.textContent)[0]).toBe('GitHub#42CI 失败1')
|
||||
expect(document.querySelector('.dt-chip-problem')?.textContent).toBe('CI 失败1')
|
||||
expect(document.querySelector<HTMLAnchorElement>('a.dt-chip-link')?.href).toBe('https://github.com/acme/widgets/pull/42')
|
||||
@@ -126,10 +134,10 @@ it('words a refused retry in the interface language by its code', async () => {
|
||||
it('shows the overview in English', async () => {
|
||||
await mount(en)
|
||||
expect(all('.dt-section-title').map(title => title.textContent)).toEqual([`${en.pendingTickets}2`, `${en.problems}2`,
|
||||
`${en.lastDay}${en.details}`, `${en['term.executor']}${en.details}`])
|
||||
en.livenessTitle, `${en.lastDay}${en.details}`, `${en['term.executor']}${en.details}`])
|
||||
expect(all('.dt-cards .dt-ticket-stage').map(item => item.textContent)).toEqual([en['stage.answer'], en['stage.failed']])
|
||||
expect(all('.dt-stat-label').map(label => label.textContent)).toEqual([en.flowReceivedLabel, en.flowFilteredLabel, en.flowJudgedLabel,
|
||||
en.flowAcceptedLabel, en.executingLabel, en.queuedLabel, en.idleLabel])
|
||||
expect(all('.dt-stat-label').map(label => label.textContent)).toEqual([en.livenessUptime, en.livenessLastPoll, en.livenessPolling,
|
||||
en.flowReceivedLabel, en.flowFilteredLabel, en.flowJudgedLabel, en.flowAcceptedLabel, en.executingLabel, en.queuedLabel, en.idleLabel])
|
||||
})
|
||||
|
||||
it('lists the unavailable Evals one by one, without the health entry that counts them as a failure of dsh-superagent', async () => {
|
||||
@@ -157,3 +165,12 @@ it('says when no Source is on, an Eval is past its deadline or a message keeps f
|
||||
await click('评估超时未决定:#9 迟迟未决')
|
||||
expect(server.requests.some(request => request.path.startsWith('threads/github:9'))).toBe(true)
|
||||
})
|
||||
|
||||
it('says when a Source stopped polling, with how long its last round was and the way to it', async () => {
|
||||
server.stalled = [{ id: 'github', title: { zh: 'GitHub', en: 'GitHub' }, ageMs: 26 * 60_000, intervalMs: 60_000 }]
|
||||
await mount()
|
||||
const line = all('.dt-cards .dt-att-what').map(item => item.textContent).find(title => title?.includes('GitHub 最后一次轮询在'))
|
||||
// The same duration helper the panel uses, so the assertion does not depend on the locale's spacing rules.
|
||||
expect(line).toBe(zh.problemStalled.replace('{source}', 'GitHub').replace('{age}', duration(26 * 60_000, 'zh')))
|
||||
expect(text()).toContain(zh.problemStalledHint)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user