Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
docs: js release notes for 1.51 (#34972)
Dmitry Gozman8d8c9a55cd90
diff --git a/docs/src/api/class-browsercontext.md b/docs/src/api/class-browsercontext.mdindex 91e43e22dd..90427f4375 100644--- a/docs/src/api/class-browsercontext.md+++ b/docs/src/api/class-browsercontext.md@@ -1527,7 +1527,7 @@ Returns storage state for this browser context, contains current cookies, local* since: v1.51- `indexedDB` ?<boolean>-Set to `true` to include IndexedDB in the storage state snapshot.+Set to `true` to include [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) in the storage state snapshot.If your application uses IndexedDB to store authentication tokens, like Firebase Authentication, enable this.:::notediff --git a/docs/src/release-notes-js.md b/docs/src/release-notes-js.mdindex 519c0955f7..ff2927daa2 100644--- a/docs/src/release-notes-js.md+++ b/docs/src/release-notes-js.md@@ -6,6 +6,87 @@ toc_max_heading_level: 2import LiteYouTube from '@site/src/components/LiteYouTube';+## Version 1.51++### Highlights++* New option [`option: BrowserContext.storageState.indexedDB`] for [`method: BrowserContext.storageState`] allows to save and restore IndexedDB contents. Useful when your application uses [IndexedDB API](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) to store authentication tokens, like Firebase Authentication.++ Here is an example following the [authentication guide](./auth.md#basic-shared-account-in-all-tests):++ ```js title="tests/auth.setup.ts"+ import { test as setup, expect } from '@playwright/test';+ import path from 'path';++ const authFile = path.join(__dirname, '../playwright/.auth/user.json');++ setup('authenticate', async ({ page }) => {+ await page.goto('/');+ // ... perform authentication steps ...++ // make sure to save indexedDB+ await page.context().storageState({ path: authFile, indexedDB: true });+ });+ ```++* New option [`option: Locator.filter.visible`] for [`method: Locator.filter`] allows matching only visible elements.++ ```js title="example.spec.ts"+ test('some test', async ({ page }) => {+ // Ignore invisible todo items.+ const todoItems = page.getByTestId('todo-item').filter({ visible: true });+ // Check there are exactly 3 visible ones.+ await expect(todoItems).toHaveCount(3);+ });+ ```++* Set `gitCommit: 'generate'` property in [`property: TestConfig.metadata`] to capture git information that will be shown in a test report.++ ```js title="playwright.config.ts"+ import { defineConfig } from '@playwright/test';++ export default defineConfig({+ metadata: { gitCommit: 'generate' },+ });+ ```++### Test runner++* A new [TestStepInfo] object is now available in test steps. You can add step attachments or skip the step under some conditions.++ ```js+ test('some test', async ({ page, isMobile }) => {+ // Note the new "step" argument:+ await test.step('here is my step', async step => {+ step.skip(isMobile, 'not relevant on mobile layouts');++ // ...+ await step.attach('my attachment', { body: 'some text' });+ // ...+ });+ });+ ```++* HTML reporter now shows the contents of [`property: TestConfig.metadata`].++### Miscellaneous++* New option `contrast` for methods [`method: Page.emulateMedia`] and [`method: Browser.newContext`] allows to emulate the `prefers-contrast` media feature.+* New option [`option: APIRequest.newContext.failOnStatusCode`] makes all fetch requests made through the [APIRequestContext] throw on response codes other than 2xx and 3xx.+* Assertion [`method: PageAssertions.toHaveURL`] now supports a predicate.++### Browser Versions++* Chromium 134.0.6998.35+* Mozilla Firefox 135.0+* WebKit 18.4++This version was also tested against the following stable channels:++* Google Chrome 133+* Microsoft Edge 133++## Version 1.50### Test runnerdiff --git a/packages/playwright-client/types/types.d.ts b/packages/playwright-client/types/types.d.tsindex abdc85e923..554a277897 100644--- a/packages/playwright-client/types/types.d.ts+++ b/packages/playwright-client/types/types.d.ts@@ -9271,8 +9271,9 @@ export interface BrowserContext {*/storageState(options?: {/**- * Set to `true` to include IndexedDB in the storage state snapshot. If your application uses IndexedDB to store- * authentication tokens, like Firebase Authentication, enable this.+ * Set to `true` to include [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) in the storage+ * state snapshot. If your application uses IndexedDB to store authentication tokens, like Firebase Authentication,+ * enable this.** **NOTE** IndexedDBs with typed arrays are currently not supported.*diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.tsindex abdc85e923..554a277897 100644--- a/packages/playwright-core/types/types.d.ts+++ b/packages/playwright-core/types/types.d.ts@@ -9271,8 +9271,9 @@ export interface BrowserContext {*/storageState(options?: {/**- * Set to `true` to include IndexedDB in the storage state snapshot. If your application uses IndexedDB to store- * authentication tokens, like Firebase Authentication, enable this.+ * Set to `true` to include [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) in the storage+ * state snapshot. If your application uses IndexedDB to store authentication tokens, like Firebase Authentication,+ * enable this.** **NOTE** IndexedDBs with typed arrays are currently not supported.*