fix(playwright): persist storageState cookies and localStorage - #631
Open
xrip wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Adds Playwright
BrowserContext.storageStatecompatibility for cookies and origin-scoped localStorage. Storage is shared by pages in one context and isolated between contexts. AddsNetwork.clearBrowserCacheas a protocol-compatible no-op andStorage.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-featuresnode 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)max_connections_refuses_then_recoverstest 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.mjsRendering
Not applicable.
Performance
No expected hot-path impact. localStorage has bounded per-origin, total-byte, and origin-count limits.
Checklist