{
  "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": "48b03b5502f7aea1d0454750cce208f775403542",
    "updated_at": "2026-05-20T19:00:20.270Z",
    "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
      }
    ]
  },
  "chunks": [
    {
      "id": "api/commands/wait#syntax",
      "doc_id": "api/commands/wait",
      "heading": "Syntax",
      "heading_level": 2,
      "content_markdown": "## Syntax\n\n```\ncy.wait(time)cy.wait(alias)cy.wait(aliases)cy.wait(time, options)cy.wait(alias, options)cy.wait(aliases, options)\n```\n\n```\n// 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    })  })\n```\n\n### Usage\n\n**Correct Usage**\n\n```\ncy.wait(500)cy.wait('@getProfile')\n```\n\n### Arguments\n\n**time _(Number)_**\n\nThe amount of time to wait in milliseconds.\n\n**alias _(String)_**\n\nAn aliased route as defined using the [`.as()`](/llm/markdown/api/commands/as.md) command and referenced with the `@` character and the name of the alias.\n\n**Core Concept**\n\n[You can read more about aliasing routes in our Core Concept Guide](/llm/markdown/app/guides/network-requests.md#Waiting).\n\n**aliases _(Array)_**\n\nAn array of aliased routes as defined using the [`.as()`](/llm/markdown/api/commands/as.md) command and referenced with the `@` character and the name of the alias.\n\n**options _(Object)_**\n\nPass in an options object to change the default behavior of `cy.wait()`.\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `log` | `true` | Displays the command in the [Command log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log) |\n| `timeout` | [`requestTimeout`](/llm/markdown/app/references/configuration.md#Timeouts), [`responseTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Time to wait for `cy.wait()` to resolve before [timing out](#Timeouts) |\n| `requestTimeout` | [`requestTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Overrides the global `requestTimeout` for this request. Defaults to `timeout`. |\n| `responseTimeout` | [`responseTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Overrides the global `responseTimeout` for this request. Defaults to `timeout`. |\n\n### Yields [Learn about subject management](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Subject-Management)\n\n#### When given a `time` argument:\n\n*   `cy.wait()` yields the same subject it was given.\n*   It is [unsafe](/llm/markdown/app/core-concepts/retry-ability.md#Only-queries-are-retried) to chain further commands that rely on the subject after `.wait()`.\n\n#### When given an `alias` argument:\n\n*   `cy.wait()` 'yields an object containing the HTTP request and response properties of the request.\n",
      "section": "api",
      "anchors": [
        "syntax"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 485
    },
    {
      "id": "api/commands/wait#arguments",
      "doc_id": "api/commands/wait",
      "heading": "Arguments",
      "heading_level": 3,
      "content_markdown": "### Arguments\n\n**time _(Number)_**\n\nThe amount of time to wait in milliseconds.\n\n**alias _(String)_**\n\nAn aliased route as defined using the [`.as()`](/llm/markdown/api/commands/as.md) command and referenced with the `@` character and the name of the alias.\n\n**Core Concept**\n\n[You can read more about aliasing routes in our Core Concept Guide](/llm/markdown/app/guides/network-requests.md#Waiting).\n\n**aliases _(Array)_**\n\nAn array of aliased routes as defined using the [`.as()`](/llm/markdown/api/commands/as.md) command and referenced with the `@` character and the name of the alias.\n\n**options _(Object)_**\n\nPass in an options object to change the default behavior of `cy.wait()`.\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `log` | `true` | Displays the command in the [Command log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log) |\n| `timeout` | [`requestTimeout`](/llm/markdown/app/references/configuration.md#Timeouts), [`responseTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Time to wait for `cy.wait()` to resolve before [timing out](#Timeouts) |\n| `requestTimeout` | [`requestTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Overrides the global `requestTimeout` for this request. Defaults to `timeout`. |\n| `responseTimeout` | [`responseTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Overrides the global `responseTimeout` for this request. Defaults to `timeout`. |\n",
      "section": "api",
      "anchors": [
        "arguments"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 219
    },
    {
      "id": "api/commands/wait#yields-learn-about-subject-management",
      "doc_id": "api/commands/wait",
      "heading": "Yields Learn about subject management",
      "heading_level": 3,
      "content_markdown": "### Yields [Learn about subject management](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Subject-Management)\n\n#### When given a `time` argument:\n\n*   `cy.wait()` yields the same subject it was given.\n*   It is [unsafe](/llm/markdown/app/core-concepts/retry-ability.md#Only-queries-are-retried) to chain further commands that rely on the subject after `.wait()`.\n\n#### When given an `alias` argument:\n\n*   `cy.wait()` 'yields an object containing the HTTP request and response properties of the request.\n",
      "section": "api",
      "anchors": [
        "yields-learn-about-subject-management"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 76
    },
    {
      "id": "api/commands/wait#when-given-a-time-argument",
      "doc_id": "api/commands/wait",
      "heading": "When given a time argument:",
      "heading_level": 4,
      "content_markdown": "#### When given a `time` argument:\n\n*   `cy.wait()` yields the same subject it was given.\n*   It is [unsafe](/llm/markdown/app/core-concepts/retry-ability.md#Only-queries-are-retried) to chain further commands that rely on the subject after `.wait()`.\n",
      "section": "api",
      "anchors": [
        "when-given-a-time-argument"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 40
    },
    {
      "id": "api/commands/wait#examples",
      "doc_id": "api/commands/wait",
      "heading": "Examples",
      "heading_level": 2,
      "content_markdown": "## Examples\n\n### Time\n\n#### Wait for an arbitrary period of milliseconds:\n\n```\ncy.wait(2000) // wait for 2 seconds\n```\n\n**Anti-Pattern**\n\nYou almost **never** need to wait for an arbitrary period of time. There are always better ways to express this in Cypress.\n\nRead about [best practices](/llm/markdown/app/core-concepts/best-practices.md#Unnecessary-Waiting) here.\n\nAdditionally, it is often much easier to use [`cy.debug()`](/llm/markdown/api/commands/debug.md) or [`cy.pause()`](/llm/markdown/api/commands/pause.md) when debugging your test code.\n\n### Alias\n\nFor a detailed explanation of aliasing, [read more about waiting on routes here](/llm/markdown/app/guides/network-requests.md#Waiting).\n\n#### Wait for a specific request to respond\n\n*   End-to-End Test\n*   Component Test\n\n```\n// 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})\n```\n\n```\n// 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})\n```\n\n#### Wait automatically increments responses\n\nEach time we use `cy.wait()` for an alias, Cypress waits for the next nth matching request.\n\n```\n// 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)\n```\n\n### Aliases\n\n#### You can pass an array of aliases that will be waited on before resolving.\n\nWhen passing an array of aliases to `cy.wait()`, Cypress will wait for all requests to complete within the given `requestTimeout` and `responseTimeout`.\n\n*   End-to-End Test\n*   Component Test\n\n```\ncy.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  })\n```\n\n```\ncy.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  })\n```\n\n#### Using [`.spread()`](/llm/markdown/api/commands/spread.md) to spread the array into multiple arguments.\n\n```\ncy.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  })\n```\n",
      "section": "api",
      "anchors": [
        "examples"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 540
    },
    {
      "id": "api/commands/wait#time",
      "doc_id": "api/commands/wait",
      "heading": "Time",
      "heading_level": 3,
      "content_markdown": "### Time\n\n#### Wait for an arbitrary period of milliseconds:\n\n```\ncy.wait(2000) // wait for 2 seconds\n```\n\n**Anti-Pattern**\n\nYou almost **never** need to wait for an arbitrary period of time. There are always better ways to express this in Cypress.\n\nRead about [best practices](/llm/markdown/app/core-concepts/best-practices.md#Unnecessary-Waiting) here.\n\nAdditionally, it is often much easier to use [`cy.debug()`](/llm/markdown/api/commands/debug.md) or [`cy.pause()`](/llm/markdown/api/commands/pause.md) when debugging your test code.\n",
      "section": "api",
      "anchors": [
        "time"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 83
    },
    {
      "id": "api/commands/wait#wait-for-an-arbitrary-period-of-milliseconds",
      "doc_id": "api/commands/wait",
      "heading": "Wait for an arbitrary period of milliseconds:",
      "heading_level": 4,
      "content_markdown": "#### Wait for an arbitrary period of milliseconds:\n\n```\ncy.wait(2000) // wait for 2 seconds\n```\n\n**Anti-Pattern**\n\nYou almost **never** need to wait for an arbitrary period of time. There are always better ways to express this in Cypress.\n\nRead about [best practices](/llm/markdown/app/core-concepts/best-practices.md#Unnecessary-Waiting) here.\n\nAdditionally, it is often much easier to use [`cy.debug()`](/llm/markdown/api/commands/debug.md) or [`cy.pause()`](/llm/markdown/api/commands/pause.md) when debugging your test code.\n",
      "section": "api",
      "anchors": [
        "wait-for-an-arbitrary-period-of-milliseconds"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 80
    },
    {
      "id": "api/commands/wait#alias",
      "doc_id": "api/commands/wait",
      "heading": "Alias",
      "heading_level": 3,
      "content_markdown": "### Alias\n\nFor a detailed explanation of aliasing, [read more about waiting on routes here](/llm/markdown/app/guides/network-requests.md#Waiting).\n\n#### Wait for a specific request to respond\n\n*   End-to-End Test\n*   Component Test\n\n```\n// 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})\n```\n\n```\n// 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})\n```\n\n#### Wait automatically increments responses\n\nEach time we use `cy.wait()` for an alias, Cypress waits for the next nth matching request.\n\n```\n// 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)\n```\n",
      "section": "api",
      "anchors": [
        "alias"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 272
    },
    {
      "id": "api/commands/wait#wait-for-a-specific-request-to-respond",
      "doc_id": "api/commands/wait",
      "heading": "Wait for a specific request to respond",
      "heading_level": 4,
      "content_markdown": "#### Wait for a specific request to respond\n\n*   End-to-End Test\n*   Component Test\n\n```\n// 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})\n```\n\n```\n// 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})\n```\n",
      "section": "api",
      "anchors": [
        "wait-for-a-specific-request-to-respond"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 121
    },
    {
      "id": "api/commands/wait#wait-automatically-increments-responses",
      "doc_id": "api/commands/wait",
      "heading": "Wait automatically increments responses",
      "heading_level": 4,
      "content_markdown": "#### Wait automatically increments responses\n\nEach time we use `cy.wait()` for an alias, Cypress waits for the next nth matching request.\n\n```\n// 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)\n```\n",
      "section": "api",
      "anchors": [
        "wait-automatically-increments-responses"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 131
    },
    {
      "id": "api/commands/wait#aliases",
      "doc_id": "api/commands/wait",
      "heading": "Aliases",
      "heading_level": 3,
      "content_markdown": "### Aliases\n\n#### You can pass an array of aliases that will be waited on before resolving.\n\nWhen passing an array of aliases to `cy.wait()`, Cypress will wait for all requests to complete within the given `requestTimeout` and `responseTimeout`.\n\n*   End-to-End Test\n*   Component Test\n\n```\ncy.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  })\n```\n\n```\ncy.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  })\n```\n\n#### Using [`.spread()`](/llm/markdown/api/commands/spread.md) to spread the array into multiple arguments.\n\n```\ncy.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  })\n```\n",
      "section": "api",
      "anchors": [
        "aliases"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 183
    },
    {
      "id": "api/commands/wait#you-can-pass-an-array-of-aliases-that-will-be-waited-on-before-resolving",
      "doc_id": "api/commands/wait",
      "heading": "You can pass an array of aliases that will be waited on before resolving.",
      "heading_level": 4,
      "content_markdown": "#### You can pass an array of aliases that will be waited on before resolving.\n\nWhen passing an array of aliases to `cy.wait()`, Cypress will wait for all requests to complete within the given `requestTimeout` and `responseTimeout`.\n\n*   End-to-End Test\n*   Component Test\n\n```\ncy.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  })\n```\n\n```\ncy.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  })\n```\n",
      "section": "api",
      "anchors": [
        "you-can-pass-an-array-of-aliases-that-will-be-waited-on-before-resolving"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 141
    },
    {
      "id": "api/commands/wait#notes",
      "doc_id": "api/commands/wait",
      "heading": "Notes",
      "heading_level": 2,
      "content_markdown": "## Notes\n\n### Nesting\n\nCypress automatically waits for the network call to complete before proceeding to the next command.\n\n```\n// 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(...)\n```\n\nRead [Guide: Introduction to Cypress](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Commands-Run-Serially)\n\n### Timeouts\n\n#### `requestTimeout` and `responseTimeout`\n\nWhen used with an alias, `cy.wait()` goes through two separate \"waiting\" periods.\n\nThe first period waits for a matching request to leave the browser. This duration is configured by the [`requestTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) option - which has a default of `5000` ms.\n\nThis 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:\n\nOnce 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`](/llm/markdown/app/references/configuration.md#Timeouts) option - which has a default of `30000` ms.\n\nThis 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:\n\nThis 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.\n\n#### Using an Array of Aliases\n\nWhen passing an array of aliases to `cy.wait()`, Cypress will wait for all requests to complete within the given `requestTimeout` and `responseTimeout`.\n",
      "section": "api",
      "anchors": [
        "notes"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 356
    },
    {
      "id": "api/commands/wait#nesting",
      "doc_id": "api/commands/wait",
      "heading": "Nesting",
      "heading_level": 3,
      "content_markdown": "### Nesting\n\nCypress automatically waits for the network call to complete before proceeding to the next command.\n\n```\n// 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(...)\n```\n\nRead [Guide: Introduction to Cypress](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Commands-Run-Serially)\n",
      "section": "api",
      "anchors": [
        "nesting"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 68
    },
    {
      "id": "api/commands/wait#timeouts",
      "doc_id": "api/commands/wait",
      "heading": "Timeouts",
      "heading_level": 3,
      "content_markdown": "### Timeouts\n\n#### `requestTimeout` and `responseTimeout`\n\nWhen used with an alias, `cy.wait()` goes through two separate \"waiting\" periods.\n\nThe first period waits for a matching request to leave the browser. This duration is configured by the [`requestTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) option - which has a default of `5000` ms.\n\nThis 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:\n\nOnce 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`](/llm/markdown/app/references/configuration.md#Timeouts) option - which has a default of `30000` ms.\n\nThis 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:\n\nThis 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.\n\n#### Using an Array of Aliases\n\nWhen passing an array of aliases to `cy.wait()`, Cypress will wait for all requests to complete within the given `requestTimeout` and `responseTimeout`.\n",
      "section": "api",
      "anchors": [
        "timeouts"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 285
    },
    {
      "id": "api/commands/wait#requesttimeout-and-responsetimeout",
      "doc_id": "api/commands/wait",
      "heading": "requestTimeout and responseTimeout",
      "heading_level": 4,
      "content_markdown": "#### `requestTimeout` and `responseTimeout`\n\nWhen used with an alias, `cy.wait()` goes through two separate \"waiting\" periods.\n\nThe first period waits for a matching request to leave the browser. This duration is configured by the [`requestTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) option - which has a default of `5000` ms.\n\nThis 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:\n\nOnce 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`](/llm/markdown/app/references/configuration.md#Timeouts) option - which has a default of `30000` ms.\n\nThis 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:\n\nThis 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.\n",
      "section": "api",
      "anchors": [
        "requesttimeout-and-responsetimeout"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 245
    },
    {
      "id": "api/commands/wait#rules",
      "doc_id": "api/commands/wait",
      "heading": "Rules",
      "heading_level": 2,
      "content_markdown": "## Rules\n\n### Requirements [Learn about chaining commands](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Chains-of-Commands)\n\n*   When passed a `time` argument `cy.wait()` can be chained off of `cy` or off another command.\n*   When passed an `alias` argument `cy.wait()` requires being chained off of `cy`.\n\n### Assertions [Learn about assertions](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Assertions)\n\n*   `cy.wait()` will only run assertions you have chained once, and will not [retry](/llm/markdown/app/core-concepts/retry-ability.md).\n\n### Timeouts [Learn about timeouts](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Timeouts)\n\n*   `cy.wait()` can time out waiting for the request to go out.\n*   `cy.wait()` can time out waiting for the response to return.\n",
      "section": "api",
      "anchors": [
        "rules"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 113
    },
    {
      "id": "api/commands/wait#requirements-learn-about-chaining-commands",
      "doc_id": "api/commands/wait",
      "heading": "Requirements Learn about chaining commands",
      "heading_level": 3,
      "content_markdown": "### Requirements [Learn about chaining commands](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Chains-of-Commands)\n\n*   When passed a `time` argument `cy.wait()` can be chained off of `cy` or off another command.\n*   When passed an `alias` argument `cy.wait()` requires being chained off of `cy`.\n",
      "section": "api",
      "anchors": [
        "requirements-learn-about-chaining-commands"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 48
    },
    {
      "id": "api/commands/wait#command-log",
      "doc_id": "api/commands/wait",
      "heading": "Command Log",
      "heading_level": 2,
      "content_markdown": "## Command Log\n\n**_Wait for the PUT to users to resolve._**\n\n```\ncy.intercept('PUT', /users/, {}).as('userPut')cy.get('form').submit()cy.wait('@userPut').its('request.url').should('include', 'users')\n```\n\nThe `cy.wait()` will display in the Command Log as:\n\nWhen clicking on `wait` within the command log, the console outputs the following:\n",
      "section": "api",
      "anchors": [
        "command-log"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 52
    }
  ]
}