Package Exports
- cy-mobile-commands
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cy-mobile-commands) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Mobile testing helper for Cypress
Installing
Step 1, intall this package
npm install --save-dev cy-mobile-commandsStep 2, load it to your Cypress test context
Open cypress/support/index.js and add:
import 'cy-mobile-commands'Step 3, ...
there is no more steps.
Commands
swipe
Syntax
.swipe([configObject,] checkpoint1, checkpoint2[, ..., checkpointN])The configObject parameter is optional. The available options are:
delay: (number of milliseconds = 300) the delta time from thetouchstarttotouchend.steps: (integer = computed) the number of steps between two checkpoints.draw: (boolean = true) display the swipe path over the page.
You can set two or more steps to make the swipe path as complex as you need.
Where checkpoint# can be a position, or an array of positions. An array of positions perform a multi touch action.
Where position can be:
- A explicit position defined with number values:
[clientX, clientY]. - A named position:
left,right,top,bottom,top-left,top-right,bottom-left,bottom-rightorcenter. (You can replacekebab-casebycamelCase)
Usage example
it('page switch', () => {
cy.visit('book.somewhere')
cy.get('#my-page1').should('be.visible')
cy.get('#my-page2').should('not.be.visible')
cy.get('#my-slidable-book').swipe('right', 'left')
cy.get('#my-page1').should('not.be.visible')
cy.get('#my-page2').should('be.visible')
})
it('zoom a map', () => {
cy.visit('map.somewhere')
cy.get('#map').swipe({delay: 2000}, [[80,250],[80,350]], [[80,100],[80,500]])
})