Skip to content

Commit

Permalink
fix trest
Browse files Browse the repository at this point in the history
  • Loading branch information
emilkowalski committed Jan 15, 2025
1 parent 2d9faed commit a1a1751
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions test/tests/basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,26 @@ test.describe('Basic functionality', () => {
await expect(page.getByTestId('auto-close-el')).toHaveCount(1);
});

test("toast's dismiss callback gets executed correctly", async ({ page }) => {
test.only("toast's dismiss callback gets executed correctly", async ({ page }) => {
await page.getByTestId('dismiss-toast-callback').click();
const toast = page.locator('[data-sonner-toast]');
const dragBoundingBox = await toast.boundingBox();

if (!dragBoundingBox) return;

// Initial touch point
await page.mouse.move(dragBoundingBox.x + dragBoundingBox.width / 2, dragBoundingBox.y);
const startX = dragBoundingBox.x + dragBoundingBox.width / 2;
const startY = dragBoundingBox.y;

// Initial touch point
await page.mouse.move(startX, startY);
await page.mouse.down();

// Complete the swipe
await page.mouse.move(0, dragBoundingBox.y + 300);
// Move mouse slightly to determine swipe direction
await page.mouse.move(startX, startY + 10);

// Complete the swipe - using relative position from start
await page.mouse.move(startX, startY + 300);
await page.mouse.up();

await expect(page.getByTestId('dismiss-el')).toHaveCount(1);
Expand Down

0 comments on commit a1a1751

Please sign in to comment.