fix(ui): сохранять пропуски в мини-графиках измерений

This commit is contained in:
Denozordec committed 2026-09-24 15:58:23 +07:00
1 parent f3568d836b
commit 1d98a2a66e
3 files changed
+52 -15

No files matched your search

+20 -1
View File
@@ -1,7 +1,7 @@
import { test, expect, type Page } from '@playwright/test'
async function setup(page: Page) {
const control = { holdRange: '', failIface: false, series: undefined as number[] | undefined, txSeries: undefined as number[] | undefined, release: () => {} }
const control = { holdRange: '', failIface: false, series: undefined as Array<number | null> | undefined, txSeries: undefined as number[] | undefined, release: () => {} }
const gate = new Promise<void>(resolve => { control.release = resolve })
const server = { id: '1', name: 'Первый сервер', site: 'TEST', country: 'RU', status: 'online', rxNow: 2, txNow: 3, rxPeak: 5, txPeak: 6, rxTotal: 100, txTotal: 200, sessions: 1, rxSeries: [1, 2], txSeries: [2, 3] }
await page.route('**/health', route => route.fulfill({ json: { ok: true } }))
@@ -124,3 +124,22 @@ test('Карточка трафика: пустая история, одна т
await expect(card.locator('[data-direction="tx"] polyline')).toHaveCount(1)
expect(await card.locator('svg').last().innerHTML()).not.toMatch(/NaN|Infinity/)
})
test('Итоги трафика: Sparkline сохраняет разрывы и одиночные измерения', async ({ page }) => {
const control = await setup(page)
control.series = [1, 2, null, 3, 4]
await page.getByRole('button', { name: '24ч', exact: true }).click()
const spark = page.getByRole('img', { name: 'История измерений', exact: true }).first()
await expect(spark.locator('path[fill="none"]')).toHaveCount(2)
await expect(spark.locator('path[fill="none"]').nth(1)).toHaveAttribute('d', /^M135\.0,/)
expect(await spark.innerHTML()).not.toMatch(/NaN|Infinity/)
control.series = [0]
await page.getByRole('button', { name: '15м', exact: true }).click()
await expect(spark.locator('circle')).toHaveCount(1)
await expect(spark.locator('circle')).toHaveAttribute('cx', '90')
control.series = []
await page.getByRole('button', { name: '4ч', exact: true }).click()
await expect(page.getByLabel('Нет истории измерений')).toHaveCount(2)
await expect(page.getByRole('img', { name: 'История измерений', exact: true })).toHaveCount(0)
})