From 33e516887bf067f605ce3141b26548fdd2af3762 Mon Sep 17 00:00:00 2001
From: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Date: Thu, 6 Feb 2025 10:11:18 +0000
Subject: [PATCH] feat(roll): roll to ToT Playwright (06-02-25)
---
dotnet/docs/api/class-browsercontext.mdx | 2 +-
dotnet/docs/auth.mdx | 6 +-
dotnet/docs/codegen.mdx | 4 +-
java/docs/api/class-browsercontext.mdx | 2 +-
java/docs/auth.mdx | 6 +-
java/docs/codegen.mdx | 4 +-
nodejs/docs/api/class-apirequest.mdx | 55 +++++++++
nodejs/docs/api/class-apirequestcontext.mdx | 54 +++++++++
nodejs/docs/api/class-browser.mdx | 120 +++++++++++++++++++-
nodejs/docs/api/class-browsercontext.mdx | 56 ++++++++-
nodejs/docs/api/class-testoptions.mdx | 60 +++++++++-
nodejs/docs/api/class-testproject.mdx | 5 +
nodejs/docs/api/class-teststepinfo.mdx | 65 +++++++++++
nodejs/docs/auth.mdx | 2 +-
nodejs/docs/codegen.mdx | 4 +-
python/docs/api/class-apirequest.mdx | 55 +++++++++
python/docs/api/class-apirequestcontext.mdx | 54 +++++++++
python/docs/api/class-browser.mdx | 120 +++++++++++++++++++-
python/docs/api/class-browsercontext.mdx | 56 ++++++++-
python/docs/auth.mdx | 6 +-
python/docs/codegen.mdx | 4 +-
21 files changed, 703 insertions(+), 37 deletions(-)
diff --git a/dotnet/docs/api/class-browsercontext.mdx b/dotnet/docs/api/class-browsercontext.mdx
index 9f02bbde20e..4fe1e4d69a8 100644
--- a/dotnet/docs/api/class-browsercontext.mdx
+++ b/dotnet/docs/api/class-browsercontext.mdx
@@ -908,7 +908,7 @@ await BrowserContext.SetOfflineAsync(offline);
Added before v1.9browserContext.StorageStateAsync
-Returns storage state for this browser context, contains current cookies and local storage snapshot.
+Returns storage state for this browser context, contains current cookies, local storage snapshot and IndexedDB snapshot.
**Usage**
diff --git a/dotnet/docs/auth.mdx b/dotnet/docs/auth.mdx
index f6aaf8ef8f5..2254dcd67c3 100644
--- a/dotnet/docs/auth.mdx
+++ b/dotnet/docs/auth.mdx
@@ -74,9 +74,9 @@ Redoing login for every test can slow down test execution. To mitigate that, reu
Playwright provides a way to reuse the signed-in state in the tests. That way you can log in only once and then skip the log in step for all of the tests.
-Web apps use cookie-based or token-based authentication, where authenticated state is stored as [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) or in [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage). Playwright provides [BrowserContext.StorageStateAsync()](/api/class-browsercontext.mdx#browser-context-storage-state) method that can be used to retrieve storage state from authenticated contexts and then create new contexts with prepopulated state.
+Web apps use cookie-based or token-based authentication, where authenticated state is stored as [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies), in [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage) or in [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API). Playwright provides [BrowserContext.StorageStateAsync()](/api/class-browsercontext.mdx#browser-context-storage-state) method that can be used to retrieve storage state from authenticated contexts and then create new contexts with prepopulated state.
-Cookies and local storage state can be used across different browsers. They depend on your application's authentication model: some apps might require both cookies and local storage.
+Cookies, local storage and IndexedDB state can be used across different browsers. They depend on your application's authentication model which may require some combination of cookies, local storage or IndexedDB.
The following code snippet retrieves state from an authenticated context and creates a new context with that state.
@@ -99,7 +99,7 @@ var context = await browser.NewContextAsync(new()
### Session storage
-Reusing authenticated state covers [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) and [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage) based authentication. Rarely, [session storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) is used for storing information associated with the signed-in state. Session storage is specific to a particular domain and is not persisted across page loads. Playwright does not provide API to persist session storage, but the following snippet can be used to save/load session storage.
+Reusing authenticated state covers [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies), [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage) and [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) based authentication. Rarely, [session storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) is used for storing information associated with the signed-in state. Session storage is specific to a particular domain and is not persisted across page loads. Playwright does not provide API to persist session storage, but the following snippet can be used to save/load session storage.
```csharp
// Get session storage and store as env variable
diff --git a/dotnet/docs/codegen.mdx b/dotnet/docs/codegen.mdx
index e8ca47b865b..6b7c9d33b0d 100644
--- a/dotnet/docs/codegen.mdx
+++ b/dotnet/docs/codegen.mdx
@@ -106,7 +106,7 @@ pwsh bin/Debug/netX/playwright.ps1 codegen --timezone="Europe/Rome" --geolocatio
### Preserve authenticated state
-Run `codegen` with `--save-storage` to save [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) and [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) at the end of the session. This is useful to separately record an authentication step and reuse it later when recording more tests.
+Run `codegen` with `--save-storage` to save [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies), [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) and [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) data at the end of the session. This is useful to separately record an authentication step and reuse it later when recording more tests.
```bash
pwsh bin/Debug/netX/playwright.ps1 codegen github.com/microsoft/playwright --save-storage=auth.json
@@ -125,7 +125,7 @@ Make sure you only use the `auth.json` locally as it contains sensitive informat
#### Load authenticated state
-Run with `--load-storage` to consume the previously loaded storage from the `auth.json`. This way, all [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) and [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) will be restored, bringing most web apps to the authenticated state without the need to login again. This means you can continue generating tests from the logged in state.
+Run with `--load-storage` to consume the previously loaded storage from the `auth.json`. This way, all [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies), [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) and [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) data will be restored, bringing most web apps to the authenticated state without the need to login again. This means you can continue generating tests from the logged in state.
```bash
pwsh bin/Debug/netX/playwright.ps1 codegen --load-storage=auth.json github.com/microsoft/playwright
diff --git a/java/docs/api/class-browsercontext.mdx b/java/docs/api/class-browsercontext.mdx
index bc3c100d5e5..ea262dfee55 100644
--- a/java/docs/api/class-browsercontext.mdx
+++ b/java/docs/api/class-browsercontext.mdx
@@ -805,7 +805,7 @@ BrowserContext.setOffline(offline);
Added before v1.9browserContext.storageState
-Returns storage state for this browser context, contains current cookies and local storage snapshot.
+Returns storage state for this browser context, contains current cookies, local storage snapshot and IndexedDB snapshot.
**Usage**
diff --git a/java/docs/auth.mdx b/java/docs/auth.mdx
index 6362fb079a8..0575a3dcf23 100644
--- a/java/docs/auth.mdx
+++ b/java/docs/auth.mdx
@@ -75,9 +75,9 @@ Redoing login for every test can slow down test execution. To mitigate that, reu
Playwright provides a way to reuse the signed-in state in the tests. That way you can log in only once and then skip the log in step for all of the tests.
-Web apps use cookie-based or token-based authentication, where authenticated state is stored as [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) or in [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage). Playwright provides [BrowserContext.storageState()](/api/class-browsercontext.mdx#browser-context-storage-state) method that can be used to retrieve storage state from authenticated contexts and then create new contexts with prepopulated state.
+Web apps use cookie-based or token-based authentication, where authenticated state is stored as [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies), in [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage) or in [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API). Playwright provides [BrowserContext.storageState()](/api/class-browsercontext.mdx#browser-context-storage-state) method that can be used to retrieve storage state from authenticated contexts and then create new contexts with prepopulated state.
-Cookies and local storage state can be used across different browsers. They depend on your application's authentication model: some apps might require both cookies and local storage.
+Cookies, local storage and IndexedDB state can be used across different browsers. They depend on your application's authentication model which may require some combination of cookies, local storage or IndexedDB.
The following code snippet retrieves state from an authenticated context and creates a new context with that state.
@@ -94,7 +94,7 @@ BrowserContext context = browser.newContext(
### Session storage
-Reusing authenticated state covers [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) and [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage) based authentication. Rarely, [session storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) is used for storing information associated with the signed-in state. Session storage is specific to a particular domain and is not persisted across page loads. Playwright does not provide API to persist session storage, but the following snippet can be used to save/load session storage.
+Reusing authenticated state covers [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies), [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage) and [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) based authentication. Rarely, [session storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) is used for storing information associated with the signed-in state. Session storage is specific to a particular domain and is not persisted across page loads. Playwright does not provide API to persist session storage, but the following snippet can be used to save/load session storage.
```java
// Get session storage and store as env variable
diff --git a/java/docs/codegen.mdx b/java/docs/codegen.mdx
index cb34ad1fd50..dc44d203f23 100644
--- a/java/docs/codegen.mdx
+++ b/java/docs/codegen.mdx
@@ -106,7 +106,7 @@ mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args='co
### Preserve authenticated state
-Run `codegen` with `--save-storage` to save [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) and [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) at the end of the session. This is useful to separately record an authentication step and reuse it later when recording more tests.
+Run `codegen` with `--save-storage` to save [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies), [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) and [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) data at the end of the session. This is useful to separately record an authentication step and reuse it later when recording more tests.
```bash
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="codegen github.com/microsoft/playwright --save-storage=auth.json"
@@ -125,7 +125,7 @@ Make sure you only use the `auth.json` locally as it contains sensitive informat
#### Load authenticated state
-Run with `--load-storage` to consume the previously loaded storage from the `auth.json`. This way, all [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) and [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) will be restored, bringing most web apps to the authenticated state without the need to login again. This means you can continue generating tests from the logged in state.
+Run with `--load-storage` to consume the previously loaded storage from the `auth.json`. This way, all [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies), [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) and [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) data will be restored, bringing most web apps to the authenticated state without the need to login again. This means you can continue generating tests from the logged in state.
```bash
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="codegen --load-storage=auth.json github.com/microsoft/playwright"
diff --git a/nodejs/docs/api/class-apirequest.mdx b/nodejs/docs/api/class-apirequest.mdx
index 232eb2bc69b..27899f31291 100644
--- a/nodejs/docs/api/class-apirequest.mdx
+++ b/nodejs/docs/api/class-apirequest.mdx
@@ -147,6 +147,61 @@ await apiRequest.newContext(options);
+ - `indexedDB` [Array]<[Object]> *(optional)*
+ - `name` [string]
+
+ database name
+ - `version` [number]
+
+ database version
+ - `stores` [Array]<[Object]>
+ - `name` [string]
+
+
+ - `keyPath` [string] *(optional)*
+
+
+ - `keyPathArray` [Array]<[string]> *(optional)*
+
+
+ - `autoIncrement` [boolean]
+
+
+ - `indexes` [Array]<[Object]>
+ - `name` [string]
+
+
+ - `keyPath` [string] *(optional)*
+
+
+ - `keyPathArray` [Array]<[string]> *(optional)*
+
+
+ - `unique` [boolean]
+
+
+ - `multiEntry` [boolean]
+
+
+
+ - `records` [Array]<[Object]>
+ - `key` [Object] *(optional)*
+
+
+ - `keyEncoded` [Object] *(optional)*
+
+ if `key` is not JSON-serializable, this contains an encoded version that preserves types.
+ - `value` [Object]
+
+
+ - `valueEncoded` [Object] *(optional)*
+
+ if `value` is not JSON-serializable, this contains an encoded version that preserves types.
+
+
+
+ indexedDB to set for context
+
Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via [browserContext.storageState()](/api/class-browsercontext.mdx#browser-context-storage-state) or [apiRequestContext.storageState()](/api/class-apirequestcontext.mdx#api-request-context-storage-state). Either a path to the file with saved storage, or the value returned by one of [browserContext.storageState()](/api/class-browsercontext.mdx#browser-context-storage-state) or [apiRequestContext.storageState()](/api/class-apirequestcontext.mdx#api-request-context-storage-state) methods.
- `timeout` [number] *(optional)*#
diff --git a/nodejs/docs/api/class-apirequestcontext.mdx b/nodejs/docs/api/class-apirequestcontext.mdx
index 38e3ce04416..5703f0a0959 100644
--- a/nodejs/docs/api/class-apirequestcontext.mdx
+++ b/nodejs/docs/api/class-apirequestcontext.mdx
@@ -619,6 +619,60 @@ await apiRequestContext.storageState(options);
+ - `indexedDB` [Array]<[Object]>
+ - `name` [string]
+
+
+ - `version` [number]
+
+
+ - `stores` [Array]<[Object]>
+ - `name` [string]
+
+
+ - `keyPath` [string] *(optional)*
+
+
+ - `keyPathArray` [Array]<[string]> *(optional)*
+
+
+ - `autoIncrement` [boolean]
+
+
+ - `indexes` [Array]<[Object]>
+ - `name` [string]
+
+
+ - `keyPath` [string] *(optional)*
+
+
+ - `keyPathArray` [Array]<[string]> *(optional)*
+
+
+ - `unique` [boolean]
+
+
+ - `multiEntry` [boolean]
+
+
+
+ - `records` [Array]<[Object]>
+ - `key` [Object] *(optional)*
+
+
+ - `keyEncoded` [Object] *(optional)*
+
+ if `key` is not JSON-serializable, this contains an encoded version that preserves types.
+ - `value` [Object]
+
+
+ - `valueEncoded` [Object] *(optional)*
+
+ if `value` is not JSON-serializable, this contains an encoded version that preserves types.
+
+
+
+
diff --git a/nodejs/docs/api/class-browser.mdx b/nodejs/docs/api/class-browser.mdx
index c5f5f031ce2..d48ce7778ab 100644
--- a/nodejs/docs/api/class-browser.mdx
+++ b/nodejs/docs/api/class-browser.mdx
@@ -382,9 +382,63 @@ If directly using this method to create [BrowserContext]s, it is best practice t
- `value` [string]
-
- localStorage to set for context
-
+ localStorage to set for context
+ - `indexedDB` [Array]<[Object]> *(optional)*
+ - `name` [string]
+
+ database name
+ - `version` [number]
+
+ database version
+ - `stores` [Array]<[Object]>
+ - `name` [string]
+
+
+ - `keyPath` [string] *(optional)*
+
+
+ - `keyPathArray` [Array]<[string]> *(optional)*
+
+
+ - `autoIncrement` [boolean]
+
+
+ - `indexes` [Array]<[Object]>
+ - `name` [string]
+
+
+ - `keyPath` [string] *(optional)*
+
+
+ - `keyPathArray` [Array]<[string]> *(optional)*
+
+
+ - `unique` [boolean]
+
+
+ - `multiEntry` [boolean]
+
+
+
+ - `records` [Array]<[Object]>
+ - `key` [Object] *(optional)*
+
+
+ - `keyEncoded` [Object] *(optional)*
+
+ if `key` is not JSON-serializable, this contains an encoded version that preserves types.
+ - `value` [Object]
+
+
+ - `valueEncoded` [Object] *(optional)*
+
+ if `value` is not JSON-serializable, this contains an encoded version that preserves types.
+
+
+
+ indexedDB to set for context
+
+
Learn more about [storage state and auth](../auth.mdx).
Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via [browserContext.storageState()](/api/class-browsercontext.mdx#browser-context-storage-state).
@@ -669,9 +723,63 @@ await browser.newPage(options);
- `value` [string]
-
- localStorage to set for context
-
+ localStorage to set for context
+ - `indexedDB` [Array]<[Object]> *(optional)*
+ - `name` [string]
+
+ database name
+ - `version` [number]
+
+ database version
+ - `stores` [Array]<[Object]>
+ - `name` [string]
+
+
+ - `keyPath` [string] *(optional)*
+
+
+ - `keyPathArray` [Array]<[string]> *(optional)*
+
+
+ - `autoIncrement` [boolean]
+
+
+ - `indexes` [Array]<[Object]>
+ - `name` [string]
+
+
+ - `keyPath` [string] *(optional)*
+
+
+ - `keyPathArray` [Array]<[string]> *(optional)*
+
+
+ - `unique` [boolean]
+
+
+ - `multiEntry` [boolean]
+
+
+
+ - `records` [Array]<[Object]>
+ - `key` [Object] *(optional)*
+
+
+ - `keyEncoded` [Object] *(optional)*
+
+ if `key` is not JSON-serializable, this contains an encoded version that preserves types.
+ - `value` [Object]
+
+
+ - `valueEncoded` [Object] *(optional)*
+
+ if `value` is not JSON-serializable, this contains an encoded version that preserves types.
+
+
+
+ indexedDB to set for context
+
+
Learn more about [storage state and auth](../auth.mdx).
Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via [browserContext.storageState()](/api/class-browsercontext.mdx#browser-context-storage-state).
diff --git a/nodejs/docs/api/class-browsercontext.mdx b/nodejs/docs/api/class-browsercontext.mdx
index 2bc6e6a3cdd..a66a8682e36 100644
--- a/nodejs/docs/api/class-browsercontext.mdx
+++ b/nodejs/docs/api/class-browsercontext.mdx
@@ -847,7 +847,7 @@ await browserContext.setOffline(offline);
Added before v1.9browserContext.storageState
-Returns storage state for this browser context, contains current cookies and local storage snapshot.
+Returns storage state for this browser context, contains current cookies, local storage snapshot and IndexedDB snapshot.
**Usage**
@@ -902,6 +902,60 @@ await browserContext.storageState(options);
+ - `indexedDB` [Array]<[Object]>
+ - `name` [string]
+
+
+ - `version` [number]
+
+
+ - `stores` [Array]<[Object]>
+ - `name` [string]
+
+
+ - `keyPath` [string] *(optional)*
+
+
+ - `keyPathArray` [Array]<[string]> *(optional)*
+
+
+ - `autoIncrement` [boolean]
+
+
+ - `indexes` [Array]<[Object]>
+ - `name` [string]
+
+
+ - `keyPath` [string] *(optional)*
+
+
+ - `keyPathArray` [Array]<[string]> *(optional)*
+
+
+ - `unique` [boolean]
+
+
+ - `multiEntry` [boolean]
+
+
+
+ - `records` [Array]<[Object]>
+ - `key` [Object] *(optional)*
+
+
+ - `keyEncoded` [Object] *(optional)*
+
+ if `key` is not JSON-serializable, this contains an encoded version that preserves types.
+ - `value` [Object]
+
+
+ - `valueEncoded` [Object] *(optional)*
+
+ if `value` is not JSON-serializable, this contains an encoded version that preserves types.
+
+
+
+
---
diff --git a/nodejs/docs/api/class-testoptions.mdx b/nodejs/docs/api/class-testoptions.mdx
index 397f980b2eb..6039e3fbcb6 100644
--- a/nodejs/docs/api/class-testoptions.mdx
+++ b/nodejs/docs/api/class-testoptions.mdx
@@ -871,9 +871,63 @@ export default defineConfig({
- `value` [string]
-
- localStorage to set for context
-
+ localStorage to set for context
+ - `indexedDB` [Array]<[Object]> *(optional)*
+ - `name` [string]
+
+ database name
+ - `version` [number]
+
+ database version
+ - `stores` [Array]<[Object]>
+ - `name` [string]
+
+
+ - `keyPath` [string] *(optional)*
+
+
+ - `keyPathArray` [Array]<[string]> *(optional)*
+
+
+ - `autoIncrement` [boolean]
+
+
+ - `indexes` [Array]<[Object]>
+ - `name` [string]
+
+
+ - `keyPath` [string] *(optional)*
+
+
+ - `keyPathArray` [Array]<[string]> *(optional)*
+
+
+ - `unique` [boolean]
+
+
+ - `multiEntry` [boolean]
+
+
+
+ - `records` [Array]<[Object]>
+ - `key` [Object] *(optional)*
+
+
+ - `keyEncoded` [Object] *(optional)*
+
+ if `key` is not JSON-serializable, this contains an encoded version that preserves types.
+ - `value` [Object]
+
+
+ - `valueEncoded` [Object] *(optional)*
+
+ if `value` is not JSON-serializable, this contains an encoded version that preserves types.
+
+
+
+ indexedDB to set for context
+
+
**Details**
When storage state is set up in the config, it is possible to reset storage state for a file:
diff --git a/nodejs/docs/api/class-testproject.mdx b/nodejs/docs/api/class-testproject.mdx
index 98d0ef3de07..009b1e59069 100644
--- a/nodejs/docs/api/class-testproject.mdx
+++ b/nodejs/docs/api/class-testproject.mdx
@@ -291,6 +291,11 @@ testProject.metadata
Project name is visible in the report and during test execution.
+:::warning
+
+Playwright executes the configuration file multiple times. Do not dynamically produce non-stable values in your configuration.
+:::
+
**Usage**
```js
diff --git a/nodejs/docs/api/class-teststepinfo.mdx b/nodejs/docs/api/class-teststepinfo.mdx
index 2541f2f8125..61ddebed4ae 100644
--- a/nodejs/docs/api/class-teststepinfo.mdx
+++ b/nodejs/docs/api/class-teststepinfo.mdx
@@ -26,6 +26,71 @@ test('basic test', async ({ page, browserName }, TestStepInfo) => {
## Methods
+### attach {#test-step-info-attach}
+
+Added in: v1.51testStepInfo.attach
+
+Attach a value or a file from disk to the current test step. Some reporters show test step attachments. Either [path](/api/class-teststepinfo.mdx#test-step-info-attach-option-path) or [body](/api/class-teststepinfo.mdx#test-step-info-attach-option-body) must be specified, but not both. Calling this method will attribute the attachment to the step, as opposed to [testInfo.attach()](/api/class-testinfo.mdx#test-info-attach) which stores all attachments at the test level.
+
+For example, you can attach a screenshot to the test step:
+
+```js
+import { test, expect } from '@playwright/test';
+
+test('basic test', async ({ page }) => {
+ await page.goto('https://playwright.dev');
+ await test.step('check page rendering', async step => {
+ const screenshot = await page.screenshot();
+ await step.attach('screenshot', { body: screenshot, contentType: 'image/png' });
+ });
+});
+```
+
+Or you can attach files returned by your APIs:
+
+```js
+import { test, expect } from '@playwright/test';
+import { download } from './my-custom-helpers';
+
+test('basic test', async ({}) => {
+ await test.step('check download behavior', async step => {
+ const tmpPath = await download('a');
+ await step.attach('downloaded', { path: tmpPath });
+ });
+});
+```
+
+:::note
+[testStepInfo.attach()](/api/class-teststepinfo.mdx#test-step-info-attach) automatically takes care of copying attached files to a location that is accessible to reporters. You can safely remove the attachment after awaiting the attach call.
+:::
+
+**Usage**
+
+```js
+await testStepInfo.attach(name);
+await testStepInfo.attach(name, options);
+```
+
+**Arguments**
+- `name` [string]#
+
+ Attachment name. The name will also be sanitized and used as the prefix of file name when saving to disk.
+- `options` [Object] *(optional)*
+ - `body` [string] | [Buffer] *(optional)*#
+
+ Attachment body. Mutually exclusive with [path](/api/class-teststepinfo.mdx#test-step-info-attach-option-path).
+ - `contentType` [string] *(optional)*#
+
+ Content type of this attachment to properly present in the report, for example `'application/json'` or `'image/png'`. If omitted, content type is inferred based on the [path](/api/class-teststepinfo.mdx#test-step-info-attach-option-path), or defaults to `text/plain` for [string] attachments and `application/octet-stream` for [Buffer] attachments.
+ - `path` [string] *(optional)*#
+
+ Path on the filesystem to the attached file. Mutually exclusive with [body](/api/class-teststepinfo.mdx#test-step-info-attach-option-body).
+
+**Returns**
+- [Promise]<[void]>#
+
+---
+
### skip() {#test-step-info-skip-1}
Added in: v1.51testStepInfo.skip()
diff --git a/nodejs/docs/auth.mdx b/nodejs/docs/auth.mdx
index 0ce719a9243..9a8cebcbe99 100644
--- a/nodejs/docs/auth.mdx
+++ b/nodejs/docs/auth.mdx
@@ -489,7 +489,7 @@ test('admin and user', async ({ adminPage, userPage }) => {
### Session storage
-Reusing authenticated state covers [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) and [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage) based authentication. Rarely, [session storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) is used for storing information associated with the signed-in state. Session storage is specific to a particular domain and is not persisted across page loads. Playwright does not provide API to persist session storage, but the following snippet can be used to save/load session storage.
+Reusing authenticated state covers [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies), [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage) and [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) based authentication. Rarely, [session storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) is used for storing information associated with the signed-in state. Session storage is specific to a particular domain and is not persisted across page loads. Playwright does not provide API to persist session storage, but the following snippet can be used to save/load session storage.
```js
// Get session storage and store as env variable
diff --git a/nodejs/docs/codegen.mdx b/nodejs/docs/codegen.mdx
index e2611babc90..a219dd44e1b 100644
--- a/nodejs/docs/codegen.mdx
+++ b/nodejs/docs/codegen.mdx
@@ -156,7 +156,7 @@ npx playwright codegen --timezone="Europe/Rome" --geolocation="41.890221,12.4923
### Preserve authenticated state
-Run `codegen` with `--save-storage` to save [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) and [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) at the end of the session. This is useful to separately record an authentication step and reuse it later when recording more tests.
+Run `codegen` with `--save-storage` to save [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies), [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) and [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) data at the end of the session. This is useful to separately record an authentication step and reuse it later when recording more tests.
```bash
npx playwright codegen github.com/microsoft/playwright --save-storage=auth.json
@@ -175,7 +175,7 @@ Make sure you only use the `auth.json` locally as it contains sensitive informat
#### Load authenticated state
-Run with `--load-storage` to consume the previously loaded storage from the `auth.json`. This way, all [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) and [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) will be restored, bringing most web apps to the authenticated state without the need to login again. This means you can continue generating tests from the logged in state.
+Run with `--load-storage` to consume the previously loaded storage from the `auth.json`. This way, all [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies), [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) and [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) data will be restored, bringing most web apps to the authenticated state without the need to login again. This means you can continue generating tests from the logged in state.
```bash
npx playwright codegen --load-storage=auth.json github.com/microsoft/playwright
diff --git a/python/docs/api/class-apirequest.mdx b/python/docs/api/class-apirequest.mdx
index 7f1d8ecffd9..05bf618aaf7 100644
--- a/python/docs/api/class-apirequest.mdx
+++ b/python/docs/api/class-apirequest.mdx
@@ -146,6 +146,61 @@ api_request.new_context(**kwargs)
+ - `indexedDB` [List]\[[Dict]\] *(optional)*
+ - `name` [str]
+
+ database name
+ - `version` [int]
+
+ database version
+ - `stores` [List]\[[Dict]\]
+ - `name` [str]
+
+
+ - `keyPath` [str] *(optional)*
+
+
+ - `keyPathArray` [List]\[[str]\] *(optional)*
+
+
+ - `autoIncrement` [bool]
+
+
+ - `indexes` [List]\[[Dict]\]
+ - `name` [str]
+
+
+ - `keyPath` [str] *(optional)*
+
+
+ - `keyPathArray` [List]\[[str]\] *(optional)*
+
+
+ - `unique` [bool]
+
+
+ - `multiEntry` [bool]
+
+
+
+ - `records` [List]\[[Dict]\]
+ - `key` [Dict] *(optional)*
+
+
+ - `keyEncoded` [Dict] *(optional)*
+
+ if `key` is not JSON-serializable, this contains an encoded version that preserves types.
+ - `value` [Dict]
+
+
+ - `valueEncoded` [Dict] *(optional)*
+
+ if `value` is not JSON-serializable, this contains an encoded version that preserves types.
+
+
+
+ indexedDB to set for context
+
Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via [browser_context.storage_state()](/api/class-browsercontext.mdx#browser-context-storage-state) or [api_request_context.storage_state()](/api/class-apirequestcontext.mdx#api-request-context-storage-state). Either a path to the file with saved storage, or the value returned by one of [browser_context.storage_state()](/api/class-browsercontext.mdx#browser-context-storage-state) or [api_request_context.storage_state()](/api/class-apirequestcontext.mdx#api-request-context-storage-state) methods.
- `timeout` [float] *(optional)*#
diff --git a/python/docs/api/class-apirequestcontext.mdx b/python/docs/api/class-apirequestcontext.mdx
index 984c69653be..5efdf37a8f3 100644
--- a/python/docs/api/class-apirequestcontext.mdx
+++ b/python/docs/api/class-apirequestcontext.mdx
@@ -709,6 +709,60 @@ api_request_context.storage_state(**kwargs)
+ - `indexedDB` [List]\[[Dict]\]
+ - `name` [str]
+
+
+ - `version` [int]
+
+
+ - `stores` [List]\[[Dict]\]
+ - `name` [str]
+
+
+ - `keyPath` [str] *(optional)*
+
+
+ - `keyPathArray` [List]\[[str]\] *(optional)*
+
+
+ - `autoIncrement` [bool]
+
+
+ - `indexes` [List]\[[Dict]\]
+ - `name` [str]
+
+
+ - `keyPath` [str] *(optional)*
+
+
+ - `keyPathArray` [List]\[[str]\] *(optional)*
+
+
+ - `unique` [bool]
+
+
+ - `multiEntry` [bool]
+
+
+
+ - `records` [List]\[[Dict]\]
+ - `key` [Dict] *(optional)*
+
+
+ - `keyEncoded` [Dict] *(optional)*
+
+ if `key` is not JSON-serializable, this contains an encoded version that preserves types.
+ - `value` [Dict]
+
+
+ - `valueEncoded` [Dict] *(optional)*
+
+ if `value` is not JSON-serializable, this contains an encoded version that preserves types.
+
+
+
+
diff --git a/python/docs/api/class-browser.mdx b/python/docs/api/class-browser.mdx
index 2640518ed9b..c70b1596a19 100644
--- a/python/docs/api/class-browser.mdx
+++ b/python/docs/api/class-browser.mdx
@@ -380,9 +380,63 @@ await browser.close()
- `value` [str]
-
- localStorage to set for context
-
+ localStorage to set for context
+ - `indexedDB` [List]\[[Dict]\] *(optional)*
+ - `name` [str]
+
+ database name
+ - `version` [int]
+
+ database version
+ - `stores` [List]\[[Dict]\]
+ - `name` [str]
+
+
+ - `keyPath` [str] *(optional)*
+
+
+ - `keyPathArray` [List]\[[str]\] *(optional)*
+
+
+ - `autoIncrement` [bool]
+
+
+ - `indexes` [List]\[[Dict]\]
+ - `name` [str]
+
+
+ - `keyPath` [str] *(optional)*
+
+
+ - `keyPathArray` [List]\[[str]\] *(optional)*
+
+
+ - `unique` [bool]
+
+
+ - `multiEntry` [bool]
+
+
+
+ - `records` [List]\[[Dict]\]
+ - `key` [Dict] *(optional)*
+
+
+ - `keyEncoded` [Dict] *(optional)*
+
+ if `key` is not JSON-serializable, this contains an encoded version that preserves types.
+ - `value` [Dict]
+
+
+ - `valueEncoded` [Dict] *(optional)*
+
+ if `value` is not JSON-serializable, this contains an encoded version that preserves types.
+
+
+
+ indexedDB to set for context
+
+
Learn more about [storage state and auth](../auth.mdx).
Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via [browser_context.storage_state()](/api/class-browsercontext.mdx#browser-context-storage-state).
@@ -635,9 +689,63 @@ browser.new_page(**kwargs)
- `value` [str]
-
- localStorage to set for context
-
+ localStorage to set for context
+ - `indexedDB` [List]\[[Dict]\] *(optional)*
+ - `name` [str]
+
+ database name
+ - `version` [int]
+
+ database version
+ - `stores` [List]\[[Dict]\]
+ - `name` [str]
+
+
+ - `keyPath` [str] *(optional)*
+
+
+ - `keyPathArray` [List]\[[str]\] *(optional)*
+
+
+ - `autoIncrement` [bool]
+
+
+ - `indexes` [List]\[[Dict]\]
+ - `name` [str]
+
+
+ - `keyPath` [str] *(optional)*
+
+
+ - `keyPathArray` [List]\[[str]\] *(optional)*
+
+
+ - `unique` [bool]
+
+
+ - `multiEntry` [bool]
+
+
+
+ - `records` [List]\[[Dict]\]
+ - `key` [Dict] *(optional)*
+
+
+ - `keyEncoded` [Dict] *(optional)*
+
+ if `key` is not JSON-serializable, this contains an encoded version that preserves types.
+ - `value` [Dict]
+
+
+ - `valueEncoded` [Dict] *(optional)*
+
+ if `value` is not JSON-serializable, this contains an encoded version that preserves types.
+
+
+
+ indexedDB to set for context
+
+
Learn more about [storage state and auth](../auth.mdx).
Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via [browser_context.storage_state()](/api/class-browsercontext.mdx#browser-context-storage-state).
diff --git a/python/docs/api/class-browsercontext.mdx b/python/docs/api/class-browsercontext.mdx
index 3c14d2ca78d..a1c25562163 100644
--- a/python/docs/api/class-browsercontext.mdx
+++ b/python/docs/api/class-browsercontext.mdx
@@ -1176,7 +1176,7 @@ browser_context.set_offline(offline)
Added before v1.9browserContext.storage_state
-Returns storage state for this browser context, contains current cookies and local storage snapshot.
+Returns storage state for this browser context, contains current cookies, local storage snapshot and IndexedDB snapshot.
**Usage**
@@ -1230,6 +1230,60 @@ browser_context.storage_state(**kwargs)
+ - `indexedDB` [List]\[[Dict]\]
+ - `name` [str]
+
+
+ - `version` [int]
+
+
+ - `stores` [List]\[[Dict]\]
+ - `name` [str]
+
+
+ - `keyPath` [str] *(optional)*
+
+
+ - `keyPathArray` [List]\[[str]\] *(optional)*
+
+
+ - `autoIncrement` [bool]
+
+
+ - `indexes` [List]\[[Dict]\]
+ - `name` [str]
+
+
+ - `keyPath` [str] *(optional)*
+
+
+ - `keyPathArray` [List]\[[str]\] *(optional)*
+
+
+ - `unique` [bool]
+
+
+ - `multiEntry` [bool]
+
+
+
+ - `records` [List]\[[Dict]\]
+ - `key` [Dict] *(optional)*
+
+
+ - `keyEncoded` [Dict] *(optional)*
+
+ if `key` is not JSON-serializable, this contains an encoded version that preserves types.
+ - `value` [Dict]
+
+
+ - `valueEncoded` [Dict] *(optional)*
+
+ if `value` is not JSON-serializable, this contains an encoded version that preserves types.
+
+
+
+
---
diff --git a/python/docs/auth.mdx b/python/docs/auth.mdx
index 95a32dd0af5..28a282019ae 100644
--- a/python/docs/auth.mdx
+++ b/python/docs/auth.mdx
@@ -102,9 +102,9 @@ Redoing login for every test can slow down test execution. To mitigate that, reu
Playwright provides a way to reuse the signed-in state in the tests. That way you can log in only once and then skip the log in step for all of the tests.
-Web apps use cookie-based or token-based authentication, where authenticated state is stored as [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) or in [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage). Playwright provides [browser_context.storage_state()](/api/class-browsercontext.mdx#browser-context-storage-state) method that can be used to retrieve storage state from authenticated contexts and then create new contexts with prepopulated state.
+Web apps use cookie-based or token-based authentication, where authenticated state is stored as [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies), in [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage) or in [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API). Playwright provides [browser_context.storage_state()](/api/class-browsercontext.mdx#browser-context-storage-state) method that can be used to retrieve storage state from authenticated contexts and then create new contexts with prepopulated state.
-Cookies and local storage state can be used across different browsers. They depend on your application's authentication model: some apps might require both cookies and local storage.
+Cookies, local storage and IndexedDB state can be used across different browsers. They depend on your application's authentication model which may require some combination of cookies, local storage or IndexedDB.
The following code snippet retrieves state from an authenticated context and creates a new context with that state.
@@ -144,7 +144,7 @@ context = await browser.new_context(storage_state="state.json")
### Session storage
-Reusing authenticated state covers [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) and [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage) based authentication. Rarely, [session storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) is used for storing information associated with the signed-in state. Session storage is specific to a particular domain and is not persisted across page loads. Playwright does not provide API to persist session storage, but the following snippet can be used to save/load session storage.
+Reusing authenticated state covers [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies), [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage) and [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) based authentication. Rarely, [session storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) is used for storing information associated with the signed-in state. Session storage is specific to a particular domain and is not persisted across page loads. Playwright does not provide API to persist session storage, but the following snippet can be used to save/load session storage.