MCPcopy
hub / github.com/codeceptjs/CodeceptJS / proceedDragAndDrop

Function proceedDragAndDrop

lib/helper/Puppeteer.js:3293–3317  ·  view source on GitHub ↗
(sourceLocator, destinationLocator)

Source from the content-addressed store, hash-verified

3291}
3292
3293async function proceedDragAndDrop(sourceLocator, destinationLocator) {
3294 const src = await this._locateElement(sourceLocator)
3295 if (!src) {
3296 throw new ElementNotFound(sourceLocator, 'Source Element')
3297 }
3298
3299 const dst = await this._locateElement(destinationLocator)
3300 if (!dst) {
3301 throw new ElementNotFound(destinationLocator, 'Destination Element')
3302 }
3303
3304 // Note: Using public api .getClickablePoint because the .BoundingBox does not take into account iframe offsets
3305 const dragSource = await getClickablePoint(src)
3306 const dragDestination = await getClickablePoint(dst)
3307
3308 // Drag start point
3309 await this.page.mouse.move(dragSource.x, dragSource.y, { steps: 5 })
3310 await this.page.mouse.down()
3311
3312 // Drag destination
3313 await this.page.mouse.move(dragDestination.x, dragDestination.y, { steps: 5 })
3314 await this.page.mouse.up()
3315
3316 await this._waitForAction()
3317}
3318
3319async function proceedSeeInField(assertType, field, value, context) {
3320 const els = await findVisibleFields.call(this, field, context)

Callers

nothing calls this directly

Calls 3

getClickablePointFunction · 0.85
_locateElementMethod · 0.45
_waitForActionMethod · 0.45

Tested by

no test coverage detected