Skip to content

Instantly share code, notes, and snippets.

@mbehery85
mbehery85 / cypressGoneMobile.md
Last active August 10, 2022 10:21
TWL-Lab49/Cypress has gone mobile

Cypress has now gone mobile and can support both Android and iPhone/iPad web browsing testing.

Cypress provides a viewport command to set the size of the screen; the viewport varies from device to device. For example. the iPad 2 has a viewport of 768X1024 while the iPhone 3 has a viewport of 320X 480.

The viewport command in cypress accepts the height and width of the device in question. The syntax is:

cy.viewport(height, width)

or alternatively you can define the phone model from the pre-defined list supported by Cypress, so for example: