From 09bb0cbbe82f98958b14723c24cf20cf816aa4d1 Mon Sep 17 00:00:00 2001 From: kiranmagic7 <262980978+kiranmagic7@users.noreply.github.com> Date: Tue, 4 Aug 2026 08:41:49 +0530 Subject: [PATCH 1/2] test(desktop): stabilize keyboard community reorder Signed-off-by: kiranmagic7 <262980978+kiranmagic7@users.noreply.github.com> --- desktop/tests/e2e/community-rail.spec.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/desktop/tests/e2e/community-rail.spec.ts b/desktop/tests/e2e/community-rail.spec.ts index b432d17f2a8..3adb8224297 100644 --- a/desktop/tests/e2e/community-rail.spec.ts +++ b/desktop/tests/e2e/community-rail.spec.ts @@ -986,8 +986,24 @@ test.describe("community rail", () => { }), ); }, `community-rail-button-${COMMUNITY_B.id}`); + + // KeyboardSensor attaches its document keydown listener on the next timer + // tick. Wait for dnd-kit to expose the active drag before sending ArrowUp. + await expect(buttonB).toHaveAttribute("aria-pressed", "true"); + // ArrowUp moves the active item one slot up. await page.keyboard.press("ArrowUp"); + + // Let dnd-kit publish the new collision target before dropping. Otherwise + // the drop can still observe B's original position and become a no-op. + await expect + .poll(async () => { + const boxA = await buttonA.boundingBox(); + const boxB = await buttonB.boundingBox(); + return boxA !== null && boxB !== null && boxB.y < boxA.y; + }) + .toBe(true); + // Space drops the item — same synthetic dispatch for consistency. await page.evaluate((testId) => { const el = document.querySelector(`[data-testid="${testId}"]`); From 181a2696f5c9545a354d6e3168fddd4051a34972 Mon Sep 17 00:00:00 2001 From: kiranmagic7 <262980978+kiranmagic7@users.noreply.github.com> Date: Sun, 16 Aug 2026 08:36:58 +0530 Subject: [PATCH 2/2] test(desktop): wait for keyboard sensor listener Signed-off-by: kiranmagic7 <262980978+kiranmagic7@users.noreply.github.com> --- desktop/tests/e2e/community-rail.spec.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/desktop/tests/e2e/community-rail.spec.ts b/desktop/tests/e2e/community-rail.spec.ts index 3c135d3ba07..ab02e06d931 100644 --- a/desktop/tests/e2e/community-rail.spec.ts +++ b/desktop/tests/e2e/community-rail.spec.ts @@ -1360,22 +1360,12 @@ test.describe("community rail", () => { }, `community-rail-button-${COMMUNITY_B.id}`); // KeyboardSensor attaches its document keydown listener on the next timer - // tick. Wait for dnd-kit to expose the active drag before sending ArrowUp. - await expect(buttonB).toHaveAttribute("aria-pressed", "true"); + // tick, after the drag has already become active. + await page.evaluate(() => new Promise((resolve) => setTimeout(resolve, 0))); // ArrowUp moves the active item one slot up. await page.keyboard.press("ArrowUp"); - // Let dnd-kit publish the new collision target before dropping. Otherwise - // the drop can still observe B's original position and become a no-op. - await expect - .poll(async () => { - const boxA = await buttonA.boundingBox(); - const boxB = await buttonB.boundingBox(); - return boxA !== null && boxB !== null && boxB.y < boxA.y; - }) - .toBe(true); - // Space drops the item — same synthetic dispatch for consistency. await page.evaluate((testId) => { const el = document.querySelector(`[data-testid="${testId}"]`);