Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions dotnet/docs/release-notes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,49 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import HTMLCard from '@site/src/components/HTMLCard';

## Version 1.51

### Highlights
* New option [IndexedDB](/api/class-browsercontext.mdx#browser-context-storage-state-option-indexed-db) for [BrowserContext.StorageStateAsync()](/api/class-browsercontext.mdx#browser-context-storage-state) 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.mdx#reusing-signed-in-state):

```csharp
// Save storage state into the file. Make sure to include IndexedDB.
await context.StorageStateAsync(new()
{
Path = "../../../playwright/.auth/state.json",
IndexedDB = true
});

// Create a new context with the saved storage state.
var context = await browser.NewContextAsync(new()
{
StorageStatePath = "../../../playwright/.auth/state.json"
});
```

* New option [Visible](/api/class-locator.mdx#locator-filter-option-visible) for [Locator.Filter()](/api/class-locator.mdx#locator-filter) allows matching only visible elements.

```csharp
// Ignore invisible todo items.
var todoItems = Page.GetByTestId("todo-item").Filter(new() { Visible = true });
// Check there are exactly 3 visible ones.
await Expect(todoItems).ToHaveCountAsync(3);
```

* New option `Contrast` for methods [Page.EmulateMediaAsync()](/api/class-page.mdx#page-emulate-media) and [Browser.NewContextAsync()](/api/class-browser.mdx#browser-new-context) allows to emulate the `prefers-contrast` media feature.
* New option [FailOnStatusCode](/api/class-apirequest.mdx#api-request-new-context-option-fail-on-status-code) makes all fetch requests made through the [APIRequestContext] throw on response codes other than 2xx and 3xx.

### 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

### Support for Xunit
Expand Down
40 changes: 40 additions & 0 deletions java/docs/release-notes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,46 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import HTMLCard from '@site/src/components/HTMLCard';

## Version 1.51

### Highlights
* New option [setIndexedDB](/api/class-browsercontext.mdx#browser-context-storage-state-option-indexed-db) for [BrowserContext.storageState()](/api/class-browsercontext.mdx#browser-context-storage-state) 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.mdx#reusing-signed-in-state):

```java
// Save storage state into the file. Make sure to include IndexedDB.
context.storageState(new BrowserContext.StorageStateOptions()
.setPath(Paths.get("state.json"))
.setIndexedDB(true));

// Create a new context with the saved storage state.
BrowserContext context = browser.newContext(new Browser.NewContextOptions()
.setStorageStatePath(Paths.get("state.json")));
```

* New option [setVisible](/api/class-locator.mdx#locator-filter-option-visible) for [Locator.filter()](/api/class-locator.mdx#locator-filter) allows matching only visible elements.

```java
// Ignore invisible todo items.
Locator todoItems = page.getByTestId("todo-item")
.filter(new Locator.FilterOptions().setVisible(true));
// Check there are exactly 3 visible ones.
assertThat(todoItems).hasCount(3);
```

* New option `setContrast` for methods [Page.emulateMedia()](/api/class-page.mdx#page-emulate-media) and [Browser.newContext()](/api/class-browser.mdx#browser-new-context) allows to emulate the `prefers-contrast` media feature.
* New option [setFailOnStatusCode](/api/class-apirequest.mdx#api-request-new-context-option-fail-on-status-code) makes all fetch requests made through the [APIRequestContext] throw on response codes other than 2xx and 3xx.

### 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

### Miscellaneous
Expand Down
4 changes: 0 additions & 4 deletions nodejs/docs/api/class-apirequest.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,6 @@ await apiRequest.newContext(options);



- `indexedDB` [Array]<[unknown]> *(optional)*

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)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="api-request-new-context-option-timeout"/><a href="#api-request-new-context-option-timeout" class="list-anchor">#</a>
Expand Down
3 changes: 0 additions & 3 deletions nodejs/docs/api/class-apirequestcontext.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -622,9 +622,6 @@ await apiRequestContext.storageState(options);



- `indexedDB` [Array]&lt;[unknown]&gt;





Expand Down
6 changes: 0 additions & 6 deletions nodejs/docs/api/class-browser.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,6 @@ If directly using this method to create [BrowserContext]s, it is best practice t


localStorage to set for context
- `indexedDB` [Array]&lt;[unknown]&gt; *(optional)*

indexedDB to set for context


Learn more about [storage state and auth](../auth.mdx).
Expand Down Expand Up @@ -673,9 +670,6 @@ await browser.newPage(options);


localStorage to set for context
- `indexedDB` [Array]&lt;[unknown]&gt; *(optional)*

indexedDB to set for context


Learn more about [storage state and auth](../auth.mdx).
Expand Down
3 changes: 0 additions & 3 deletions nodejs/docs/api/class-browsercontext.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -911,9 +911,6 @@ await browserContext.storageState(options);



- `indexedDB` [Array]&lt;[unknown]&gt;



---

Expand Down
20 changes: 16 additions & 4 deletions nodejs/docs/api/class-testconfig.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ export default defineConfig({
### captureGitInfo {#test-config-capture-git-info}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.51</font><x-search>testConfig.captureGitInfo</x-search>
* These settings control whether git information is captured and stored in the config [testConfig.metadata](/api/class-testconfig.mdx#test-config-metadata).
* The structure of the git commit metadata is subject to change.
* Default values for these settings depend on the environment. When tests run as a part of CI where it is safe to obtain git information, the default value is true, false otherwise.

These settings control whether git information is captured and stored in the config [testConfig.metadata](/api/class-testconfig.mdx#test-config-metadata).

**Usage**

Expand All @@ -74,11 +73,24 @@ export default defineConfig({
- [Object]
- `commit` [boolean] *(optional)*

Whether to capture commit information such as hash, author, timestamp.
Whether to capture commit and pull request information such as hash, author, timestamp.
- `diff` [boolean] *(optional)*

Whether to capture commit diff.

**Details**
* Capturing `commit` information is useful when you'd like to see it in your HTML (or a third party) report.
* Capturing `diff` information is useful to enrich the report with the actual source diff. This information can be used to provide intelligent advice on how to fix the test.

:::note

Default values for these settings depend on the environment. When tests run as a part of CI where it is safe to obtain git information, the default value is `true`, `false` otherwise.
:::

:::note
The structure of the git commit metadata is subject to change.
:::

---

### expect {#test-config-expect}
Expand Down
3 changes: 0 additions & 3 deletions nodejs/docs/api/class-testoptions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -872,9 +872,6 @@ export default defineConfig({


localStorage to set for context
- `indexedDB` [Array]&lt;[unknown]&gt; *(optional)*

indexedDB to set for context


**Details**
Expand Down
12 changes: 5 additions & 7 deletions nodejs/docs/api/class-teststepinfo.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ import { test, expect } from '@playwright/test';

test('basic test', async ({ page, browserName }) => {
await test.step('check some behavior', async step => {
await step.skip(browserName === 'webkit', 'The feature is not available in WebKit');
step.skip(browserName === 'webkit', 'The feature is not available in WebKit');
// ... rest of the step code
await page.check('input');
});
});
```
Expand Down Expand Up @@ -103,8 +102,8 @@ Abort the currently running step and mark it as skipped. Useful for steps that a
import { test, expect } from '@playwright/test';

test('my test', async ({ page }) => {
await test.step('check expectations', async () => {
test.skip();
await test.step('check expectations', async step => {
step.skip();
// step body below will not run
// ...
});
Expand All @@ -125,9 +124,8 @@ Conditionally abort the currently running step and mark it as skipped with an op
import { test, expect } from '@playwright/test';

test('my test', async ({ page, isMobile }) => {
await test.step('check desktop expectations', async () => {
test.skip(isMobile, 'not present in the mobile layout');

await test.step('check desktop expectations', async step => {
step.skip(isMobile, 'not present in the mobile layout');
// step body below will not run
// ...
});
Expand Down
91 changes: 51 additions & 40 deletions nodejs/docs/release-notes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import LiteYouTube from '@site/src/components/LiteYouTube';

## Version 1.51

### Highlights
### StorageState for indexedDB
* New option [indexedDB](/api/class-browsercontext.mdx#browser-context-storage-state-option-indexed-db) for [browserContext.storageState()](/api/class-browsercontext.mdx#browser-context-storage-state) 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.mdx#basic-shared-account-in-all-tests):
Expand All @@ -31,47 +31,58 @@ import LiteYouTube from '@site/src/components/LiteYouTube';
});
```

* New option [visible](/api/class-locator.mdx#locator-filter-option-visible) for [locator.filter()](/api/class-locator.mdx#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 option [testConfig.captureGitInfo](/api/class-testconfig.mdx#test-config-capture-git-info) to capture git information into [testConfig.metadata](/api/class-testconfig.mdx#test-config-metadata).

```js title="playwright.config.ts"
import { defineConfig } from '@playwright/test';

export default defineConfig({
captureGitInfo: { commit: true, diff: true }
});
```

HTML report will show this information when available:

![Git information in the report](https://github.com/user-attachments/assets/9ca4a05a-1485-4521-826b-50568babec3f)
### Copy as prompt

### 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' });
// ...
});
New "Copy prompt" button on errors in the HTML report, trace viewer and UI mode. Click to copy a pre-filled LLM prompt that contains the error message and useful context for fixing the error.

![Copy prompt](https://github.com/user-attachments/assets/f3654407-dd6d-4240-9845-0d96df2bf30a)

### Filter visible elements

New option [visible](/api/class-locator.mdx#locator-filter-option-visible) for [locator.filter()](/api/class-locator.mdx#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);
});
```

### Git information in HTML report

Set option [testConfig.captureGitInfo](/api/class-testconfig.mdx#test-config-capture-git-info) to capture git information into [testConfig.metadata](/api/class-testconfig.mdx#test-config-metadata).

```js title="playwright.config.ts"
import { defineConfig } from '@playwright/test';

export default defineConfig({
captureGitInfo: { commit: true, diff: true }
});
```

HTML report will show this information when available:

![Git information in the report](https://github.com/user-attachments/assets/f5b3f6f4-aa08-4a24-816c-7edf33ef0c37)

### Test Step improvements

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' });
// ...
});
```

});
```

### Miscellaneous
* New option `contrast` for methods [page.emulateMedia()](/api/class-page.mdx#page-emulate-media) and [browser.newContext()](/api/class-browser.mdx#browser-new-context) allows to emulate the `prefers-contrast` media feature.
* New option [failOnStatusCode](/api/class-apirequest.mdx#api-request-new-context-option-fail-on-status-code) makes all fetch requests made through the [APIRequestContext] throw on response codes other than 2xx and 3xx.
Expand Down
4 changes: 0 additions & 4 deletions python/docs/api/class-apirequest.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,6 @@ api_request.new_context(**kwargs)



- `indexedDB` [List]\[[Any]\] *(optional)*

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)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="api-request-new-context-option-timeout"/><a href="#api-request-new-context-option-timeout" class="list-anchor">#</a>
Expand Down
3 changes: 0 additions & 3 deletions python/docs/api/class-apirequestcontext.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -712,9 +712,6 @@ api_request_context.storage_state(**kwargs)



- `indexedDB` [List]\[[Any]\]





Expand Down
6 changes: 0 additions & 6 deletions python/docs/api/class-browser.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,6 @@ await browser.close()


localStorage to set for context
- `indexedDB` [List]\[[Any]\] *(optional)*

indexedDB to set for context


Learn more about [storage state and auth](../auth.mdx).
Expand Down Expand Up @@ -639,9 +636,6 @@ browser.new_page(**kwargs)


localStorage to set for context
- `indexedDB` [List]\[[Any]\] *(optional)*

indexedDB to set for context


Learn more about [storage state and auth](../auth.mdx).
Expand Down
3 changes: 0 additions & 3 deletions python/docs/api/class-browsercontext.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1239,9 +1239,6 @@ browser_context.storage_state(**kwargs)



- `indexedDB` [List]\[[Any]\]



---

Expand Down
Loading
Loading