Overview
Browser state storage lets you capture an authenticated session once and reuse it across any test that starts with the same snippet. When enabled, Supatest saves cookies, local storage, session storage, and key window properties at the end of the snippet run. On future runs, the runtime restores that snapshot before executing the rest of the steps, so login flows are skipped and tests reach business logic faster.Enable in the Editor
- Open a snippet in the Editor or create a new snippet.
- In Settings → Store Browser State, toggle the switch on.
- Pick a State expiry value using minutes, hours, or days (defaults to 1 day, max 30 days).
- Save the snippet. Every time the snippet finishes in a standard run, Supatest persists a fresh browser snapshot.
The toggle appears only for snippets. Regular test cases inherit snapshot behaviour automatically when their first step calls a browser-state-enabled snippet.

How restoration works at runtime
- First-step check – When a test starts, the runtime looks at the first step. If it is a snippet with browser state enabled, Supatest attempts to restore the latest snapshot from storage.
- TTL enforcement – The snapshot metadata tracks capture time and TTL. If the snapshot is missing or expired, Supatest logs a warning and runs the snippet normally.
- Context rebuild – Valid snapshots recreate the Playwright context, cookies, storage state, and window properties before any test steps execute. The snippet container step is marked as skipped to reflect that login work was already handled.
- Auto-renewal – After completing the snippet (or when restoration was skipped), the runtime saves a new snapshot so the session stays fresh for the next run.
Snapshot TTL and renewal
- Default TTL: 1 day (1,440 minutes).
- Upper bound: 30 days. Inputs beyond the limit clamp to the maximum.
- Unit picker: Switch between minutes, hours, and days to keep values readable.
- Empty or invalid values: Revert to the default to guarantee a safe fallback.
- Auto-refresh: Every successful snippet execution replaces the stored snapshot, keeping credentials current without manual steps.
Limits and edge cases
- Snippet position: Restoration only triggers when the snippet is the first step. If the snippet appears later, Supatest runs it normally and warns that the snapshot was skipped.
- Expired snapshots: Runs fall back to executing the snippet. A new snapshot is stored afterward.
- Environment alignment: Snapshots embed the environment selected during capture. Using the snippet in another environment may produce unexpected state—recreate the snapshot under the desired environment.
- Cross-browser consistency: Snapshots are captured with Chromium-based sessions. Mixing browser types can invalidate stored data.
- Manual overrides: Editor “Reset session” or explicit sign-outs wipe state; the next run captures a fresh snapshot.
Troubleshooting
- Test still hits login: Confirm the snippet toggle is on, verify the run starts with that snippet, and check logs for “No browser snapshot found” warnings.
- Snapshot expired immediately: Review the TTL input—values below 1 clamp to the default. Ensure the unit selector matches your intent.
- State drift after password rotations: Manually run the snippet once to refresh the snapshot. You can also temporarily disable the toggle, run, then re-enable to force a clean capture.
- Environment mismatch errors: If the target site redirects, ensure the snippet runs in the correct environment and that related environment variables are up-to-date.
Best practices
- Keep login snippets short—limit them to authentication and any essential redirects.
- Store snapshots only for stable, reusable identities; use runtime-generated credentials for one-off flows.
- Pair with Environments to manage URLs and secrets per deployment stage.
- Audit TTLs regularly to align with compliance policies and prevent long-lived sessions from accumulating.