Files
Nexus/frontend/e2e/pages/watch-slot-ttl.spec.mjs
2026-07-08 22:31:31 +08:00

26 lines
1.2 KiB
JavaScript

/** Production smoke — watch slot TTL chips + metric bars */
import { test, expect } from '../fixtures.mjs'
import { loginWithAccessToken, nav } from '../helpers.mjs'
test('watch slot TTL chips and metric labels', async ({ page }) => {
const token = process.env.NEXUS_E2E_ACCESS_TOKEN || ''
test.skip(!token, 'NEXUS_E2E_ACCESS_TOKEN required')
await loginWithAccessToken(page, token)
await nav(page, '/servers')
await expect(page.getByText('默认 30 分')).toBeVisible({ timeout: 20000 })
await expect(page.getByText('30分').first()).toBeVisible()
await expect(page.getByText('1时').first()).toBeVisible()
const card = page.locator('.watch-slot-card--filled').first()
await expect(card).toBeVisible()
await expect(card.getByText('时长')).toBeVisible()
const switchEl = card.locator('.watch-slot-switch input[type="checkbox"]')
if (!(await switchEl.isChecked())) {
await card.locator('.watch-slot-switch').click()
await page.waitForTimeout(1500)
}
await expect(card.getByText('内存').first()).toBeVisible({ timeout: 15000 })
await expect(card.getByText('硬盘').first()).toBeVisible()
await expect(card.getByText('负载').first()).toBeVisible()
await expect(card.locator('.watch-metric-bar').first()).toBeVisible()
})