cy.drag() & cy.mouse proposal
See original GitHub issueAs mention in the #845 it would be interesting to have a broader API for drag’n drop and mouse movement.
Desired behavior
It’s very hard to reproduce drag’n drop using native browser events. It’s much simpler to simulate how the mouse would behave. Here is a drag’n drop assertion done on nightwatch.js
let elementToMove = '//div[@class="column"][2]'
browser
.url('http://grafikart.github.io/ReorderJS/index.html')
.useXpath()
.waitForElementVisible(elementToMove, 1000)
.moveToElement(elementToMove, 10, 10)
.mouseButtonDown(0)
.moveToElement('//div[@class="column"][1]', 10, 10)
.mouseButtonUp(0)
The API behaves at a lower level where we can control how the mouse behave. It would be nice to have something to describe generic behaviours.
cy.drag(selector: string, position: topLeft|center|topRight...., x: number, y: number)
cy.drag(selector: string, x: number, y: number)
// Maybe
cy.drag(fromSelector: string, toSelector: string)
// Or a low level api to control the mouse
cy.mouse.moveTo(selector: string)
cy.mouse.press(button = 0)
cy.mouse.moveTo(selector: string)
cy.mouse.release()
Issue Analytics
- State:
- Created 6 years ago
- Reactions:42
- Comments:21 (4 by maintainers)
Top Results From Across the Web
How to drag and drop in Cypress.io - Stack Overflow
Finally I resolved this issue by using "cy.request". https://docs.cypress.io/api/commands/request.html#Syntax
Read more >Drag and Drop in Cypress - Automated Visual Testing
Learn how to simulate drag and drop actions in Cypress. ... cy.visit('/ingredients/drag-and-drop'); ... it('should drag ice cream to the order', () => {....
Read more >trigger | Cypress Documentation
cy.trigger() is meant to be a low-level utility that makes triggering events easier than manually constructing and dispatching them. Since any arbitrary event ......
Read more >Part 15 - Drag and Drop (Native and mouse drag ... - YouTube
How to work in Cypress with Drag and Drop(DnD)?1. Using Cypress Plugin for Drag and Drop2. Customized methods on JavaScript Drag and Drop ......
Read more >Cytoscape.js
Note that it does not make sense to disable style if you plan on rendering the graph. Also note that cy.destroy() must be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jennifer-shehane I’m curious about contributing to this issue, if my company gives me the time to do so. Would you be open to that? Do you have an idea of approximately how long this would take to implement?
@bierik This plugin does not work.