fix(traffic): сохранять историю и показывать достоверную свежесть
This commit is contained in:
1 parent
ebe62ae2ef
commit
1275dd7b9b
48 files changed
+1899
-187
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { observedTrafficFixturePayload } from "./traffic-observation-fixture"
|
||||
import { test, expect, type Page } from '@playwright/test'
|
||||
|
||||
const longName = 'customer-with-a-very-long-unbroken-identifier-12345678901234567890'
|
||||
@@ -5,7 +6,7 @@ async function setup(page: Page, empty = false) {
|
||||
const metrics = { rxNow: 2, txNow: 3, rxPeak: 4, txPeak: 5, rxTotal: 100, txTotal: 200, rxSeries: [1, 2], txSeries: [2, 3] }
|
||||
const iface = { ...metrics, id: 'i1', bindingId: 'b1', userId: 'u1', userLogin: longName, userName: longName, interfaceName: longName, interfaceType: 'gre', comment: longName, serverId: '1', serverName: longName, serverSite: 'TEST', serverCountry: 'RU', status: 'online' }
|
||||
const user = { ...metrics, id: 'u1', login: longName, displayName: longName, role: 'viewer', interfaces: [iface] }
|
||||
await page.route('**/health', r => r.fulfill({ json: { ok: true } }))
|
||||
await page.route('**/health', r => r.fulfill({ json: observedTrafficFixturePayload({ ok: true }) }))
|
||||
await page.route('**/api/**', route => {
|
||||
const path = new URL(route.request().url()).pathname
|
||||
const json = path === '/api/auth/config' ? { required: false }
|
||||
@@ -14,7 +15,7 @@ async function setup(page: Page, empty = false) {
|
||||
: path === '/api/traffic/bound-interfaces' ? { interfaces: empty ? [] : [iface] }
|
||||
: path.endsWith('/interfaces') ? { interfaces: [] }
|
||||
: path === '/api/servers' ? [] : {}
|
||||
return route.fulfill({ json })
|
||||
return route.fulfill({ json: observedTrafficFixturePayload(json) })
|
||||
})
|
||||
await page.goto('/traffic')
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user