Improve this doc

get and set configuration options in your tests.

New to Cypress?

Read about configuration first.


Configuration set using Cypress.config is only in scope for the current spec file.

Cypress runs each spec file in isolation: the browser is exited between specs. Configuration changed in one spec won’t be visible in other specs.


Cypress.config(name, value)


name (String)

The name of the configuration to get or set.

value (String)

The value of the configuration to set.

object (Object)

Set multiple configuration options with an object literal.


No Arguments

Get all configuration options.

// cypress.json

  "defaultCommandTimeout": 10000
Cypress.config() // => {defaultCommandTimeout: 10000, pageLoadTimeout: 30000, ...}


Return just a single configuration option value.

// cypress.json

  "pageLoadTimeout": 60000
Cypress.config('pageLoadTimeout') // => 60000

Name and Value

Cypress allows you to change the values of your configuration options from within your tests.


Remember, any changes that you make to configuration using this API will only be in effect for the remainder of the tests in the same spec file.

// cypress.json

  "viewportWidth": 1280,
  "viewportHeight": 720
Cypress.config('viewportWidth', 800)

Cypress.config('viewportWidth') // => 800


You can set multiple values by passing an object literal.

// cypress.json

  "defaultCommandTimeout": 4000,
  "pageLoadTimeout": 30000,
  defaultCommandTimeout: 10000,
  viewportHeight: 900

Cypress.config() // => {defaultCommandTimeout: 10000, viewportHeight: 900, ...}


Why is it Cypress.config and not cy.config?

As a rule of thumb anything you call from Cypress affects global state. Anything you call from cy affects local state.

Since the configuration added or changed by Cypress.config is only in scope for the current spec file, you’d think that it should be cy.config and not Cypress.config…and you’d be right. The fact that Cypress.config affects local state is an artifact of the API evolving over time: Cypress.config used to affect global state—configuration added in one test spec file was available in other specs—but the Cypress team wisely made each spec run in isolation in 3.0.0 and by that time Cypress.config was public API.

See also