Skip to content

Commit

Permalink
test: update smoke framework to work with updated dnd performance
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvxd committed Jan 9, 2025
1 parent e1624dc commit c08ba77
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 24 deletions.
8 changes: 1 addition & 7 deletions apps/demo/lib/use-demo-data.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
32 changes: 15 additions & 17 deletions scripts/e2e/utils/drag-and-drop.mjs
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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);
}

0 comments on commit c08ba77

Please sign in to comment.