{
  "doc": {
    "id": "api/commands/wait",
    "title": "wait | Cypress Documentation",
    "description": "Wait for a number of milliseconds or wait for an aliased resource to resolve before moving on to the next command in Cypress.",
    "section": "api",
    "source_path": "/llm/markdown/api/commands/wait.md",
    "version": "204dffbf7fbb64b1fe8343a54ddcd869cc275f1f",
    "updated_at": "2026-05-12T20:33:17.938Z",
    "headings": [
      {
        "id": "api/commands/wait#wait",
        "text": "wait",
        "level": 1
      },
      {
        "id": "api/commands/wait#syntax",
        "text": "Syntax",
        "level": 2
      },
      {
        "id": "api/commands/wait#usage",
        "text": "Usage",
        "level": 3
      },
      {
        "id": "api/commands/wait#arguments",
        "text": "Arguments",
        "level": 3
      },
      {
        "id": "api/commands/wait#yields-learn-about-subject-management",
        "text": "Yields Learn about subject management",
        "level": 3
      },
      {
        "id": "api/commands/wait#when-given-a-time-argument",
        "text": "When given a time argument:",
        "level": 4
      },
      {
        "id": "api/commands/wait#when-given-an-alias-argument",
        "text": "When given an alias argument:",
        "level": 4
      },
      {
        "id": "api/commands/wait#examples",
        "text": "Examples",
        "level": 2
      },
      {
        "id": "api/commands/wait#time",
        "text": "Time",
        "level": 3
      },
      {
        "id": "api/commands/wait#wait-for-an-arbitrary-period-of-milliseconds",
        "text": "Wait for an arbitrary period of milliseconds:",
        "level": 4
      },
      {
        "id": "api/commands/wait#alias",
        "text": "Alias",
        "level": 3
      },
      {
        "id": "api/commands/wait#wait-for-a-specific-request-to-respond",
        "text": "Wait for a specific request to respond",
        "level": 4
      },
      {
        "id": "api/commands/wait#wait-automatically-increments-responses",
        "text": "Wait automatically increments responses",
        "level": 4
      },
      {
        "id": "api/commands/wait#aliases",
        "text": "Aliases",
        "level": 3
      },
      {
        "id": "api/commands/wait#you-can-pass-an-array-of-aliases-that-will-be-waited-on-before-resolving",
        "text": "You can pass an array of aliases that will be waited on before resolving.",
        "level": 4
      },
      {
        "id": "api/commands/wait#using-spread-to-spread-the-array-into-multiple-arguments",
        "text": "Using .spread() to spread the array into multiple arguments.",
        "level": 4
      },
      {
        "id": "api/commands/wait#notes",
        "text": "Notes",
        "level": 2
      },
      {
        "id": "api/commands/wait#nesting",
        "text": "Nesting",
        "level": 3
      },
      {
        "id": "api/commands/wait#timeouts",
        "text": "Timeouts",
        "level": 3
      },
      {
        "id": "api/commands/wait#requesttimeout-and-responsetimeout",
        "text": "requestTimeout and responseTimeout",
        "level": 4
      },
      {
        "id": "api/commands/wait#using-an-array-of-aliases",
        "text": "Using an Array of Aliases",
        "level": 4
      },
      {
        "id": "api/commands/wait#rules",
        "text": "Rules",
        "level": 2
      },
      {
        "id": "api/commands/wait#requirements-learn-about-chaining-commands",
        "text": "Requirements Learn about chaining commands",
        "level": 3
      },
      {
        "id": "api/commands/wait#assertions-learn-about-assertions",
        "text": "Assertions Learn about assertions",
        "level": 3
      },
      {
        "id": "api/commands/wait#timeouts-learn-about-timeouts",
        "text": "Timeouts Learn about timeouts",
        "level": 3
      },
      {
        "id": "api/commands/wait#command-log",
        "text": "Command Log",
        "level": 2
      },
      {
        "id": "api/commands/wait#history",
        "text": "History",
        "level": 2
      },
      {
        "id": "api/commands/wait#see-also",
        "text": "See also",
        "level": 2
      }
    ]
  },
  "content": {
    "type": "root",
    "children": [
      {
        "type": "heading",
        "depth": 1,
        "children": [
          {
            "type": "text",
            "value": "wait"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Wait for a number of milliseconds or wait for an aliased resource to resolve before moving on to the next command."
          }
        ]
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "Syntax"
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "cy.wait(time)cy.wait(alias)cy.wait(aliases)cy.wait(time, options)cy.wait(alias, options)cy.wait(aliases, options)"
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "// Specifying request and response types for aliased interceptstype UserReq = {}type UserRes = {}type ActivityReq = {}type ActivityRes = {}cy.intercept('/users/*').as('getUsers')cy.intercept('/activities/*').as('getActivities')// As templated types:cy.wait<UserReq, UserRes>('@getUsers').then(({ request, response }) => {  request.body // will be of type UserReq  response.body // will be of type UserRes})// As inferred types, with type `Interception` available in `cypress/types/net-stubbing`cy.wait('@getUsers').then(  ({ request, response }: Interception<UserReq, UserRes>) => {    request.body // will be of type UserReq    response.body // will be of type UserRes  })// When passing an array of aliases, types must be inferred:cy.wait(['@getUsers', 'getActivities']).then(  (    interceptions: Array<      Interception<UserReq | ActivityReq, UserRes | ActivityRes>    >  ) => {    interceptions.forEach(({ request, response }) => {      request.body // will be of type UserReq | ActivityReq      response.body // will be of type UserRes | ActivityRes    })  })"
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "Usage"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Correct Usage"
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "cy.wait(500)cy.wait('@getProfile')"
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "Arguments"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "time (Number)"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "The amount of time to wait in milliseconds."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "alias (String)"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "An aliased route as defined using the "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/api/commands/as.md",
            "children": [
              {
                "type": "text",
                "value": "`.as()`"
              }
            ]
          },
          {
            "type": "text",
            "value": " command and referenced with the `@` character and the name of the alias."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Core Concept"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/app/guides/network-requests.md#Waiting",
            "children": [
              {
                "type": "text",
                "value": "You can read more about aliasing routes in our Core Concept Guide"
              }
            ]
          },
          {
            "type": "text",
            "value": "."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "aliases (Array)"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "An array of aliased routes as defined using the "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/api/commands/as.md",
            "children": [
              {
                "type": "text",
                "value": "`.as()`"
              }
            ]
          },
          {
            "type": "text",
            "value": " command and referenced with the `@` character and the name of the alias."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "options (Object)"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Pass in an options object to change the default behavior of `cy.wait()`."
          }
        ]
      },
      {
        "type": "table",
        "align": [
          null,
          null,
          null
        ],
        "children": [
          {
            "type": "tableRow",
            "children": [
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Option"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Default"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Description"
                  }
                ]
              }
            ]
          },
          {
            "type": "tableRow",
            "children": [
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "`log`"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "`true`"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Displays the command in the "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/app/core-concepts/open-mode.md#Command-Log",
                    "children": [
                      {
                        "type": "text",
                        "value": "Command log"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "tableRow",
            "children": [
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "`timeout`"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/app/references/configuration.md#Timeouts",
                    "children": [
                      {
                        "type": "text",
                        "value": "`requestTimeout`"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": ", "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/app/references/configuration.md#Timeouts",
                    "children": [
                      {
                        "type": "text",
                        "value": "`responseTimeout`"
                      }
                    ]
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Time to wait for `cy.wait()` to resolve before "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "#Timeouts",
                    "children": [
                      {
                        "type": "text",
                        "value": "timing out"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "tableRow",
            "children": [
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "`requestTimeout`"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/app/references/configuration.md#Timeouts",
                    "children": [
                      {
                        "type": "text",
                        "value": "`requestTimeout`"
                      }
                    ]
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Overrides the global `requestTimeout` for this request. Defaults to `timeout`."
                  }
                ]
              }
            ]
          },
          {
            "type": "tableRow",
            "children": [
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "`responseTimeout`"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/app/references/configuration.md#Timeouts",
                    "children": [
                      {
                        "type": "text",
                        "value": "`responseTimeout`"
                      }
                    ]
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Overrides the global `responseTimeout` for this request. Defaults to `timeout`."
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "Yields "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/app/core-concepts/introduction-to-cypress.md#Subject-Management",
            "children": [
              {
                "type": "text",
                "value": "Learn about subject management"
              }
            ]
          }
        ]
      },
      {
        "type": "heading",
        "depth": 4,
        "children": [
          {
            "type": "text",
            "value": "When given a `time` argument:"
          }
        ]
      },
      {
        "type": "list",
        "ordered": false,
        "start": null,
        "spread": false,
        "children": [
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "`cy.wait()` yields the same subject it was given."
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "It is "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/app/core-concepts/retry-ability.md#Only-queries-are-retried",
                    "children": [
                      {
                        "type": "text",
                        "value": "unsafe"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": " to chain further commands that rely on the subject after `.wait()`."
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "type": "heading",
        "depth": 4,
        "children": [
          {
            "type": "text",
            "value": "When given an `alias` argument:"
          }
        ]
      },
      {
        "type": "list",
        "ordered": false,
        "start": null,
        "spread": false,
        "children": [
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "`cy.wait()` 'yields an object containing the HTTP request and response properties of the request."
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "Examples"
          }
        ]
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "Time"
          }
        ]
      },
      {
        "type": "heading",
        "depth": 4,
        "children": [
          {
            "type": "text",
            "value": "Wait for an arbitrary period of milliseconds:"
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "cy.wait(2000) // wait for 2 seconds"
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Anti-Pattern"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "You almost never need to wait for an arbitrary period of time. There are always better ways to express this in Cypress."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Read about "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/app/core-concepts/best-practices.md#Unnecessary-Waiting",
            "children": [
              {
                "type": "text",
                "value": "best practices"
              }
            ]
          },
          {
            "type": "text",
            "value": " here."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Additionally, it is often much easier to use "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/api/commands/debug.md",
            "children": [
              {
                "type": "text",
                "value": "`cy.debug()`"
              }
            ]
          },
          {
            "type": "text",
            "value": " or "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/api/commands/pause.md",
            "children": [
              {
                "type": "text",
                "value": "`cy.pause()`"
              }
            ]
          },
          {
            "type": "text",
            "value": " when debugging your test code."
          }
        ]
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "Alias"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "For a detailed explanation of aliasing, "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/app/guides/network-requests.md#Waiting",
            "children": [
              {
                "type": "text",
                "value": "read more about waiting on routes here"
              }
            ]
          },
          {
            "type": "text",
            "value": "."
          }
        ]
      },
      {
        "type": "heading",
        "depth": 4,
        "children": [
          {
            "type": "text",
            "value": "Wait for a specific request to respond"
          }
        ]
      },
      {
        "type": "list",
        "ordered": false,
        "start": null,
        "spread": false,
        "children": [
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "End-to-End Test"
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "Component Test"
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "// Wait for the alias 'getAccount' to respond// without changing or stubbing its responsecy.intercept('/accounts/*').as('getAccount')cy.visit('/accounts/123')cy.wait('@getAccount').then((interception) => {  // we can now access the low level interception  // that contains the request body,  // response body, status, etc})"
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "// Wait for the alias 'getAccount' to respond// without changing or stubbing its responsecy.intercept('/accounts/*').as('getAccount')cy.mount(<Account />)cy.wait('@getAccount').then((interception) => {  // we can now access the low level interception  // that contains the request body,  // response body, status, etc})"
      },
      {
        "type": "heading",
        "depth": 4,
        "children": [
          {
            "type": "text",
            "value": "Wait automatically increments responses"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Each time we use `cy.wait()` for an alias, Cypress waits for the next nth matching request."
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "// stub an empty response to requests for bookscy.intercept('GET', '/books', []).as('getBooks')cy.get('#search').type('Peter Pan')// wait for the first response to finishcy.wait('@getBooks')// the results should be empty because we// responded with an empty array firstcy.get('#book-results').should('be.empty')// now the request (aliased again as `getBooks`) will return one bookcy.intercept('GET', '/books', [{ name: 'Peter Pan' }]).as('getBooks')cy.get('#search').type('Peter Pan')// when we wait for 'getBooks' again, Cypress will// automatically know to wait for the 2nd responsecy.wait('@getBooks')// we responded with one book the second timecy.get('#book-results').should('have.length', 1)"
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "Aliases"
          }
        ]
      },
      {
        "type": "heading",
        "depth": 4,
        "children": [
          {
            "type": "text",
            "value": "You can pass an array of aliases that will be waited on before resolving."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "When passing an array of aliases to `cy.wait()`, Cypress will wait for all requests to complete within the given `requestTimeout` and `responseTimeout`."
          }
        ]
      },
      {
        "type": "list",
        "ordered": false,
        "start": null,
        "spread": false,
        "children": [
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "End-to-End Test"
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "Component Test"
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "cy.intercept('/users/*').as('getUsers')cy.intercept('/activities/*').as('getActivities')cy.intercept('/comments/*').as('getComments')cy.visit('/dashboard')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  })"
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "cy.intercept('/users/*').as('getUsers')cy.intercept('/activities/*').as('getActivities')cy.intercept('/comments/*').as('getComments')cy.mount(<Dashboard />)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  })"
      },
      {
        "type": "heading",
        "depth": 4,
        "children": [
          {
            "type": "text",
            "value": "Using "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/api/commands/spread.md",
            "children": [
              {
                "type": "text",
                "value": "`.spread()`"
              }
            ]
          },
          {
            "type": "text",
            "value": " to spread the array into multiple arguments."
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "cy.intercept('/users/*').as('getUsers')cy.intercept('/activities/*').as('getActivities')cy.intercept('/comments/*').as('getComments')cy.wait(['@getUsers', '@getActivities', '@getComments']).spread(  (getUsers, getActivities, getComments) => {    // each interception is now an individual argument  })"
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "Notes"
          }
        ]
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "Nesting"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Cypress automatically waits for the network call to complete before proceeding to the next command."
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "// Anti-pattern: placing Cypress commands inside .then callbackscy.wait('@alias')  .then(() => {    cy.get(...)  })// Recommended practice: write Cypress commands seriallycy.wait('@alias')cy.get(...)// Example: assert status from cy.intercept() before proceedingcy.wait('@alias').its('response.statusCode').should('eq', 200)cy.get(...)"
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Read "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/app/core-concepts/introduction-to-cypress.md#Commands-Run-Serially",
            "children": [
              {
                "type": "text",
                "value": "Guide: Introduction to Cypress"
              }
            ]
          }
        ]
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "Timeouts"
          }
        ]
      },
      {
        "type": "heading",
        "depth": 4,
        "children": [
          {
            "type": "text",
            "value": "`requestTimeout` and `responseTimeout`"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "When used with an alias, `cy.wait()` goes through two separate \"waiting\" periods."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "The first period waits for a matching request to leave the browser. This duration is configured by the "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/app/references/configuration.md#Timeouts",
            "children": [
              {
                "type": "text",
                "value": "`requestTimeout`"
              }
            ]
          },
          {
            "type": "text",
            "value": " option - which has a default of `5000` ms."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "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:"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "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 "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/app/references/configuration.md#Timeouts",
            "children": [
              {
                "type": "text",
                "value": "`responseTimeout`"
              }
            ]
          },
          {
            "type": "text",
            "value": " option - which has a default of `30000` ms."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "This means Cypress will now wait up to 30 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:"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "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."
          }
        ]
      },
      {
        "type": "heading",
        "depth": 4,
        "children": [
          {
            "type": "text",
            "value": "Using an Array of Aliases"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "When passing an array of aliases to `cy.wait()`, Cypress will wait for all requests to complete within the given `requestTimeout` and `responseTimeout`."
          }
        ]
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "Rules"
          }
        ]
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "Requirements "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/app/core-concepts/introduction-to-cypress.md#Chains-of-Commands",
            "children": [
              {
                "type": "text",
                "value": "Learn about chaining commands"
              }
            ]
          }
        ]
      },
      {
        "type": "list",
        "ordered": false,
        "start": null,
        "spread": false,
        "children": [
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "When passed a `time` argument `cy.wait()` can be chained off of `cy` or off another command."
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "When passed an `alias` argument `cy.wait()` requires being chained off of `cy`."
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "Assertions "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/app/core-concepts/introduction-to-cypress.md#Assertions",
            "children": [
              {
                "type": "text",
                "value": "Learn about assertions"
              }
            ]
          }
        ]
      },
      {
        "type": "list",
        "ordered": false,
        "start": null,
        "spread": false,
        "children": [
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "`cy.wait()` will only run assertions you have chained once, and will not "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/app/core-concepts/retry-ability.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "retry"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": "."
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "Timeouts "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/app/core-concepts/introduction-to-cypress.md#Timeouts",
            "children": [
              {
                "type": "text",
                "value": "Learn about timeouts"
              }
            ]
          }
        ]
      },
      {
        "type": "list",
        "ordered": false,
        "start": null,
        "spread": false,
        "children": [
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "`cy.wait()` can time out waiting for the request to go out."
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "`cy.wait()` can time out waiting for the response to return."
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "Command Log"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Wait for the PUT to users to resolve."
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "cy.intercept('PUT', /users/, {}).as('userPut')cy.get('form').submit()cy.wait('@userPut').its('request.url').should('include', 'users')"
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "The `cy.wait()` will display in the Command Log as:"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "When clicking on `wait` within the command log, the console outputs the following:"
          }
        ]
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "History"
          }
        ]
      },
      {
        "type": "table",
        "align": [
          null,
          null
        ],
        "children": [
          {
            "type": "tableRow",
            "children": [
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Version"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Changes"
                  }
                ]
              }
            ]
          },
          {
            "type": "tableRow",
            "children": [
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/app/references/changelog.md#3-1-3",
                    "children": [
                      {
                        "type": "text",
                        "value": "3.1.3"
                      }
                    ]
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Added `requestTimeout` and `responseTimeout` option"
                  }
                ]
              }
            ]
          },
          {
            "type": "tableRow",
            "children": [
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/app/references/changelog.md#0-3-3",
                    "children": [
                      {
                        "type": "text",
                        "value": "< 0.3.3"
                      }
                    ]
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "`cy.wait()` command added"
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "See also"
          }
        ]
      },
      {
        "type": "list",
        "ordered": false,
        "start": null,
        "spread": false,
        "children": [
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/commands/as.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`.as()`"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/commands/intercept.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`cy.intercept()`"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/commands/spread.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`.spread()`"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  },
  "token_estimate": 1628
}