The existing dragAndDrop api is useful, but there are a few use cases that it doesn't fulfil:
For some prior art, puppeteer has a slightly more granular API:
// Requires `page.setDragInterception( true )` in test setup
const dragData = await page.mouse.drag( sourceElementHandle, target );
await page.mouse.dragEnter( target, dragData );
await page.mouse.dragOver( target, dragData );
expect( dropZone ).toBeVisible(); // this line is pseudocode, I don't think puppeteer supports `toBeVisible`.
await page.mouse.drop( target, dragData );
Another idea is an API like:
const { dragTo, drop } = await drag( locator );
or
const { dragTo, drop } = await dragFile( file );
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 existing
dragAndDropapi is useful, but there are a few use cases that it doesn't fulfil:dragAndDropdoesn't work for my use-case) along withdragEnter,dragOveranddropeventsFor some prior art, puppeteer has a slightly more granular API:
Another idea is an API like:
or
Where the
transferDatais 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)