-
-
Notifications
You must be signed in to change notification settings - Fork 750
feat: Add support for Playwright storageState configuration #5192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add support for Playwright storageState configuration #5192
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for Playwright's native storageState
configuration to the Playwright helper, enabling users to initialize browser contexts with preloaded session data such as cookies, localStorage, and authentication tokens. The feature allows passing either a file path to a JSON storage state or a storage state object directly.
- Adds
storageState
configuration option to Playwright helper - Implements
grabStorageState()
method to capture current browser state - Ensures scenario-level cookies override global storageState configuration
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
lib/helper/Playwright.js | Adds storageState config handling and grabStorageState method |
test/helper/Playwright_test.js | Comprehensive test coverage for storageState functionality |
docs/playwright.md | User guide documentation with examples and security warnings |
docs/helpers/Playwright.md | API reference documentation for new features |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The logic for handling storageState and cookies should be more explicit. Consider extracting this into a separate method or adding a comment explaining why scenario cookies completely override storageState rather than merging.
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, this feels like nitpicking. The current else if is already clear enough, and extracting it into a separate method or adding more comments wouldn’t really improve understanding here.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This PR introduces a new
storageState
option in the Playwright helper configuration.With this change, users can pass a Playwright storage state directly (either as a path to a JSON file or as an object) to initialize browser contexts with preloaded session data such as cookies, localStorage, IndexedDB, or authentication tokens.
Key points
storageState
can be configured globally incodecept.conf.js
or overridden per scenario.Applicable helpers:
Applicable plugins:
Type of change
Checklist:
npm run docs
)npm run lint
)npm test
)