test(web): isolate heartbeat replay and sample panel geometry atomically

This commit is contained in:
fz
2026-10-27 01:20:56 +08:00
parent 3e12b73695
commit e500dfad0c
2 changed files with 12 additions and 4 deletions
+10 -4
View File
@@ -127,10 +127,16 @@ describe.skipIf(process.platform === 'win32')('Web sidebar shortcuts', () => {
const terminalEntry = panel.locator('[data-sidebar-right-guide-entry="terminal"]')
const shellMenu = terminalEntry.getByRole('button', { name: 'Choose shell', exact: true })
const titleBounds = await terminalEntry.getByText('New terminal', { exact: true }).boundingBox()
const arrowBounds = await shellMenu.boundingBox()
expect(arrowBounds!.x).toBeGreaterThanOrEqual(titleBounds!.x + titleBounds!.width)
expect(arrowBounds!.x - titleBounds!.x - titleBounds!.width).toBeLessThan(8)
// Sample both rectangles in one layout instead of crossing the panel's transition frames.
await expect.poll(() => terminalEntry.evaluate((entry) => {
const title = [...entry.querySelectorAll('span[aria-hidden="true"]')].find(element => element.textContent === 'New terminal')
const arrow = entry.querySelector('button[aria-label="Choose shell"]')
if (title === undefined || arrow === null) return null
const titleBounds = title.getBoundingClientRect()
const arrowBounds = arrow.getBoundingClientRect()
const gap = arrowBounds.left - titleBounds.right
return { ordered: gap >= 0, adjacent: gap < 8 }
})).toEqual({ ordered: true, adjacent: true })
await shellMenu.click()
await page.getByRole('menu').waitFor()
expect(await panel.locator('[data-sidebar-terminal]').count()).toBe(0)
+2
View File
@@ -5,6 +5,8 @@ import { pnpmInvocation } from './pnpm-invocation.ts'
const serialFiles = [
'apps/web/tests/hmr-live.e2e.ts',
'apps/web/tests/client-plugin-live.e2e.ts',
// Recorded SVG streaming retains live heartbeat assertions; reserve its browser CPU budget.
'apps/web/tests/present-svg.e2e.ts',
]
const workerRaw = process.env.DSH_WEB_SNAPSHOT_WORKERS
const workers = Number.parseInt(workerRaw ?? '', 10)