From c08ba77466a6e167e3b796718692ec8d386e8236 Mon Sep 17 00:00:00 2001 From: Chris Villa Date: Tue, 7 Jan 2025 12:24:58 +0000 Subject: [PATCH] test: update smoke framework to work with updated dnd performance --- apps/demo/lib/use-demo-data.ts | 8 +------- scripts/e2e/utils/drag-and-drop.mjs | 32 ++++++++++++++--------------- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/apps/demo/lib/use-demo-data.ts b/apps/demo/lib/use-demo-data.ts index 8ea9dd1598..b3cde06aed 100644 --- a/apps/demo/lib/use-demo-data.ts +++ b/apps/demo/lib/use-demo-data.ts @@ -1,11 +1,5 @@ import { useEffect, useState } from "react"; -import config, { - initialData, - Props, - RootProps, - UserConfig, - UserData, -} from "../config"; +import config, { initialData, Props, RootProps, UserData } from "../config"; import { resolveAllData } from "@/core"; const isBrowser = typeof window !== "undefined"; diff --git a/scripts/e2e/utils/drag-and-drop.mjs b/scripts/e2e/utils/drag-and-drop.mjs index dd474335a0..dcd319a332 100644 --- a/scripts/e2e/utils/drag-and-drop.mjs +++ b/scripts/e2e/utils/drag-and-drop.mjs @@ -1,6 +1,8 @@ import { getBox } from "./get-box.mjs"; import { pause } from "./pause.mjs"; +const TIME_PREFIX = 0; + export async function dragAndDrop( page, sourceSelector, @@ -17,37 +19,33 @@ export async function dragAndDrop( ); await page.mouse.down(); // Simulate drag start - await pause(300); + await pause(TIME_PREFIX + 300); if (position === "top") { - // Move below - await page.mouse.move( - targetBox.x + targetBox.width / 2, - targetBox.y + targetBox.height * 2 - ); + // Move to top + await page.mouse.move(targetBox.x + targetBox.width / 2, targetBox.y - 4); - await pause(10); + await pause(TIME_PREFIX + 50); - // Move to top - await page.mouse.move( - targetBox.x + targetBox.width / 2, - targetBox.y + 4 // move to top to trigger directional move - ); - } else { + // Move to center await page.mouse.move( targetBox.x + targetBox.width / 2, targetBox.y + targetBox.height / 2 ); + await pause(TIME_PREFIX + 50); - await pause(10); - + // Move to top + await page.mouse.move(targetBox.x + targetBox.width / 2, targetBox.y - 4); + } else { await page.mouse.move( targetBox.x + targetBox.width / 2, - targetBox.y + targetBox.height / 2 + 1 // wiggle + targetBox.y + targetBox.height / 2 ); } + await pause(TIME_PREFIX + 10); + await page.mouse.up(); // Simulate drop - await pause(300); + await pause(TIME_PREFIX + 500); }