Skip to content

[BUG] dragTo is not working with react-beautiful-dnd #35749

@fdm-mateco

Description

@fdm-mateco

Version

1.51.0

Steps to reproduce

Run the code at: https://try.playwright.tech/?l=playwright-test&s=d1t6za3
Or just copy paste this in any test setup you have locally:

import { test, expect } from '@playwright/test';

test('drag and drop', async ({ page }) => {
  await page.goto('https://kitchen.applitools.com/ingredients/drag-and-drop');

  // HTML drag&drop works:
  const htmlSource = page.locator('#menu-hamburger');
  const htmlTarget = page.locator('#plate-items')
  await htmlSource.dragTo(htmlTarget);
  await expect(htmlTarget).toHaveText('Hamburger');

  // React drag&drop does not:
  const firstElement = page.locator('#drag-drop-react li').first();
  await expect(firstElement).toHaveText('Sweet Potatoes');
  const source = page.locator('#sides-sweet-potatoes');
  const target = page.locator('#sides-baked-beans');
  await source.dragTo(target);
  await expect(firstElement).toHaveText('Corn on the cob');
});

Expected behavior

The drag and drop works, leaving the element at the 4th position

Actual behavior

The element stays in its original position.

Additional context

This was reported a long time ago but with no reproducible example: #13855
Furthermore, workarounds were posted but they don't work for me.

Environment

System:
    OS: Windows 11 10.0.22631
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i9-13900H
    Memory: 41.86 GB / 63.66 GB
  Binaries:
    Node: 20.17.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.8.0 - C:\Program Files\nodejs\npm.CMD
  IDEs:
    VSCode: 1.99.3 - C:\Users\FrederikDeMets\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
  npmPackages:
    @playwright/test: 1.51.0 => 1.51.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions