Add Set Storage State keyword and indexedDB=/credentials= arguments on Save Storage State #5117 - #5149
Open
Snooz82 wants to merge 4 commits into
Open
Add Set Storage State keyword and indexedDB=/credentials= arguments on Save Storage State #5117#5149Snooz82 wants to merge 4 commits into
Snooz82 wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Implements issue #5117 by expanding storage-state capture and enabling restoration into active contexts.
Changes:
- Adds
Set Storage Statewith timeout handling. - Supports custom paths, IndexedDB, and WebAuthn credentials.
- Adds acceptance tests for storage-state scenarios.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
protobuf/playwright.proto |
Extends storage-state RPC contracts. |
package-lock.json |
Refreshes dependency metadata. |
node/playwright-wrapper/playwright-state.ts |
Implements save/set operations. |
node/playwright-wrapper/grpc-service.ts |
Exposes the new gRPC operation. |
Browser/keywords/playwright_state.py |
Adds and documents keyword APIs. |
atest/test/01_Browser_Management/storage_state.robot |
Adds storage-state acceptance coverage. |
Suppressed comments (1)
Browser/keywords/playwright_state.py:1798
- The file is validated relative to the Python process, but this relative string is then opened by the Node wrapper from
Browser/wrapper(Browser/playwright.py:280). Thus a documented call such asSet Storage State auth.jsoncan passis_file()and still fail in Playwright. Send an absolute path over gRPC.
path=str(path), timeout=int(self.get_timeout(timeout))
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+1159
to
+1165
| try { | ||
| await Promise.race([ | ||
| context.c.setStorageState(stateFile), | ||
| new Promise((_, reject) => { | ||
| timer = setTimeout(() => reject(new Error(timeoutMessage)), timeout); | ||
| }), | ||
| ]); |
Comment on lines
+1160
to
+1164
| await Promise.race([ | ||
| context.c.setStorageState(stateFile), | ||
| new Promise((_, reject) => { | ||
| timer = setTimeout(() => reject(new Error(timeoutMessage)), timeout); | ||
| }), |
Review fixes for #5117: - Resolve the path of Save Storage State and Set Storage State to an absolute one before sending it over grpc. The node wrapper runs with Browser/wrapper as its working directory, so a relative path was created in one directory and written in another, and the returned path pointed nowhere. Covered by a new acceptance test. - Skip the Set Storage State timeout when it resolves to zero, which conventionally means no timeout. - Do not leave the raced setStorageState promise unhandled, and say in the timeout message that the state can still be applied later, so the context should no longer be used. Restore package-lock.json to the version on main. It had lost its @emnapi entries, which broke npm ci and with it every CI job. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01SuiwgM8Rt9kd6K7TBtFMDz
The acceptance test that is disabled until playwright#42258 is fixed called Skip without declaring it in its documentation. robotstatuschecker derives the expected status from the documentation and defaults to PASS, so it turned the skip into a failure and every job running the acceptance tests ended with rc=1, even though Robot Framework itself reported no failures. New Context validated its storageState argument against the Robot Framework working directory but sent the path on unresolved, while the node wrapper runs with Browser/wrapper as its working directory. A relative path therefore passed validation and then failed in the node process with a raw ENOENT. Resolve it like Save Storage State and Set Storage State already do, and extend the relative path test to cover all three keywords. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01SuiwgM8Rt9kd6K7TBtFMDz
The suite failed on Windows with four tests, all of them assertions that assumed forward slashes. Save Storage State returns the resolved path, which uses the native separator, while the expected values were built from Robot Framework variables with forward slashes. Normalize the expected values before comparing them. The two invalid path tests matched the full error message, which now contains a platform native separator because storageState and path are Path arguments rather than strings. Match the separator with the glob wildcard the expected error already supports. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01SuiwgM8Rt9kd6K7TBtFMDz
Snooz82
force-pushed
the
topic/storageState
branch
from
August 15, 2026 08:54
2186256 to
48ff172
Compare
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.
No description provided.