Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: hide indexedDB from storageState() and BrowserContext option (#35058)

Max Schmitt6f99ad63dd1c
diff --git a/docs/src/api/class-apirequest.md b/docs/src/api/class-apirequest.md
index 686be4303c..c984b9f121 100644
--- a/docs/src/api/class-apirequest.md
+++ b/docs/src/api/class-apirequest.md
@@ -71,7 +71,6 @@ Methods like [`method: APIRequestContext.get`] take the base URL into considerat
- `localStorage` <[Array]<[Object]>>
- `name` <[string]>
- `value` <[string]>
- - `indexedDB` ?<[Array]<[unknown]>> 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 [`method: BrowserContext.storageState`] or [`method: APIRequestContext.storageState`]. Either a path to the
diff --git a/docs/src/api/class-apirequestcontext.md b/docs/src/api/class-apirequestcontext.md
index a9b7170e84..c96e01991c 100644
--- a/docs/src/api/class-apirequestcontext.md
+++ b/docs/src/api/class-apirequestcontext.md
@@ -880,7 +880,6 @@ context cookies from the response. The method will automatically follow redirect
- `localStorage` <[Array]<[Object]>>
- `name` <[string]>
- `value` <[string]>
- - `indexedDB` <[Array]<[unknown]>>
Returns storage state for this request context, contains current cookies and local storage snapshot if it was passed to the constructor.
diff --git a/docs/src/api/class-browsercontext.md b/docs/src/api/class-browsercontext.md
index ac21afcc08..ed9308bb50 100644
--- a/docs/src/api/class-browsercontext.md
+++ b/docs/src/api/class-browsercontext.md
@@ -1509,7 +1509,6 @@ Whether to emulate network being offline for the browser context.
- `localStorage` <[Array]<[Object]>>
- `name` <[string]>
- `value` <[string]>
- - `indexedDB` <[Array]<[unknown]>>
Returns storage state for this browser context, contains current cookies, local storage snapshot and IndexedDB snapshot.
diff --git a/docs/src/api/params.md b/docs/src/api/params.md
index 534b638ddd..fd548c9c41 100644
--- a/docs/src/api/params.md
+++ b/docs/src/api/params.md
@@ -264,7 +264,6 @@ Specify environment variables that will be visible to the browser. Defaults to `
- `localStorage` <[Array]<[Object]>> localStorage to set for context
- `name` <[string]>
- `value` <[string]>
- - `indexedDB` ?<[Array]<[unknown]>> indexedDB to set for context
Learn more about [storage state and auth](../auth.md).
diff --git a/packages/playwright-client/types/types.d.ts b/packages/playwright-client/types/types.d.ts
index 0dd5a1d68a..49a2ca9ce3 100644
--- a/packages/playwright-client/types/types.d.ts
+++ b/packages/playwright-client/types/types.d.ts
@@ -9317,8 +9317,6 @@ export interface BrowserContext {
value: string;
}>;
-
- indexedDB: Array<unknown>;
}>;
}>;
@@ -10085,11 +10083,6 @@ export interface Browser {
value: string;
}>;
-
- /**
- * indexedDB to set for context
- */
- indexedDB?: Array<unknown>;
}>;
};
@@ -17638,11 +17631,6 @@ export interface APIRequest {
value: string;
}>;
-
- /**
- * indexedDB to set for context
- */
- indexedDB?: Array<unknown>;
}>;
};
@@ -18457,8 +18445,6 @@ export interface APIRequestContext {
value: string;
}>;
-
- indexedDB: Array<unknown>;
}>;
}>;
@@ -22306,11 +22292,6 @@ export interface BrowserContextOptions {
value: string;
}>;
-
- /**
- * indexedDB to set for context
- */
- indexedDB?: Array<unknown>;
}>;
};
diff --git a/packages/playwright-core/src/client/types.ts b/packages/playwright-core/src/client/types.ts
index 53c805a496..5235fef8b4 100644
--- a/packages/playwright-core/src/client/types.ts
+++ b/packages/playwright-core/src/client/types.ts
@@ -37,7 +37,7 @@ export type SelectOptionOptions = { force?: boolean, timeout?: number };
export type FilePayload = { name: string, mimeType: string, buffer: Buffer };
export type StorageState = {
cookies: channels.NetworkCookie[],
- origins: (Omit<channels.OriginStorage, 'indexedDB'> & { indexedDB: unknown[] })[],
+ origins: (Omit<channels.OriginStorage, 'indexedDB'>)[],
};
export type SetStorageState = {
cookies?: channels.SetNetworkCookie[],
diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts
index 0dd5a1d68a..49a2ca9ce3 100644
--- a/packages/playwright-core/types/types.d.ts
+++ b/packages/playwright-core/types/types.d.ts
@@ -9317,8 +9317,6 @@ export interface BrowserContext {
value: string;
}>;
-
- indexedDB: Array<unknown>;
}>;
}>;
@@ -10085,11 +10083,6 @@ export interface Browser {
value: string;
}>;
-
- /**
- * indexedDB to set for context
- */
- indexedDB?: Array<unknown>;
}>;
};
@@ -17638,11 +17631,6 @@ export interface APIRequest {
value: string;
}>;
-
- /**
- * indexedDB to set for context
- */
- indexedDB?: Array<unknown>;
}>;
};
@@ -18457,8 +18445,6 @@ export interface APIRequestContext {
value: string;
}>;
-
- indexedDB: Array<unknown>;
}>;
}>;
@@ -22306,11 +22292,6 @@ export interface BrowserContextOptions {
value: string;
}>;
-
- /**
- * indexedDB to set for context
- */
- indexedDB?: Array<unknown>;
}>;
};
diff --git a/tests/library/global-fetch-cookie.spec.ts b/tests/library/global-fetch-cookie.spec.ts
index e34cf1561b..967a3676dc 100644
--- a/tests/library/global-fetch-cookie.spec.ts
+++ b/tests/library/global-fetch-cookie.spec.ts
@@ -352,25 +352,27 @@ it('should preserve local storage on import/export of storage state', async ({ p
name: 'name1',
value: 'value1'
}],
- indexedDB: [
- {
- name: 'db',
- version: 5,
- stores: [
- {
- name: 'store',
- keyPath: 'id',
- autoIncrement: false,
- indexes: [],
- records: [
- {
- value: { id: 'foo', name: 'John Doe' }
- }
- ],
- }
- ]
- }
- ],
+ ...{
+ indexedDB: [
+ {
+ name: 'db',
+ version: 5,
+ stores: [
+ {
+ name: 'store',
+ keyPath: 'id',
+ autoIncrement: false,
+ indexes: [],
+ records: [
+ {
+ value: { id: 'foo', name: 'John Doe' }
+ }
+ ],
+ }
+ ]
+ }
+ ]
+ },
},
]
};