Simulate swipe action
See original GitHub issueDesired behavior:
I use Cypress with Ionic 3 and I want to test my side-menu opening/closing, tabs change and pull to refresh with a swipe action. It is possible to simulate a swipe action with Cypress ? I tried to get inspired by the drag and drop example but it doesn’t works. Maybe I’m doing something wrong.
Test code:
it('should close menu', () => {
// This open my side menu by click on a button (OK)
cy.get('button').click();
// This should close menu by swipe (DO NOTHING)
// I selected content of my menu.
cy.get('content of my menu').trigger('mousedown', { which: 1 })
.trigger('mousemove', { clientX: 120, clientY: 300 })
.trigger('mouseup', {force: true})
});
- Operating System: Mac OS 10.13.3
- Cypress Version: 2.1.0
- Browser Version: Chrome 64.0.3282.186
Issue Analytics
- State:
- Created 6 years ago
- Reactions:24
- Comments:14 (2 by maintainers)
Top Results From Across the Web
ios simulator: simulate swipe and drag - Stack Overflow
ios simulator: simulate swipe and drag · 1- Place the pointer at the start position. · 2- Hold the mouse button. · 3-...
Read more >Swipe gestures not working on iOS simulator 13.2
When I try to test the app on iOS simulator (iPad Air 4th Gen, iPhone 12 Pro Max, iPhon 12 simulators), the swipe...
Read more >Simulate swipe gestures in UI tests - Dual-screen
Using the swipe method from the UiDevice class and device dimensions, you can simulate different gestures on the Surface Duo during tests.
Read more >Is there any way to simulate this kind of long swipe? - Reddit
Use [ADB Wifi] action to simulate that type of swipe. eg - input swipe 80 1200 900 1200 40. OR. General format -...
Read more >Simulating Basic Touch Actions Over Android Devices (Legacy)
To simulate long press, swipe and drag actions in keyword tests, call the appropriate methods of the Device object by using the Call...
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 FreeTop 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
Top GitHub Comments
I had the same problem trying to swipe an element using vuetify-swipeout with cypress.
After a couple hours searching, I end up looking which event is really triggered when swiping my element in chrome using the developer tools:
Hope it can help 😉
Hi, i have the same problem to test my Vue application. So i wrote a commands module to do this. https://www.npmjs.com/package/cy-mobile-commands
I did it today and i have implemented only the
swipe
command. This is my first command to cypress, so i will be glad to receive some review feedback about my implementation. https://gitlab.com/nTopus/cy-mobile-commands/issues