Skip to content

fix(playwright): persist storageState cookies and localStorage - #631

Open
xrip wants to merge 1 commit into
h4ckf0r0day:mainfrom
xrip:fix/playwright-storage-state
Open

fix(playwright): persist storageState cookies and localStorage#631
xrip wants to merge 1 commit into
h4ckf0r0day:mainfrom
xrip:fix/playwright-storage-state

Conversation

@xrip

@xrip xrip commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

What changed

Adds Playwright BrowserContext.storageState compatibility for cookies and origin-scoped localStorage. Storage is shared by pages in one context and isolated between contexts. Adds Network.clearBrowserCache as a protocol-compatible no-op and Storage.clearCookies, which Playwright uses while loading state. Adds an offline Playwright regression test and documents save/restore usage.

Related to #629. The existing issue tracks persistent session state for obscura mcp; this PR covers the standard Playwright storage-state path.

Validation

  • cargo build --release -p obscura-cli --no-default-features
  • node crates/obscura-cdp/tests/playwright_storage_state.mjs (pass with Playwright 1.62.1)
  • cargo nextest run --release --no-default-features -p obscura-cdp -E 'not test(max_connections_refuses_then_recovers)' (114 passed, 4 skipped)
  • The existing max_connections_refuses_then_recovers test was also run alone and failed with a Windows TCP connection reset; it does not touch the changed code.
  • node --check crates/obscura-cdp/tests/playwright_storage_state.mjs

Rendering

Not applicable.

Performance

No expected hot-path impact. localStorage has bounded per-origin, total-byte, and origin-count limits.

Checklist

  • The change is focused and does not remove existing behavior without justification.
  • Tests cover the failure or feature.
  • Existing relevant tests pass in the no-render configuration.
  • I checked for CPU, latency, and memory regressions.
  • Public API and user-facing behavior changes are documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants