---
source: https://iinventedlight.com/library/notes/playwright-storage-state.md
title: "storageState reuses saved authenticated browser state across tests"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache-2.0 (Playwright docs); Apache-2.0 (microsoft/playwright (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Playwright docs, Authentication, Apache-2.0 (https://raw.githubusercontent.com/microsoft/playwright/main/LICENSE). Copyright (c) Microsoft Corporation; microsoft/playwright (GitHub), auth.md (Playwright source docs), Apache-2.0 (https://raw.githubusercontent.com/microsoft/playwright/main/LICENSE). Copyright (c) Microsoft Corporation."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-17
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-17
as_of: 2026-11-17
confidence: medium
untested: "Not reproduced (2026-11-17). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-web: Playwright storageState"
tags: [playwright, storageState, authentication, browser-context, setup-project]
client: Librarian
sources:
  - id: S1
    title: "Authentication"
    publisher: Playwright docs
    url: https://playwright.dev/docs/auth
    accessed: 2026-11-17
    license: "Apache-2.0"
  - id: S2
    title: "auth.md (Playwright source docs)"
    publisher: microsoft/playwright (GitHub)
    url: https://github.com/microsoft/playwright/blob/main/docs/src/auth.md
    accessed: 2026-11-17
    license: "Apache-2.0"
---
# storageState reuses saved authenticated browser state across tests
**Answer:** Playwright executes tests in isolated environments called browser contexts. Tests can load existing authenticated state, so they do not have to authenticate in every test, which also speeds up the run. An authentication routine can produce authenticated browser state and save it to a file. Later on, tests will reuse this state and start already authenticated.

## Recommended shared-account setup

Create a setup project that signs in and then calls `page.context().storageState({ path: authFile })`. Add a setup project in the config and declare it as a dependency of the testing projects. That setup project authenticates first. Each testing project should then take the authenticated state via `storageState`.

This is the recommended approach when tests can share one account and do not change server-side state in ways that would collide. The state file can hold sensitive cookies and headers, so do not commit it.

## See also

- [playwright-locators](https://iinventedlight.com/library/notes/playwright-locators/)
- [playwright-headless-tests](https://iinventedlight.com/library/notes/playwright-headless-tests/)
- [playwright-api-testing](https://iinventedlight.com/library/notes/playwright-api-testing/)

## Claims

- id: C1
  claim: Tests can load existing authenticated state instead of signing in every time.
  source: S1
  evidence: "Tests can load existing authenticated state"

- id: C2
  claim: Later tests reuse the saved state and start already authenticated.
  source: S1
  evidence: "tests will reuse this state and start already authenticated"

- id: C3
  claim: storageState on the browser context writes the authenticated state to a file.
  source: S2
  evidence: "await page.context().storageState({ path: authFile })"

- id: C4
  claim: Testing projects should use the saved state as storageState.
  source: S2
  evidence: "use the authenticated state as `storageState`"

## Sources

- [S1] Authentication. Playwright docs. https://playwright.dev/docs/auth . License: Apache-2.0. Accessed 2026-11-17.

- [S2] auth.md (Playwright source docs). microsoft/playwright (GitHub). https://github.com/microsoft/playwright/blob/main/docs/src/auth.md . License: Apache-2.0. Accessed 2026-11-17.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Playwright docs, Authentication, Apache-2.0 (https://raw.githubusercontent.com/microsoft/playwright/main/LICENSE). Copyright (c) Microsoft Corporation; microsoft/playwright (GitHub), auth.md (Playwright source docs), Apache-2.0 (https://raw.githubusercontent.com/microsoft/playwright/main/LICENSE). Copyright (c) Microsoft Corporation. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
