test(ui): проверить ожидание первого сообщения SSE

This commit is contained in:
Denozordec committed 2026-09-28 16:49:56 +07:00
1 parent 88a8b5f02f
commit 7a01e8d545
6 files changed
+55 -8

No files matched your search

+22
View File
@@ -343,3 +343,25 @@ test('Flow: молчащий SSE сохраняет данные и восста
await page.clock.fastForward(15_001)
await expect(page.getByText('Нет обновлений live более 15 секунд', { exact: true })).toHaveCount(0)
})
test('Flow: ожидание первого sample использует историю без фиктивного live', async ({ page }) => {
await installOpenLiveStream(page, '/api/traffic/flow/live', { bpsNow: 7000000, 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 }, false)
await setup(page)
const receipt = page.getByLabel('Получение аналитики потоков')
await expect(receipt).toContainText('Получено (API)')
await expect(page.getByText('live', { exact: true })).toHaveCount(0)
await expect(page.getByLabel('Скорость потоков')).toContainText('1.00 Мбит/с')
const stamp = await receipt.locator('time').getAttribute('datetime')
await page.clock.fastForward(10_000)
await sendLiveHeartbeat(page)
await page.clock.fastForward(5_001)
await expect(page.getByText('Нет обновлений live более 15 секунд', { exact: true })).toBeVisible()
await expect(page.getByText('История · live недоступен', { exact: true }).filter({ visible: true })).toHaveCount(2)
await expect(receipt.locator('time')).toHaveAttribute('datetime', stamp!)
await resumeLiveStream(page)
await expect(page.getByText('live', { exact: true }).filter({ visible: true })).toHaveCount(3)
await expect(page.getByLabel('Скорость потоков')).toContainText('7.00 Мбит/с')
await expect(receipt).toContainText('Получено (live-поток)')
await expect(receipt.locator('time')).not.toHaveAttribute('datetime', stamp!)
})