fix(ui): показывать время получения аналитики потоков

This commit is contained in:
Denozordec committed 2026-09-28 11:22:20 +07:00
1 parent 7318c5286b
commit 65241c94e9
6 files changed
+70 -12

No files matched your search

+33
View File
@@ -64,6 +64,8 @@ test('Flow: ошибка списка не отображается как от
await page.getByRole('button', { name: 'Обновить', exact: true }).click()
await expect(page.getByRole('alert').filter({ hasText: 'Потоки недоступны' })).toContainText('Нет доступа')
await expect(page.getByLabel('Сводка трафика')).toHaveCount(0)
await expect(page.getByLabel('Получение аналитики потоков')).toHaveCount(0)
await expect(page.getByLabel('Получение списка потоков')).toHaveCount(0)
await expect(page.getByText('Нет экспортёров IPFIX.', { exact: false })).toHaveCount(0)
control.failList = false
await page.getByRole('button', { name: 'Повторить загрузку потоков', exact: true }).click()
@@ -285,3 +287,34 @@ test('Flow: позднее чтение открытого SSE не заменя
await expect(page.getByText('Открытый поток второго', { exact: true }).filter({ visible: true })).toBeVisible()
await expect(page.getByLabel('Скорость потоков')).toContainText('7.00 Мбит/с')
})
test('Flow: время получения принадлежит текущему срезу и сохраняется после ошибки SSE', async ({ page }) => {
const control = await setup(page)
const receipt = page.getByLabel('Получение аналитики потоков')
const first = new Date('2026-09-28T06:00:00Z')
await page.clock.setFixedTime(first)
await page.getByRole('button', { name: '15м', exact: true }).click()
await expect(receipt.locator('time')).toHaveAttribute('datetime', first.toISOString())
await expect(receipt).toContainText('Получено (API)')
await expect(receipt).toContainText('время измерения не предоставлено')
control.hold = '24h'
const started = page.waitForRequest(r => r.url().includes('/flow/analytics?') && r.url().includes('range=24h'))
await page.getByRole('button', { name: '24ч', exact: true }).click()
await started
await expect(receipt).toHaveCount(0)
const second = new Date('2026-09-28T06:05:00Z')
await page.clock.setFixedTime(second)
control.release()
await expect(receipt.locator('time')).toHaveAttribute('datetime', second.toISOString())
control.invalidSample = null
await page.getByRole('button', { name: '5м', exact: true }).click()
await expect(page.getByText('Некорректные данные live-потока', { exact: true })).toBeVisible()
await expect(receipt).toContainText('Получено (live-поток)')
await expect(receipt.locator('time')).toHaveAttribute('datetime', second.toISOString())
await page.clock.setFixedTime(new Date('2026-09-28T06:10:00Z'))
await expect(receipt.locator('time')).toHaveAttribute('datetime', second.toISOString())
control.fail = true
await page.getByRole('button', { name: '15м', exact: true }).click()
await expect(page.getByRole('alert').filter({ hasText: 'Аналитика недоступна' })).toBeVisible()
await expect(receipt).toHaveCount(0)
})