test(app): wait for sidebar context menu placement (#9351)

The measuring surface is visible before layout replaces it with the positioned menu. Retry the original geometry assertions across that replacement instead of measuring it once.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
This commit is contained in:
paseo-bot[bot]
2026-11-11 00:39:48 +00:00
committed by GitHub
parent de67a7370c
commit 33c818cc6b
+7 -4
View File
@@ -31,10 +31,13 @@ async function expectContextMenuAtPointer(
menuTestID: string,
anchor: ContextMenuAnchor,
): Promise<void> {
const bounds = await page.getByTestId(menuTestID).boundingBox();
if (!bounds) throw new Error(`Could not measure ${menuTestID}`);
expect(Math.abs(bounds.x - anchor.x)).toBeLessThanOrEqual(2);
expect(Math.abs(bounds.y - (anchor.y + 4))).toBeLessThanOrEqual(2);
// The visible measuring surface is replaced when layout places the menu at its anchor.
await expect(async () => {
const bounds = await page.getByTestId(menuTestID).boundingBox();
if (!bounds) throw new Error(`Could not measure ${menuTestID}`);
expect(Math.abs(bounds.x - anchor.x)).toBeLessThanOrEqual(2);
expect(Math.abs(bounds.y - (anchor.y + 4))).toBeLessThanOrEqual(2);
}).toPass({ timeout: 10_000 });
}
export async function openWorkspaceContextMenu(page: Page, workspaceId: string): Promise<void> {