- Status 组件改用 Object.hasOwn 判定 statusLabels,constructor/toString/__proto__ 等原型键不再命中,仍回退「未知状态」并展示原始值 - 补充 vitest 参数化用例覆盖三个原型键 - Playwright 响应式烟测新增 900px/599px 断点 CDP endpoint 可见性断言, 确认桌面表格与移动卡片分支各自只渲染一个可见 endpoint HH-794
39 lines
1.6 KiB
JavaScript
39 lines
1.6 KiB
JavaScript
import { expect, test } from '@playwright/test'
|
|
|
|
const runtime = {
|
|
id: 'container-a',
|
|
name: 'account-a',
|
|
state: 'running',
|
|
status: 'Up',
|
|
profile: 'creatorhub-profile-account-a',
|
|
endpoint: 'http://account-a:9222',
|
|
}
|
|
|
|
test('keeps the create form inside a 900px viewport', async ({ page }) => {
|
|
await page.route('**/api/browsers', route => route.fulfill({ json: [] }))
|
|
await page.setViewportSize({ width: 900, height: 800 })
|
|
await page.goto('/')
|
|
|
|
await expect(page.getByRole('button', { name: '收起导航' }).first()).toBeVisible()
|
|
const createButton = page.getByRole('button', { name: '创建环境' })
|
|
await expect(createButton).toBeVisible()
|
|
expect(await page.evaluate(() => document.documentElement.scrollWidth)).toBeLessThanOrEqual(900)
|
|
const box = await createButton.boundingBox()
|
|
expect(box).not.toBeNull()
|
|
expect(box.x + box.width).toBeLessThanOrEqual(900)
|
|
})
|
|
|
|
test('shows the CDP endpoint only in the active branch at 900px and 599px', async ({ page }) => {
|
|
await page.route('**/api/browsers', route => route.fulfill({ json: [runtime] }))
|
|
const endpoint = page.getByText('http://account-a:9222')
|
|
|
|
await page.setViewportSize({ width: 900, height: 800 })
|
|
await page.goto('/')
|
|
await expect(page.getByRole('cell', { name: 'http://account-a:9222' })).toBeVisible()
|
|
await expect(endpoint.filter({ visible: true })).toHaveCount(1)
|
|
|
|
await page.setViewportSize({ width: 599, height: 800 })
|
|
await expect(page.getByRole('cell', { name: 'http://account-a:9222' })).toBeHidden()
|
|
await expect(endpoint.filter({ visible: true })).toHaveCount(1)
|
|
})
|