{
  "doc": {
    "id": "api/commands/getalllocalstorage",
    "title": "cy.getAllLocalStorage()",
    "description": "Get localStorage data for all origins with which the test has interacted in Cypress.",
    "section": "api",
    "source_path": "/llm/markdown/api/commands/getalllocalstorage.md",
    "version": "066c46e056f0f322a0670d2d3aa4e6adaebfe717",
    "updated_at": "2026-09-10T13:30:12.426Z",
    "headings": [
      {
        "id": "api/commands/getalllocalstorage#getalllocalstorage",
        "text": "getAllLocalStorage",
        "level": 1
      },
      {
        "id": "api/commands/getalllocalstorage#syntax",
        "text": "Syntax",
        "level": 2
      },
      {
        "id": "api/commands/getalllocalstorage#usage",
        "text": "Usage",
        "level": 3
      },
      {
        "id": "api/commands/getalllocalstorage#arguments",
        "text": "Arguments",
        "level": 3
      },
      {
        "id": "api/commands/getalllocalstorage#yields",
        "text": "Yields",
        "level": 3
      },
      {
        "id": "api/commands/getalllocalstorage#when-no-localstorage-data-is-present",
        "text": "When no localStorage data is present:",
        "level": 4
      },
      {
        "id": "api/commands/getalllocalstorage#examples",
        "text": "Examples",
        "level": 2
      },
      {
        "id": "api/commands/getalllocalstorage#get-all-localstorage",
        "text": "Get all localStorage",
        "level": 3
      },
      {
        "id": "api/commands/getalllocalstorage#rules",
        "text": "Rules",
        "level": 2
      },
      {
        "id": "api/commands/getalllocalstorage#requirements",
        "text": "Requirements",
        "level": 3
      },
      {
        "id": "api/commands/getalllocalstorage#assertions",
        "text": "Assertions",
        "level": 3
      },
      {
        "id": "api/commands/getalllocalstorage#timeouts",
        "text": "Timeouts",
        "level": 3
      },
      {
        "id": "api/commands/getalllocalstorage#history",
        "text": "History",
        "level": 2
      },
      {
        "id": "api/commands/getalllocalstorage#see-also",
        "text": "See also",
        "level": 2
      }
    ]
  },
  "chunks": [
    {
      "id": "api/commands/getalllocalstorage#syntax",
      "doc_id": "api/commands/getalllocalstorage",
      "heading": "Syntax",
      "heading_level": 2,
      "content_markdown": "## Syntax\n\n```\ncy.getAllLocalStorage()\ncy.getAllLocalStorage(options)\n```\n\n### Usage\n\n**Correct Usage**\n\n```\ncy.getAllLocalStorage()\n```\n\n### Arguments\n\n**options _(Object)_**\n\nPass in an options object to change the default behavior of `cy.getAllLocalStorage()`.\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` | [`defaultCommandTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Time to wait for `cy.getAllLocalStorage()` to resolve before [timing out](#Timeouts) |\n\n### Yields\n\n`cy.getAllLocalStorage()` yields an object where the keys are origins and the values are key-value pairs of `localStorage` data.\n\nFor example, if `key1` is set to `value1` on `https://example.cypress.io` and `key2` is set to `value2` on `https://www.cypress-dx.com`, `cy.getAllLocalStorage()` will yield:\n\n```\n{\n  'https://example.cypress.io': {\n    key1: 'value1',\n  },\n  'https://www.cypress-dx.com': {\n    key2: 'value2',\n  },\n}\n```\n\n`cy.getAllLocalStorage()` is a query, and it is _safe_ to chain further commands. It will automatically [retry](/llm/markdown/app/core-concepts/retry-ability.md) until all chained assertions have passed, or until it times out, re-reading `localStorage` from all origins on each retry so the yielded object stays up to date.\n\nBecause `cy.getAllLocalStorage()` is a query, it re-reads `localStorage` on every retry, and assertions you chain with [`.should()`](/llm/markdown/api/commands/should.md) drive those retries until they pass or the command times out. A [`.then()`](/llm/markdown/api/commands/then.md) callback, by contrast, runs only once after the command settles and is not retried — so prefer chaining [`.should()`](/llm/markdown/api/commands/should.md) assertions over asserting inside `.then()` when you need Cypress to wait for storage to be populated.\n\n#### When no `localStorage` data is present:\n\nOn each read, `cy.getAllLocalStorage()` yields the current object of origins to `localStorage` data, or an empty object if none exists yet. The yielded object is the subject your chained assertions run against. If an assertion fails, because the object is empty, or because its contents don't match yet, the query re-reads `localStorage` and re-runs the assertion, looping until it passes or the command times out.\n",
      "section": "api",
      "anchors": [
        "syntax"
      ],
      "path": "/llm/json/chunked/api/commands/getalllocalstorage.json",
      "token_estimate": 409
    },
    {
      "id": "api/commands/getalllocalstorage#arguments",
      "doc_id": "api/commands/getalllocalstorage",
      "heading": "Arguments",
      "heading_level": 3,
      "content_markdown": "### Arguments\n\n**options _(Object)_**\n\nPass in an options object to change the default behavior of `cy.getAllLocalStorage()`.\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` | [`defaultCommandTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Time to wait for `cy.getAllLocalStorage()` to resolve before [timing out](#Timeouts) |\n",
      "section": "api",
      "anchors": [
        "arguments"
      ],
      "path": "/llm/json/chunked/api/commands/getalllocalstorage.json",
      "token_estimate": 79
    },
    {
      "id": "api/commands/getalllocalstorage#yields",
      "doc_id": "api/commands/getalllocalstorage",
      "heading": "Yields",
      "heading_level": 3,
      "content_markdown": "### Yields\n\n`cy.getAllLocalStorage()` yields an object where the keys are origins and the values are key-value pairs of `localStorage` data.\n\nFor example, if `key1` is set to `value1` on `https://example.cypress.io` and `key2` is set to `value2` on `https://www.cypress-dx.com`, `cy.getAllLocalStorage()` will yield:\n\n```\n{\n  'https://example.cypress.io': {\n    key1: 'value1',\n  },\n  'https://www.cypress-dx.com': {\n    key2: 'value2',\n  },\n}\n```\n\n`cy.getAllLocalStorage()` is a query, and it is _safe_ to chain further commands. It will automatically [retry](/llm/markdown/app/core-concepts/retry-ability.md) until all chained assertions have passed, or until it times out, re-reading `localStorage` from all origins on each retry so the yielded object stays up to date.\n\nBecause `cy.getAllLocalStorage()` is a query, it re-reads `localStorage` on every retry, and assertions you chain with [`.should()`](/llm/markdown/api/commands/should.md) drive those retries until they pass or the command times out. A [`.then()`](/llm/markdown/api/commands/then.md) callback, by contrast, runs only once after the command settles and is not retried — so prefer chaining [`.should()`](/llm/markdown/api/commands/should.md) assertions over asserting inside `.then()` when you need Cypress to wait for storage to be populated.\n\n#### When no `localStorage` data is present:\n\nOn each read, `cy.getAllLocalStorage()` yields the current object of origins to `localStorage` data, or an empty object if none exists yet. The yielded object is the subject your chained assertions run against. If an assertion fails, because the object is empty, or because its contents don't match yet, the query re-reads `localStorage` and re-runs the assertion, looping until it passes or the command times out.\n",
      "section": "api",
      "anchors": [
        "yields"
      ],
      "path": "/llm/json/chunked/api/commands/getalllocalstorage.json",
      "token_estimate": 313
    },
    {
      "id": "api/commands/getalllocalstorage#when-no-localstorage-data-is-present",
      "doc_id": "api/commands/getalllocalstorage",
      "heading": "When no localStorage data is present:",
      "heading_level": 4,
      "content_markdown": "#### When no `localStorage` data is present:\n\nOn each read, `cy.getAllLocalStorage()` yields the current object of origins to `localStorage` data, or an empty object if none exists yet. The yielded object is the subject your chained assertions run against. If an assertion fails, because the object is empty, or because its contents don't match yet, the query re-reads `localStorage` and re-runs the assertion, looping until it passes or the command times out.\n",
      "section": "api",
      "anchors": [
        "when-no-localstorage-data-is-present"
      ],
      "path": "/llm/json/chunked/api/commands/getalllocalstorage.json",
      "token_estimate": 96
    },
    {
      "id": "api/commands/getalllocalstorage#rules",
      "doc_id": "api/commands/getalllocalstorage",
      "heading": "Rules",
      "heading_level": 2,
      "content_markdown": "## Rules\n\n### Requirements\n\n*   `cy.getAllLocalStorage()` requires being chained off of `cy`.\n\n### Assertions\n\n*   `cy.getAllLocalStorage()` will automatically [retry](/llm/markdown/app/core-concepts/retry-ability.md) until all chained assertions have passed.\n\n### Timeouts\n\n*   `cy.getAllLocalStorage()` can time out waiting for assertions you've added to pass.\n",
      "section": "api",
      "anchors": [
        "rules"
      ],
      "path": "/llm/json/chunked/api/commands/getalllocalstorage.json",
      "token_estimate": 52
    },
    {
      "id": "api/commands/getalllocalstorage#history",
      "doc_id": "api/commands/getalllocalstorage",
      "heading": "History",
      "heading_level": 2,
      "content_markdown": "## History\n\n| Version | Changes |\n| --- | --- |\n| [16.0.0](/llm/markdown/app/references/changelog.md#16-0-0) | `cy.getAllLocalStorage()` is now a query and retries assertions until they pass or time out. |\n",
      "section": "api",
      "anchors": [
        "history"
      ],
      "path": "/llm/json/chunked/api/commands/getalllocalstorage.json",
      "token_estimate": 40
    }
  ]
}