import { expect, test } from '@playwright/test' 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) })