fix(ui): снимать статус live при отсутствии обновлений

This commit is contained in:
Denozordec committed 2026-09-28 11:35:29 +07:00
1 parent 5734340db2
commit f50a29f116
8 files changed
+103 -5

No files matched your search

+22
View File
@@ -1,3 +1,4 @@
import { installOpenLiveStream, resumeLiveStream } from "./live-stream-fixture"
import { test, expect, type Page } from '@playwright/test'
async function setup(page: Page) {
@@ -319,3 +320,24 @@ test('Flow: время получения принадлежит текущем
await expect(page.getByRole('alert').filter({ hasText: 'Аналитика недоступна' })).toBeVisible()
await expect(receipt).toHaveCount(0)
})
test('Flow: молчащий SSE сохраняет данные и восстанавливает live после sample', async ({ page }) => {
await installOpenLiveStream(page, '/api/traffic/flow/live', { bpsNow: 1000000, bytes: 200, packets: 2, conversations: 1, uniqueSrc: 1, uniqueDst: 1, topProto: 'TCP', rxSeries: [1], txSeries: [2], applications: [], protocols: [], sources: [], destinations: [], interfaces: [], conversationsList: [], ifaces: [], live: true })
await setup(page)
const receipt = page.getByLabel('Получение аналитики потоков').locator('time')
await expect(page.getByText('live', { exact: true }).filter({ visible: true })).toHaveCount(3)
const stamp = await receipt.getAttribute('datetime')
await page.clock.fastForward(15_001)
await expect(page.getByText('Нет обновлений live более 15 секунд', { exact: true })).toBeVisible()
await expect(page.getByText('live', { exact: true })).toHaveCount(0)
await expect(page.getByLabel('Скорость потоков')).toContainText('1.00 Мбит/с')
await expect(receipt).toHaveAttribute('datetime', stamp!)
await resumeLiveStream(page)
await expect(page.getByText('live', { exact: true }).filter({ visible: true })).toHaveCount(3)
await expect(page.getByText('Нет обновлений live более 15 секунд', { exact: true })).toHaveCount(0)
await page.getByRole('button', { name: '15м', exact: true }).click()
await expect(page.getByText('Категория 15m', { exact: true }).filter({ visible: true })).toBeVisible()
await page.clock.fastForward(15_001)
await expect(page.getByText('Нет обновлений live более 15 секунд', { exact: true })).toHaveCount(0)
})