Join us December 11th at 2PM EST/11AM PST to learn how the Siemens SW Hub Cloud Team increased their productivity by 38% with Cypress

Register

Cypress.platform

Improve this doc

Cypress.platform returns the underlying OS name, as returned from Node’s os.platform().

Even though Cypress runs in the browser, it automatically makes this property available for use in your tests.

Syntax

Cypress.platform // 'darwin'

Examples

Conditionals

it('has JSON files', function () {
  // if windows do one thing, else do another
  const cmd = Cypress.platform === 'win32' ? 'dir *.json' : 'ls *.json'

  cy.exec(cmd)
    .its('stdout')
    .should('include', 'package.json')
})