Skip to content

Commit

Permalink
dragAndDropThought: Hide QuickDrop and Alert at the end, after mouseUp.
Browse files Browse the repository at this point in the history
  • Loading branch information
raineorshine committed Dec 2, 2024
1 parent c3b8393 commit 4f2eb4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 8 additions & 13 deletions src/e2e/puppeteer/helpers/dragAndDropThought.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,29 +92,24 @@ const dragAndDropThought = async (
await page.mouse.move(dropPosition.x, dropPosition.y)
}

await page.locator('[data-testid="quick-drop-panel"]').wait()
await page.locator('[data-testid="popup-value"]').wait()

if (mouseUp) {
await page.mouse.up()
await waitUntil(() => !document.querySelector('[data-drag-in-progress="true"]'))
}

// Hide QuickDropPanel by defafult.
// Otherwise wait for QuickDropPanel to appear so that snapshots are consistent.
if (!showQuickDropPanel) {
await hide('[data-testid="quick-drop-panel"]')
} else {
await page.locator('[data-testid="quick-drop-panel"]').wait()
}

// Hide Alert by default.
// Otherwise wait for Alert value to appear so that snapshots are consistent.
if (!showAlert) {
await hide('[data-testid="alert"]')
} else {
await page.locator('[data-testid="popup-value"]').wait()
}

if (mouseUp) {
await page.mouse.up()
await waitUntil(() => !document.querySelector('[data-drag-in-progress="true"]'))

// TODO: The drop/DragAndDropThought still fails intermittently without a delay here.
// When it fails, the drag appears to still be in progress. The bullet is highlighted and the QuickDropPanel is visible (though it should be hidden at this point)
await sleep(500)
}
}

Expand Down

0 comments on commit 4f2eb4d

Please sign in to comment.