---
title: "Replay a signed-in state without sharing a real session | Proofline"
description: "Many bugs only appear for a signed-in user with a particular account setup. Sending the maintainer your cookies would reproduce it and hand over the account."
url: https://proofline.sh/learn/replay-logged-in-state/
---

[Learning center](/learn/)

# Replay a signed-in state without sharing a real session

Many bugs only appear for a signed-in user with a particular account setup. Sending the maintainer your cookies would reproduce it and hand over the account. Save the storage of a test account instead, in a file the maintainer loads into a fresh browser, and know which parts of the state that file leaves out.

Permission errors The Proofline team November 22, 2026 3 min read

## Save the state of a test account

Playwright saves a browser context's cookies and per-origin storage to a JSON file and loads it into a new context. [Playwright: Authentication](https://playwright.dev/docs/auth)

Sign in by hand with codegen and save the state when you close the browser:

```
npx playwright codegen --save-storage=state.json https://staging.example.test/login
```

Or save it from a script once the page is in the state you need:

```
await context.storageState({ path: 'state.json', indexedDB: true });
```

The maintainer loads it:

```
npx playwright codegen --load-storage=state.json https://staging.example.test/orders
```

```
const context = await browser.newContext({ storageState: 'state.json' });
```

## What the file holds, and what it leaves out

We saved a context with Playwright 1.63 after writing a cookie, a local storage key and an IndexedDB record:

| State | In `storageState()` by default | With `indexedDB: true` |
| --- | --- | --- |
| Cookies, with their flags and expiry | Yes | Yes |
| Local storage, per origin | Yes | Yes |
| IndexedDB | No | Yes |
| Session storage | No | No |
| Service worker registrations and caches | No | No |
| Permissions such as notifications | No | No |

The IndexedDB row matters for apps that keep their session there. Playwright's API documentation names Firebase Authentication as an example. If the replay comes up signed out even though cookies loaded, save again with `indexedDB: true`. [Playwright: `browserContext.storageState()`](https://playwright.dev/docs/api/class-browsercontext#browser-context-storage-state)

Session storage belongs to one tab and ends with it, so a file cannot carry it. If the bug depends on it, seed it at page load with an init script, as [the local storage guide](/learn/seed-local-storage-indexeddb/) shows.

## The file is a credential

A state file holds live session cookies. Anyone with the file is signed in as that account until the session ends.

-   Use a test account in a non-production environment, created for the reproduction.
-   Give it the role and data the bug needs, and nothing else.
-   Share the file through a channel with access control, never in a public issue.
-   Sign out of the account, or revoke its sessions, when the maintainer is done.

If the bug only appears on a real customer's account, describe the account's shape instead: its plan, role, feature flags, number of records and any unusual values. The maintainer can build a test account with the same shape.

## Sessions expire

Cookies in the file carry their expiry, and the server may also end sessions on its own schedule. A state file that worked on Monday may sign the maintainer in to nothing on Wednesday. Note when you saved it and how long sessions last, or send the steps to sign in so the maintainer can save a fresh one.

## Worked example: a menu item that only admins lose

This example is fictional. A tester reports that the **Billing** menu item is missing for an admin account. The developer, also an admin, sees it.

The tester creates a new admin test account in staging that also shows the bug, saves `state.json` with codegen and sends it. The developer loads it and sees the menu without **Billing**. Comparing the developer's own state with the file shows one difference in local storage: `nav.collapsed = ["billing"]`, written when the tester collapsed a menu group on a different page. The menu component hid collapsed groups' parent items instead of only their children. Without the stored value, the developer could have tried every role without reproducing it.

## Questions

### Can I export the state from my normal Chrome profile?

Not directly with Playwright. You can sign in to a test account in a Playwright browser instead, or copy specific values from DevTools' **Application** panel and seed them. Avoid copying session cookies from a real account.

### Does the file work in a different browser engine?

Generally yes: cookies and storage are plain data. Some cookie attributes behave differently across engines, so if the replay differs between Chromium and WebKit, that difference is part of the bug.

### Can I edit the file by hand?

Yes, it is JSON. Removing or changing one value at a time is a quick way to find which value the bug needs.

Return to [reproducing what someone else saw](/learn/replay-browser-bug-report/) for the other layers a replay needs.

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [Capture and seed the local storage or IndexedDB value that changed the behavior](/learn/seed-local-storage-indexeddb/)
    
    Schema conflicts The Proofline team November 22, 2026 3 min read
    
-   ### [Turn written reproduction steps into a script with codegen](/learn/playwright-codegen-reproduction/)
    
    Network outages The Proofline team November 22, 2026 3 min read
