From 106b6f1319bbbea02fc0cbbd150e113eae34d1ca Mon Sep 17 00:00:00 2001 From: Dudu-0223 Date: Sun, 25 Oct 2026 17:12:02 +0800 Subject: [PATCH] test(web): sample sidebar spacing in one animation frame --- apps/web/tests/shortcuts-panels.e2e.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/web/tests/shortcuts-panels.e2e.ts b/apps/web/tests/shortcuts-panels.e2e.ts index 2036dad448..c2eff4d38b 100644 --- a/apps/web/tests/shortcuts-panels.e2e.ts +++ b/apps/web/tests/shortcuts-panels.e2e.ts @@ -127,10 +127,11 @@ 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) + // Both rectangles must come from the same animation frame while the sidebar slides. + const gap = await terminalEntry.getByText('New terminal', { exact: true }).evaluate((title, arrow) => + arrow!.getBoundingClientRect().left - title.getBoundingClientRect().right, await shellMenu.elementHandle()) + expect(gap).toBeGreaterThanOrEqual(0) + expect(gap).toBeLessThan(8) await shellMenu.click() await page.getByRole('menu').waitFor() expect(await panel.locator('[data-sidebar-terminal]').count()).toBe(0)