{
  "doc": {
    "id": "api/commands/wait",
    "title": "cy.wait()",
    "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": "efcbe8c28d49ff52285a47072f279cb65f20c0fc",
    "updated_at": "2026-09-09T13:41:20.773Z",
    "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",
        "text": "Yields",
        "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#retry-ability",
        "text": "Retry-ability",
        "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",
        "text": "Requirements",
        "level": 3
      },
      {
        "id": "api/commands/wait#assertions",
        "text": "Assertions",
        "level": 3
      },
      {
        "id": "api/commands/wait#timeouts",
        "text": "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)\ncy.wait(alias)\ncy.wait(aliases)\ncy.wait(time, options)\ncy.wait(alias, options)\ncy.wait(aliases, options)\n```\n\n```\n// Specifying request and response types for aliased intercepts\ntype UserReq = {}\ntype UserRes = {}\ntype ActivityReq = {}\ntype ActivityRes = {}\n\ncy.intercept('/users/*').as('getUsers')\ncy.intercept('/activities/*').as('getActivities')\n\n// As templated types:\ncy.wait<UserReq, UserRes>('@getUsers').then(({ request, response }) => {\n  request.body // will be of type UserReq\n  response.body // will be of type UserRes\n})\n\n// As inferred types, with type `Interception` available in `cypress/types/net-stubbing`\ncy.wait('@getUsers').then(\n  ({ request, response }: Interception<UserReq, UserRes>) => {\n    request.body // will be of type UserReq\n    response.body // will be of type UserRes\n  }\n)\n\n// When passing an array of aliases, types must be inferred:\ncy.wait(['@getUsers', 'getActivities']).then(\n  (\n    interceptions: Array<\n      Interception<UserReq | ActivityReq, UserRes | ActivityRes>\n    >\n  ) => {\n    interceptions.forEach(({ request, response }) => {\n      request.body // will be of type UserReq | ActivityReq\n      response.body // will be of type UserRes | ActivityRes\n    })\n  }\n)\n```\n\n### Usage\n\n**Correct Usage**\n\n```\ncy.wait(500)\ncy.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\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\n`response.body` is only parsed into an `object` when the response includes a `Content-Type: application/json` header. Responses that omit this header, such as a `304 Not Modified` or `301` redirect, yield `response.body` as a `string`. See [the note about `body`](/llm/markdown/api/commands/intercept.md#Response-object-properties) in the `cy.intercept()` documentation for details and an example.\n",
      "section": "api",
      "anchors": [
        "syntax"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 572
    },
    {
      "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",
      "doc_id": "api/commands/wait",
      "heading": "Yields",
      "heading_level": 3,
      "content_markdown": "### Yields\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\n`response.body` is only parsed into an `object` when the response includes a `Content-Type: application/json` header. Responses that omit this header, such as a `304 Not Modified` or `301` redirect, yield `response.body` as a `string`. See [the note about `body`](/llm/markdown/api/commands/intercept.md#Response-object-properties) in the `cy.intercept()` documentation for details and an example.\n",
      "section": "api",
      "anchors": [
        "yields"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 135
    },
    {
      "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#when-given-an-alias-argument",
      "doc_id": "api/commands/wait",
      "heading": "When given an alias argument:",
      "heading_level": 4,
      "content_markdown": "#### When given an `alias` argument:\n\n*   `cy.wait()` 'yields an object containing the HTTP request and response properties of the request.\n\n`response.body` is only parsed into an `object` when the response includes a `Content-Type: application/json` header. Responses that omit this header, such as a `304 Not Modified` or `301` redirect, yield `response.body` as a `string`. See [the note about `body`](/llm/markdown/api/commands/intercept.md#Response-object-properties) in the `cy.intercept()` documentation for details and an example.\n",
      "section": "api",
      "anchors": [
        "when-given-an-alias-argument"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 92
    },
    {
      "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\n// without changing or stubbing its response\ncy.intercept('/accounts/*').as('getAccount')\ncy.visit('/accounts/123')\ncy.wait('@getAccount').then((interception) => {\n  // we can now access the low level interception\n  // that contains the request body,\n  // response body, status, etc\n})\n```\n\n```\n// Wait for the alias 'getAccount' to respond\n// without changing or stubbing its response\ncy.intercept('/accounts/*').as('getAccount')\ncy.mount(<Account />)\ncy.wait('@getAccount').then((interception) => {\n  // we can now access the low level interception\n  // that contains the request body,\n  // response body, status, etc\n})\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 books\ncy.intercept('GET', '/books', []).as('getBooks')\ncy.get('#search').type('Peter Pan')\n\n// wait for the first response to finish\ncy.wait('@getBooks')\n\n// the results should be empty because we\n// responded with an empty array first\ncy.get('#book-results').should('be.empty')\n\n// now the request (aliased again as `getBooks`) will return one book\ncy.intercept('GET', '/books', [{ name: 'Peter Pan' }]).as('getBooks')\n\ncy.get('#search').type('Peter Pan')\n\n// when we wait for 'getBooks' again, Cypress will\n// automatically know to wait for the 2nd response\ncy.wait('@getBooks')\n\n// we responded with one book the second time\ncy.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')\ncy.intercept('/activities/*').as('getActivities')\ncy.intercept('/comments/*').as('getComments')\ncy.visit('/dashboard')\n\ncy.wait(['@getUsers', '@getActivities', '@getComments']).then(\n  (interceptions) => {\n    // interceptions will now be an array of matching requests\n    // interceptions[0] <-- getUsers\n    // interceptions[1] <-- getActivities\n    // interceptions[2] <-- getComments\n  }\n)\n```\n\n```\ncy.intercept('/users/*').as('getUsers')\ncy.intercept('/activities/*').as('getActivities')\ncy.intercept('/comments/*').as('getComments')\ncy.mount(<Dashboard />)\n\ncy.wait(['@getUsers', '@getActivities', '@getComments']).then(\n  (interceptions) => {\n    // interceptions will now be an array of matching requests\n    // interceptions[0] <-- getUsers\n    // interceptions[1] <-- getActivities\n    // interceptions[2] <-- getComments\n  }\n)\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')\ncy.intercept('/activities/*').as('getActivities')\ncy.intercept('/comments/*').as('getComments')\ncy.wait(['@getUsers', '@getActivities', '@getComments']).spread(\n  (getUsers, getActivities, getComments) => {\n    // each interception is now an individual argument\n  }\n)\n```\n",
      "section": "api",
      "anchors": [
        "examples"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 592
    },
    {
      "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\n// without changing or stubbing its response\ncy.intercept('/accounts/*').as('getAccount')\ncy.visit('/accounts/123')\ncy.wait('@getAccount').then((interception) => {\n  // we can now access the low level interception\n  // that contains the request body,\n  // response body, status, etc\n})\n```\n\n```\n// Wait for the alias 'getAccount' to respond\n// without changing or stubbing its response\ncy.intercept('/accounts/*').as('getAccount')\ncy.mount(<Account />)\ncy.wait('@getAccount').then((interception) => {\n  // we can now access the low level interception\n  // that contains the request body,\n  // response body, status, etc\n})\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 books\ncy.intercept('GET', '/books', []).as('getBooks')\ncy.get('#search').type('Peter Pan')\n\n// wait for the first response to finish\ncy.wait('@getBooks')\n\n// the results should be empty because we\n// responded with an empty array first\ncy.get('#book-results').should('be.empty')\n\n// now the request (aliased again as `getBooks`) will return one book\ncy.intercept('GET', '/books', [{ name: 'Peter Pan' }]).as('getBooks')\n\ncy.get('#search').type('Peter Pan')\n\n// when we wait for 'getBooks' again, Cypress will\n// automatically know to wait for the 2nd response\ncy.wait('@getBooks')\n\n// we responded with one book the second time\ncy.get('#book-results').should('have.length', 1)\n```\n",
      "section": "api",
      "anchors": [
        "alias"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 305
    },
    {
      "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\n// without changing or stubbing its response\ncy.intercept('/accounts/*').as('getAccount')\ncy.visit('/accounts/123')\ncy.wait('@getAccount').then((interception) => {\n  // we can now access the low level interception\n  // that contains the request body,\n  // response body, status, etc\n})\n```\n\n```\n// Wait for the alias 'getAccount' to respond\n// without changing or stubbing its response\ncy.intercept('/accounts/*').as('getAccount')\ncy.mount(<Account />)\ncy.wait('@getAccount').then((interception) => {\n  // we can now access the low level interception\n  // that contains the request body,\n  // response body, status, etc\n})\n```\n",
      "section": "api",
      "anchors": [
        "wait-for-a-specific-request-to-respond"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 135
    },
    {
      "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 books\ncy.intercept('GET', '/books', []).as('getBooks')\ncy.get('#search').type('Peter Pan')\n\n// wait for the first response to finish\ncy.wait('@getBooks')\n\n// the results should be empty because we\n// responded with an empty array first\ncy.get('#book-results').should('be.empty')\n\n// now the request (aliased again as `getBooks`) will return one book\ncy.intercept('GET', '/books', [{ name: 'Peter Pan' }]).as('getBooks')\n\ncy.get('#search').type('Peter Pan')\n\n// when we wait for 'getBooks' again, Cypress will\n// automatically know to wait for the 2nd response\ncy.wait('@getBooks')\n\n// we responded with one book the second time\ncy.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": 151
    },
    {
      "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')\ncy.intercept('/activities/*').as('getActivities')\ncy.intercept('/comments/*').as('getComments')\ncy.visit('/dashboard')\n\ncy.wait(['@getUsers', '@getActivities', '@getComments']).then(\n  (interceptions) => {\n    // interceptions will now be an array of matching requests\n    // interceptions[0] <-- getUsers\n    // interceptions[1] <-- getActivities\n    // interceptions[2] <-- getComments\n  }\n)\n```\n\n```\ncy.intercept('/users/*').as('getUsers')\ncy.intercept('/activities/*').as('getActivities')\ncy.intercept('/comments/*').as('getComments')\ncy.mount(<Dashboard />)\n\ncy.wait(['@getUsers', '@getActivities', '@getComments']).then(\n  (interceptions) => {\n    // interceptions will now be an array of matching requests\n    // interceptions[0] <-- getUsers\n    // interceptions[1] <-- getActivities\n    // interceptions[2] <-- getComments\n  }\n)\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')\ncy.intercept('/activities/*').as('getActivities')\ncy.intercept('/comments/*').as('getComments')\ncy.wait(['@getUsers', '@getActivities', '@getComments']).spread(\n  (getUsers, getActivities, getComments) => {\n    // each interception is now an individual argument\n  }\n)\n```\n",
      "section": "api",
      "anchors": [
        "aliases"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 201
    },
    {
      "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')\ncy.intercept('/activities/*').as('getActivities')\ncy.intercept('/comments/*').as('getComments')\ncy.visit('/dashboard')\n\ncy.wait(['@getUsers', '@getActivities', '@getComments']).then(\n  (interceptions) => {\n    // interceptions will now be an array of matching requests\n    // interceptions[0] <-- getUsers\n    // interceptions[1] <-- getActivities\n    // interceptions[2] <-- getComments\n  }\n)\n```\n\n```\ncy.intercept('/users/*').as('getUsers')\ncy.intercept('/activities/*').as('getActivities')\ncy.intercept('/comments/*').as('getComments')\ncy.mount(<Dashboard />)\n\ncy.wait(['@getUsers', '@getActivities', '@getComments']).then(\n  (interceptions) => {\n    // interceptions will now be an array of matching requests\n    // interceptions[0] <-- getUsers\n    // interceptions[1] <-- getActivities\n    // interceptions[2] <-- getComments\n  }\n)\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": 155
    },
    {
      "id": "api/commands/wait#using-spread-to-spread-the-array-into-multiple-arguments",
      "doc_id": "api/commands/wait",
      "heading": "Using .spread() to spread the array into multiple arguments.",
      "heading_level": 4,
      "content_markdown": "#### Using [`.spread()`](/llm/markdown/api/commands/spread.md) to spread the array into multiple arguments.\n\n```\ncy.intercept('/users/*').as('getUsers')\ncy.intercept('/activities/*').as('getActivities')\ncy.intercept('/comments/*').as('getComments')\ncy.wait(['@getUsers', '@getActivities', '@getComments']).spread(\n  (getUsers, getActivities, getComments) => {\n    // each interception is now an individual argument\n  }\n)\n```\n",
      "section": "api",
      "anchors": [
        "using-spread-to-spread-the-array-into-multiple-arguments"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 44
    },
    {
      "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 callbacks\ncy.wait('@alias')\n  .then(() => {\n    cy.get(...)\n  })\n\n// Recommended practice: write Cypress commands serially\ncy.wait('@alias')\ncy.get(...)\n\n// Example: assert status from cy.intercept() before proceeding\ncy.wait('@alias').its('response.statusCode').should('eq', 200)\ncy.get(...)\n```\n\nRead [Guide: Introduction to Cypress](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Commands-Run-Serially)\n\n### Retry-ability\n\nHow you write the chain after `cy.wait()` decides whether your assertions [retry](/llm/markdown/app/core-concepts/retry-ability.md), and how long a failing assertion takes to fail. Both styles below work, so pick the one that matches what you want.\n\nRetry-ability belongs to the chain, not to a single command. `cy.wait()` is not a query, so an assertion chained straight onto it gets a single attempt against the interception object it yielded:\n\n```\n// one attempt: fails as soon as the status code is wrong\ncy.wait('@getAccount').should(\n  'have.nested.property',\n  'response.statusCode',\n  200\n)\n```\n\nAdd a query such as [`.its()`](/llm/markdown/api/commands/its.md) or [`.invoke()`](/llm/markdown/api/commands/invoke.md) and you start a new retryable chain. The query re-reads the property, and everything after it retries for up to [`defaultCommandTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) (`4000` ms by default):\n\n```\n// retries for up to 4 seconds before passing or failing\ncy.wait('@getAccount').its('response.statusCode').should('eq', 200)\n```\n\nIf you want the retrying version to fail fast instead, set the query's timeout to `0`:\n\n```\n// checks the value once, at that moment\ncy.wait('@getAccount')\n  .its('response.statusCode', { timeout: 0 })\n  .should('eq', 200)\n```\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": 591
    },
    {
      "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 callbacks\ncy.wait('@alias')\n  .then(() => {\n    cy.get(...)\n  })\n\n// Recommended practice: write Cypress commands serially\ncy.wait('@alias')\ncy.get(...)\n\n// Example: assert status from cy.intercept() before proceeding\ncy.wait('@alias').its('response.statusCode').should('eq', 200)\ncy.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": 77
    },
    {
      "id": "api/commands/wait#retry-ability",
      "doc_id": "api/commands/wait",
      "heading": "Retry-ability",
      "heading_level": 3,
      "content_markdown": "### Retry-ability\n\nHow you write the chain after `cy.wait()` decides whether your assertions [retry](/llm/markdown/app/core-concepts/retry-ability.md), and how long a failing assertion takes to fail. Both styles below work, so pick the one that matches what you want.\n\nRetry-ability belongs to the chain, not to a single command. `cy.wait()` is not a query, so an assertion chained straight onto it gets a single attempt against the interception object it yielded:\n\n```\n// one attempt: fails as soon as the status code is wrong\ncy.wait('@getAccount').should(\n  'have.nested.property',\n  'response.statusCode',\n  200\n)\n```\n\nAdd a query such as [`.its()`](/llm/markdown/api/commands/its.md) or [`.invoke()`](/llm/markdown/api/commands/invoke.md) and you start a new retryable chain. The query re-reads the property, and everything after it retries for up to [`defaultCommandTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) (`4000` ms by default):\n\n```\n// retries for up to 4 seconds before passing or failing\ncy.wait('@getAccount').its('response.statusCode').should('eq', 200)\n```\n\nIf you want the retrying version to fail fast instead, set the query's timeout to `0`:\n\n```\n// checks the value once, at that moment\ncy.wait('@getAccount')\n  .its('response.statusCode', { timeout: 0 })\n  .should('eq', 200)\n```\n",
      "section": "api",
      "anchors": [
        "retry-ability"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 225
    },
    {
      "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\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\n\n*   Assertions chained _directly_ to `cy.wait()` run once and will not [retry](/llm/markdown/app/core-concepts/retry-ability.md).\n*   Assertions chained after a query such as [`.its()`](/llm/markdown/api/commands/its.md) or [`.invoke()`](/llm/markdown/api/commands/invoke.md) _do_ retry, because [retry-ability follows the chain](#Retry-ability), not the command.\n\n### 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": 125
    },
    {
      "id": "api/commands/wait#requirements",
      "doc_id": "api/commands/wait",
      "heading": "Requirements",
      "heading_level": 3,
      "content_markdown": "### Requirements\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"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 43
    },
    {
      "id": "api/commands/wait#assertions",
      "doc_id": "api/commands/wait",
      "heading": "Assertions",
      "heading_level": 3,
      "content_markdown": "### Assertions\n\n*   Assertions chained _directly_ to `cy.wait()` run once and will not [retry](/llm/markdown/app/core-concepts/retry-ability.md).\n*   Assertions chained after a query such as [`.its()`](/llm/markdown/api/commands/its.md) or [`.invoke()`](/llm/markdown/api/commands/invoke.md) _do_ retry, because [retry-ability follows the chain](#Retry-ability), not the command.\n",
      "section": "api",
      "anchors": [
        "assertions"
      ],
      "path": "/llm/json/chunked/api/commands/wait.json",
      "token_estimate": 47
    },
    {
      "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')\ncy.get('form').submit()\ncy.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": 55
    }
  ]
}