You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The existing dragAndDrop api is useful, but there are a few use cases that it doesn't fulfil:
Dragging to a position, and before dropping, asserting that a drop zone or drop indicator is visible in the UI
Handling transfer data (not 100% sure, but I think this is why dragAndDrop doesn't work for my use-case) along with dragEnter, dragOver and drop events
For some prior art, puppeteer has a slightly more granular API:
// Requires `page.setDragInterception( true )` in test setupconstdragData=awaitpage.mouse.drag(sourceElementHandle,target);awaitpage.mouse.dragEnter(target,dragData);awaitpage.mouse.dragOver(target,dragData);expect(dropZone).toBeVisible();// this line is pseudocode, I don't think puppeteer supports `toBeVisible`.awaitpage.mouse.drop(target,dragData);
Another idea is an API like:
const{ dragTo, drop }=awaitdrag(locator);
or
const{ dragTo, drop }=awaitdragFile(file);
Where the transferData is encapsulated using a closure and doesn't need to be passed to each function.
Added collecting feedback label. Thanks for the request!
Is this something you'd be interested in working on a PR for? If so, we can iterate on the API to ensure it's something Playwright would accept before starting the implemention.
The existing
dragAndDrop
api is useful, but there are a few use cases that it doesn't fulfil:dragAndDrop
doesn't work for my use-case) along withdragEnter
,dragOver
anddrop
eventsFor some prior art, puppeteer has a slightly more granular API:
Another idea is an API like:
or
Where the
transferData
is encapsulated using a closure and doesn't need to be passed to each function.(credit to @kevin940726 for the latter idea in WordPress/gutenberg#42722)
The text was updated successfully, but these errors were encountered: