Add to Cheatsheet: Change viewport to mobile size

Created on 2 December 2023, about 1 year ago
Updated 17 February 2024, 11 months ago

Our default viewport is the size that Lighthouse uses for Desktop:

  viewportWidth: 1350,
  viewportHeight: 940,

Change to mobile lighthouse:

cy.viewport(360, 640)

Advance setup, organize by size:

describe('Name of test', () => {
  context('Desktop', () => {
    it('Test item', () => {
      cy.login()
      // Do things.
    })
  })

  context('Mobile', () => {
    beforeEach(() => {
      // This applies to all test items in this context.
      cy.viewport(360, 640)
    })
    it('Test item', () => {
      cy.login()
      // Do things.
    })
  })
})
πŸ“Œ Task
Status

Fixed

Component

Commands

Created by

πŸ‡ΊπŸ‡ΈUnited States thejimbirch Cape Cod, Massachusetts

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024