Reputation: 1833
I have a task to automate password creation where the mouse should be moved about 10 times in certain area in any direction. I was trying to use mouseover but it doesn't work.
cy.get('.form')
.trigger('mouseover')
.trigger('mousedown')
.trigger('mousemove', 50, 10)
Upvotes: 2
Views: 7949
Reputation: 132
If you expect your operating system mouse pointer to move, it won't happen in Cypress at all. In Cypress you can trigger events and it should be sufficient way to reach what you want.
The code you posted does trigger events properly, you can use it, it is fine. Depending on your implementation just trigger mousemove
multiple times or trigger mouseover
and mouseout
and repeat the sequence as many times you need.
If you want to see the mouse "pointer" in cypress, you can select a test execution snapshot at the left side of cypress execution window and see small red circle with white dot inside, which visualize the coordinates of the event triggered.
Upvotes: 2