test: remove element being dragged before drop (#22177)

This scenario hangs in Firefox, waiting for response to `mouseup` event.

References #21621.
This commit is contained in:
Dmitry Gozman 2023-04-03 18:42:29 -07:00 committed by GitHub
parent ab85b23e67
commit 8bc7ed0469
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -432,3 +432,26 @@ it('should handle custom dataTransfer', async ({ page, browserName, isWindows })
data: 'Hello World',
});
});
it('what happens when dragging element is destroyed', async ({ page, browserName }) => {
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/21621' });
it.fixme(browserName === 'firefox', `hangs without any response for Page.dispatchMouseEvent({ type: 'mouseup' })`);
await page.setContent(`
<button draggable="true">Draggable</button>
<div id=target>drop here</div>
`);
await page.evaluate(() => {
document.querySelector('#target').addEventListener('dragover', event => {
document.querySelector('button')?.remove();
}, false);
document.querySelector('#target').addEventListener('drop', event => {
document.querySelector('#target').textContent = 'dropped';
}, false);
});
await page.locator('button').dragTo(page.locator('div'));
await expect(page.locator('div')).toHaveText('drop here');
});