Improve this doc

Wait for a number of milliseconds or wait for an aliased resource to resolve before moving on to the next command.


cy.wait(time, options)
cy.wait(alias, options)
cy.wait(aliases, options)


Correct Usage



time (Number)

The amount of time to wait in milliseconds.

alias (String)

An aliased route as defined using the .as() command and referenced with the @ character and the name of the alias.

Core Concept

You can read more about aliasing routes in our Core Concept Guide.

aliases (Array)

An array of aliased routes as defined using the .as() command and referenced with the @ character and the name of the alias.

options (Object)

Pass in an options object to change the default behavior of cy.wait().

Option Default Description
log true Displays the command in the Command log
timeout requestTimeout, responseTimeout Time to wait for cy.wait() to resolve before timing out
requestTimeout requestTimeout Overrides the global requestTimeout for this request. Defaults to timeout.
responseTimeout responseTimeout Overrides the global responseTimeout for this request. Defaults to timeout.


When given a time argument:

  • cy.wait() yields the same subject it was given from the previous command.

When given an alias argument:

  • cy.wait() yields an object containing the HTTP request and response properties of the request.



Wait for an arbitrary period of milliseconds:

cy.wait(2000) // wait for 2 seconds

You almost never need to wait for an arbitrary period of time. There are always better ways to express this in Cypress.

Read about best practices here.

Additionally, it is often much easier to use cy.debug() or cy.pause() when debugging your test code.


For a detailed explanation of aliasing, read more about waiting on routes here.

Wait for a specific request to respond

// Wait for the route aliased as 'getAccount' to respond
// without changing or stubbing its response
cy.wait('@getAccount').then((interception) => {
  // we can now access the low level interception
  // that contains the request body,
  // response body, status, etc

Wait automatically increments responses

Each time we use cy.wait() for an alias, Cypress waits for the next nth matching request.

cy.intercept('/books', []).as('getBooks')

// wait for the first response to finish

// the results should be empty because we
// responded with an empty array first

// now re-define the /books response
cy.intercept('/books', [{ name: 'Emperor of all maladies' }])

cy.get('#search').type('Emperor of')

// now when we wait for 'getBooks' again, Cypress will
// automatically know to wait for the 2nd response

// we responded with 1 book item so now we should
// have one result
cy.get('#book-results').should('have.length', 1)


You can pass an array of aliases that will be waited on before resolving.

When passing an array of aliases to cy.wait(), Cypress will wait for all requests to complete within the given requestTimeout and responseTimeout.


cy.wait(['@getUsers', '@getActivities', '@getComments']).then((interceptions) => {
  // interceptions will now be an array of matching requests
  // interceptions[0] <-- getUsers
  // interceptions[1] <-- getActivities
  // interceptions[2] <-- getComments

Using .spread() to spread the array into multiple arguments.

cy.wait(['@getUsers', '@getActivities', '@getComments'])
  .spread((getUsers, getActivities, getComments) => {
    // each interception is now an individual argument



Cypress automatically waits for the network call to complete before proceeding to the next command.

// Anti-pattern: placing Cypress commands inside .then callbacks
  .then(() => {

// Recommended practice: write Cypress commands serially

// Example: assert status from cy.intercept() before proceeding
cy.wait('@alias').its('response.statusCode').should('eq', 200)

Read Guide: Introduction to Cypress


requestTimeout and responseTimeout

When used with an alias, cy.wait() goes through two separate “waiting” periods.

The first period waits for a matching request to leave the browser. This duration is configured by the requestTimeout option - which has a default of 5000 ms.

This means that when you begin waiting for an aliased request, Cypress will wait up to 5 seconds for a matching request to be created. If no matching request is found, you will get an error message that looks like this:

Error for no matching request

Once Cypress detects that a matching request has begun its request, it then switches over to the 2nd waiting period. This duration is configured by the responseTimeout option - which has a default of 20000 ms.

This means Cypress will now wait up to 20 seconds for the external server to respond to this request. If no response is detected, you will get an error message that looks like this:

Timeout error for request wait

This gives you the best of both worlds - a fast error feedback loop when requests never go out and a much longer duration for the actual external response.

Using an Array of Aliases

When passing an array of aliases to cy.wait(), Cypress will wait for all requests to complete within the given requestTimeout and responseTimeout.



  • When passed a time argument cy.wait() can be chained off of cy or off another command.

  • When passed an alias argument cy.wait() requires being chained off of cy.


  • cy.wait() will only run assertions you've chained once, and will not retry.


  • cy.wait() can time out waiting for request to go out.

  • cy.wait() can time out waiting for response to return.

Command Log

Wait for the PUT to users to resolve.

cy.intercept('PUT', /users/, {}).as('userPut')
cy.wait('@userPut').its('request.url').should('include', 'users')

The commands above will display in the Command Log as:

Command Log wait

When clicking on wait within the command log, the console outputs the following:

Console Log wait


Version Changes
3.1.3 Added requestTimeout and responseTimeout option
< 0.3.3 cy.wait() command added

See also