npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cy-mobile-commands

v0.3.0

Published

Mobile testing helper for Cypress

Downloads

70,781

Readme

Mobile testing helper for Cypress

book page swipemap pan and zoom

Installing

Step 1, intall this package

npm install --save-dev cy-mobile-commands

Step 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(checkpoint1, checkpoint2[, ..., checkpointN])
.swipe(configObject, checkpoint1, checkpoint2[, ..., checkpointN])

The configObject parameter is optional. The available options are:

  • delay: (number of milliseconds = 300) the delta time from the touchstart to touchend.
  • 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-right or center. (You can replace kebab-case by camelCase)

visitMobile

Syntax

cy.visitMobile(url)
cy.visitMobile(url, options)
cy.visitMobile(options)

It is exactly like the cy.visit command, extended with some env configuration to make mobile friendly libs to believe it is a mobile env.

For now it is necessary for swipe.js and leaflet.js. If you discover a lib that wont work with cy.visit or cy.visitMobile, please, send us a issue.

💡 Tip: If your lib expects a mobile env not yet provided by cy.visitMobile, run cypress open and with the visible browser GUI, open the console (F12) and click in "Toggle device toolbar" icon (or press Ctrl+Shift+M). Then you can run the test again as it was in a mobile chrome.

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.visitMobile('map.somewhere')
  cy.get('#map').swipe({delay: 2000}, [[80,250],[80,350]], [[80,100],[80,500]])
})

For more usage examples, see the our tests.