From e500dfad0cbbdc0b896231502e7684524149a19b Mon Sep 17 00:00:00 2001 From: fz Date: Tue, 27 Oct 2026 01:20:56 +0800 Subject: [PATCH] test(web): isolate heartbeat replay and sample panel geometry atomically --- apps/web/tests/shortcuts-panels.e2e.ts | 14 ++++++++++---- scripts/run-web-snapshots.ts | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/web/tests/shortcuts-panels.e2e.ts b/apps/web/tests/shortcuts-panels.e2e.ts index 2036dad448..ecf6a75e16 100644 --- a/apps/web/tests/shortcuts-panels.e2e.ts +++ b/apps/web/tests/shortcuts-panels.e2e.ts @@ -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) diff --git a/scripts/run-web-snapshots.ts b/scripts/run-web-snapshots.ts index cb05c2283c..e69ef7527c 100644 --- a/scripts/run-web-snapshots.ts +++ b/scripts/run-web-snapshots.ts @@ -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)