Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

test(core): the menu drag pixel proof waits for the menu's entrance (#10638)

Christopher Chedeaub993255e2712
diff --git a/packages/core/src/__tests__/PressModality.a11y.chromium.spec.ts b/packages/core/src/__tests__/PressModality.a11y.chromium.spec.ts
index faebfe27c7..effb79e9c8 100644
--- a/packages/core/src/__tests__/PressModality.a11y.chromium.spec.ts
+++ b/packages/core/src/__tests__/PressModality.a11y.chromium.spec.ts
@@ -33,6 +33,7 @@ import {
serveStorybook,
type StaticServer,
} from '@astryxdesign/a11y-spec/storybook';
+import {waitForRest} from '@astryxdesign/interaction-harness';
let storybook: StaticServer;
@@ -330,6 +331,10 @@ test('a mouse press dragged across menu rows lights only the row under the point
).toBe(true);
const rows = page.getByRole('menuitem');
await rows.first().waitFor();
+ // The menu's box and its paint are read once its entrance has ended.
+ await waitForRest(
+ page.locator('[popover]:has([data-astryx-menu-press])').first(),
+ );
const menu = await page.locator('[data-astryx-menu-press]').boundingBox();
const first = await rows.nth(0).boundingBox();
const second = await rows.nth(1).boundingBox();