Skip to content

Commit 5863429

Browse files
feat(roll): roll to ToT Playwright (16-03-26) (#1987)
1 parent 94fec82 commit 5863429

173 files changed

Lines changed: 1560 additions & 995 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

dotnet/docs/actionability.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Playwright includes auto-retrying assertions that remove flakiness by waiting un
6666
| [Expect(Locator).ToHaveAttributeAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-attribute) | Element has a DOM attribute |
6767
| [Expect(Locator).ToHaveClassAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-class) | Element has a class property |
6868
| [Expect(Locator).ToHaveCountAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-count) | List has exact number of children |
69-
| [Expect(Locator).ToHaveCSSAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-css-1) | Element has CSS property |
69+
| [Expect(Locator).ToHaveCSSAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-css) | Element has CSS property |
7070
| [Expect(Locator).ToHaveIdAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-id) | Element has an ID |
7171
| [Expect(Locator).ToHaveJSPropertyAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-js-property) | Element has a JavaScript property |
7272
| [Expect(Locator).ToHaveTextAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-text) | Element matches text |

dotnet/docs/api/class-browsercontext.mdx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ The order of evaluation of multiple scripts installed via [BrowserContext.AddIni
113113
Script to be evaluated in all pages in the browser context.
114114

115115
**Returns**
116-
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-context-add-init-script-return"/><a href="#browser-context-add-init-script-return" class="list-anchor">#</a>
116+
- [Disposable]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-context-add-init-script-return"/><a href="#browser-context-add-init-script-return" class="list-anchor">#</a>
117117

118118
---
119119

@@ -316,7 +316,7 @@ await page.GetByRole(AriaRole.Button).ClickAsync();
316316
Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is supported. When passing by value, multiple arguments are supported.
317317

318318
**Returns**
319-
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-context-expose-binding-return"/><a href="#browser-context-expose-binding-return" class="list-anchor">#</a>
319+
- [Disposable]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-context-expose-binding-return"/><a href="#browser-context-expose-binding-return" class="list-anchor">#</a>
320320

321321
---
322322

@@ -378,7 +378,7 @@ class BrowserContextExamples
378378
Callback function that will be called in the Playwright's context.
379379

380380
**Returns**
381-
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-context-expose-function-return"/><a href="#browser-context-expose-function-return" class="list-anchor">#</a>
381+
- [Disposable]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-context-expose-function-return"/><a href="#browser-context-expose-function-return" class="list-anchor">#</a>
382382

383383
---
384384

@@ -433,6 +433,23 @@ await BrowserContext.GrantPermissionsAsync(permissions, options);
433433

434434
---
435435

436+
### IsClosedOrClosing {#browser-context-is-closed-or-closing}
437+
438+
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.59</font><x-search>browserContext.IsClosedOrClosing</x-search>
439+
440+
Indicates that the browser context is in the process of closing or has already been closed.
441+
442+
**Usage**
443+
444+
```csharp
445+
BrowserContext.IsClosedOrClosing
446+
```
447+
448+
**Returns**
449+
- [bool]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-context-is-closed-or-closing-return"/><a href="#browser-context-is-closed-or-closing-return" class="list-anchor">#</a>
450+
451+
---
452+
436453
### NewCDPSessionAsync {#browser-context-new-cdp-session}
437454

438455
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.11</font><x-search>browserContext.NewCDPSessionAsync</x-search>
@@ -561,7 +578,7 @@ Enabling routing disables http cache.
561578
How often a route should be used. By default it will be used every time.
562579

563580
**Returns**
564-
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-context-route-return"/><a href="#browser-context-route-return" class="list-anchor">#</a>
581+
- [Disposable]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-context-route-return"/><a href="#browser-context-route-return" class="list-anchor">#</a>
565582

566583
---
567584

dotnet/docs/api/class-browsertype.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ The major and minor version of the Playwright instance that connects needs to ma
4747
**Usage**
4848

4949
```csharp
50-
await BrowserType.ConnectAsync(wsEndpoint, options);
50+
await BrowserType.ConnectAsync(endpoint, options);
5151
```
5252

5353
**Arguments**
54-
- `wsEndpoint` [string] <font size="2">Added in: v1.10</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-type-connect-option-ws-endpoint"/><a href="#browser-type-connect-option-ws-endpoint" class="list-anchor">#</a>
54+
- `endpoint` [string] <font size="2">Added in: v1.10</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-type-connect-option-endpoint"/><a href="#browser-type-connect-option-endpoint" class="list-anchor">#</a>
5555

5656
A Playwright browser websocket endpoint to connect to. You obtain this endpoint via `BrowserServer.wsEndpoint`.
5757
- `options` `BrowserTypeConnectOptions?` *(optional)*

dotnet/docs/api/class-locator.mdx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,6 +2226,32 @@ This method expects [Locator] to point to an [input element](https://developer.m
22262226

22272227
---
22282228

2229+
### SnapshotForAIAsync {#locator-snapshot-for-ai}
2230+
2231+
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.59</font><x-search>locator.SnapshotForAIAsync</x-search>
2232+
2233+
Returns an accessibility snapshot of the element's subtree optimized for AI consumption.
2234+
2235+
**Usage**
2236+
2237+
```csharp
2238+
await Locator.SnapshotForAIAsync(options);
2239+
```
2240+
2241+
**Arguments**
2242+
- `options` `LocatorSnapshotForAIOptions?` *(optional)*
2243+
- `Timeout` [float]? *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-snapshot-for-ai-option-timeout"/><a href="#locator-snapshot-for-ai-option-timeout" class="list-anchor">#</a>
2244+
2245+
Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [BrowserContext.SetDefaultTimeout()](/api/class-browsercontext.mdx#browser-context-set-default-timeout) or [Page.SetDefaultTimeout()](/api/class-page.mdx#page-set-default-timeout) methods.
2246+
2247+
**Returns**
2248+
- SnapshotForAI<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-snapshot-for-ai-return"/><a href="#locator-snapshot-for-ai-return" class="list-anchor">#</a>
2249+
- `full` [string]
2250+
2251+
Accessibility snapshot of the element matching this locator.
2252+
2253+
---
2254+
22292255
### TapAsync {#locator-tap}
22302256

22312257
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.14</font><x-search>locator.TapAsync</x-search>
@@ -2318,6 +2344,23 @@ await Locator.TextContentAsync(options);
23182344

23192345
---
23202346

2347+
### ToCodeAsync {#locator-to-code}
2348+
2349+
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.59</font><x-search>locator.ToCodeAsync</x-search>
2350+
2351+
Returns a code string for a locator that uses best practices for referencing the matched element, prioritizing test ids, aria roles, and other user-facing attributes over CSS selectors.
2352+
2353+
**Usage**
2354+
2355+
```csharp
2356+
await Locator.ToCodeAsync();
2357+
```
2358+
2359+
**Returns**
2360+
- [string]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-to-code-return"/><a href="#locator-to-code-return" class="list-anchor">#</a>
2361+
2362+
---
2363+
23212364
### UncheckAsync {#locator-uncheck}
23222365

23232366
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.14</font><x-search>locator.UncheckAsync</x-search>

dotnet/docs/api/class-locatorassertions.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ await Expect(locator).ToHaveCountAsync(3);
609609

610610
---
611611

612-
### ToHaveCSSAsync {#locator-assertions-to-have-css-1}
612+
### ToHaveCSSAsync {#locator-assertions-to-have-css}
613613

614614
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.20</font><x-search>locatorAssertions.ToHaveCSSAsync</x-search>
615615

@@ -623,19 +623,19 @@ await Expect(locator).ToHaveCSSAsync("display", "flex");
623623
```
624624

625625
**Arguments**
626-
- `name` [string] <font size="2">Added in: v1.18</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-have-css-1-option-name"/><a href="#locator-assertions-to-have-css-1-option-name" class="list-anchor">#</a>
626+
- `name` [string] <font size="2">Added in: v1.18</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-have-css-option-name"/><a href="#locator-assertions-to-have-css-option-name" class="list-anchor">#</a>
627627

628628
CSS property name.
629-
- `value` [string] | [Regex] <font size="2">Added in: v1.18</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-have-css-1-option-value"/><a href="#locator-assertions-to-have-css-1-option-value" class="list-anchor">#</a>
629+
- `value` [string] | [Regex] <font size="2">Added in: v1.18</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-have-css-option-value"/><a href="#locator-assertions-to-have-css-option-value" class="list-anchor">#</a>
630630

631631
CSS property value.
632632
- `options` `LocatorAssertionsToHaveCSSOptions?` *(optional)*
633-
- `Timeout` [float]? *(optional)* <font size="2">Added in: v1.18</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-have-css-1-option-timeout"/><a href="#locator-assertions-to-have-css-1-option-timeout" class="list-anchor">#</a>
633+
- `Timeout` [float]? *(optional)* <font size="2">Added in: v1.18</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-have-css-option-timeout"/><a href="#locator-assertions-to-have-css-option-timeout" class="list-anchor">#</a>
634634

635635
Time to retry the assertion for in milliseconds. Defaults to `5000`.
636636

637637
**Returns**
638-
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-have-css-1-return"/><a href="#locator-assertions-to-have-css-1-return" class="list-anchor">#</a>
638+
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-have-css-return"/><a href="#locator-assertions-to-have-css-return" class="list-anchor">#</a>
639639

640640
---
641641

dotnet/docs/api/class-page.mdx

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ The order of evaluation of multiple scripts installed via [BrowserContext.AddIni
8686
Script to be evaluated in all pages in the browser context.
8787

8888
**Returns**
89-
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-add-init-script-return"/><a href="#page-add-init-script-return" class="list-anchor">#</a>
89+
- [Disposable]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-add-init-script-return"/><a href="#page-add-init-script-return" class="list-anchor">#</a>
9090

9191
---
9292

@@ -337,9 +337,15 @@ Returns up to (currently) 200 last console messages from this page. See [Page.Co
337337
**Usage**
338338

339339
```csharp
340-
await Page.ConsoleMessagesAsync();
340+
await Page.ConsoleMessagesAsync(options);
341341
```
342342

343+
**Arguments**
344+
- `options` `PageConsoleMessagesOptions?` *(optional)*
345+
- `Filter` `enum ConsoleMessagesFilter { All, SinceNavigation }?` *(optional)* <font size="2">Added in: v1.59</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-console-messages-option-filter"/><a href="#page-console-messages-option-filter" class="list-anchor">#</a>
346+
347+
Controls which messages are returned:
348+
343349
**Returns**
344350
- [IReadOnlyList]&lt;[ConsoleMessage]&gt;<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-console-messages-return"/><a href="#page-console-messages-return" class="list-anchor">#</a>
345351

@@ -661,7 +667,7 @@ class PageExamples
661667
Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is supported. When passing by value, multiple arguments are supported.
662668

663669
**Returns**
664-
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-expose-binding-return"/><a href="#page-expose-binding-return" class="list-anchor">#</a>
670+
- [Disposable]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-expose-binding-return"/><a href="#page-expose-binding-return" class="list-anchor">#</a>
665671

666672
---
667673

@@ -730,7 +736,7 @@ class PageExamples
730736
Callback function which will be called in Playwright's context.
731737

732738
**Returns**
733-
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-expose-function-return"/><a href="#page-expose-function-return" class="list-anchor">#</a>
739+
- [Disposable]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-expose-function-return"/><a href="#page-expose-function-return" class="list-anchor">#</a>
734740

735741
---
736742

@@ -1703,7 +1709,7 @@ Enabling routing disables http cache.
17031709
How often a route should be used. By default it will be used every time.
17041710

17051711
**Returns**
1706-
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-route-return"/><a href="#page-route-return" class="list-anchor">#</a>
1712+
- [Disposable]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-route-return"/><a href="#page-route-return" class="list-anchor">#</a>
17071713

17081714
---
17091715

@@ -2539,6 +2545,38 @@ await page.GotoAsync("https://www.microsoft.com");
25392545

25402546
---
25412547

2548+
### SnapshotForAIAsync {#page-snapshot-for-ai}
2549+
2550+
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.59</font><x-search>page.SnapshotForAIAsync</x-search>
2551+
2552+
Returns an accessibility snapshot of the page optimized for AI consumption.
2553+
2554+
**Usage**
2555+
2556+
```csharp
2557+
await Page.SnapshotForAIAsync(options);
2558+
```
2559+
2560+
**Arguments**
2561+
- `options` `PageSnapshotForAIOptions?` *(optional)*
2562+
- `Timeout` [float]? *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-snapshot-for-ai-option-timeout"/><a href="#page-snapshot-for-ai-option-timeout" class="list-anchor">#</a>
2563+
2564+
Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [BrowserContext.SetDefaultTimeout()](/api/class-browsercontext.mdx#browser-context-set-default-timeout) or [Page.SetDefaultTimeout()](/api/class-page.mdx#page-set-default-timeout) methods.
2565+
- `Track` [string]? *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-snapshot-for-ai-option-track"/><a href="#page-snapshot-for-ai-option-track" class="list-anchor">#</a>
2566+
2567+
When specified, enables incremental snapshots. Subsequent calls with the same track name will return an incremental snapshot containing only changes since the last call.
2568+
2569+
**Returns**
2570+
- SnapshotForAI<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-snapshot-for-ai-return"/><a href="#page-snapshot-for-ai-return" class="list-anchor">#</a>
2571+
- `full` [string]
2572+
2573+
Full accessibility snapshot of the page.
2574+
- `incremental` [string]? *(optional)*
2575+
2576+
Incremental snapshot containing only changes since the last tracked snapshot, when using the [Track](/api/class-page.mdx#page-snapshot-for-ai-option-track) option.
2577+
2578+
---
2579+
25422580
### TitleAsync {#page-title}
25432581

25442582
<font size="2" style={{position: "relative", top: "-20px"}}>Added before v1.9</font><x-search>page.TitleAsync</x-search>

dotnet/docs/api/class-tracing.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ await context.Tracing.StopAsync(new()
135135

136136
**Arguments**
137137
- `options` `TracingStartOptions?` *(optional)*
138+
- `Live` [bool]? *(optional)* <font size="2">Added in: v1.59</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="tracing-start-option-live"/><a href="#tracing-start-option-live" class="list-anchor">#</a>
139+
140+
When enabled, the trace is written to an unarchived file that is updated in real time as actions occur, instead of caching changes and archiving them into a zip file at the end. This is useful for live trace viewing during test execution.
138141
- `Name` [string]? *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="tracing-start-option-name"/><a href="#tracing-start-option-name" class="list-anchor">#</a>
139142

140143
If specified, intermediate trace files are going to be saved into the files with the given name prefix inside the [TracesDir](/api/class-browsertype.mdx#browser-type-launch-option-traces-dir) directory specified in [BrowserType.LaunchAsync()](/api/class-browsertype.mdx#browser-type-launch). To specify the final trace zip file name, you need to pass `path` option to [Tracing.StopAsync()](/api/class-tracing.mdx#tracing-stop) instead.

dotnet/docs/aria-snapshots.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,12 @@ Following snapshot will fail due to Feature C not being in the template:
197197
- listitem: Feature B
198198
```
199199

200+
#### Setting `children` mode globally
201+
202+
Instead of adding a `/children` property to every snapshot, you can set the default children matching mode for all `toMatchAriaSnapshot` calls in the configuration file:
203+
204+
Individual snapshots can still override the global setting by including an explicit `/children` property in the template.
205+
200206
### Matching with regular expressions
201207

202208
Regular expressions allow flexible matching for elements with dynamic or variable text. Accessible names and text can support regex patterns.

dotnet/docs/test-assertions.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import HTMLCard from '@site/src/components/HTMLCard';
2727
| [Expect(Locator).ToHaveAttributeAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-attribute) | Element has a DOM attribute |
2828
| [Expect(Locator).ToHaveClassAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-class) | Element has a class property |
2929
| [Expect(Locator).ToHaveCountAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-count) | List has exact number of children |
30-
| [Expect(Locator).ToHaveCSSAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-css-1) | Element has CSS property |
30+
| [Expect(Locator).ToHaveCSSAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-css) | Element has CSS property |
3131
| [Expect(Locator).ToHaveIdAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-id) | Element has an ID |
3232
| [Expect(Locator).ToHaveJSPropertyAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-js-property) | Element has a JavaScript property |
3333
| [Expect(Locator).ToHaveRoleAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-role) | Element has a specific [ARIA role](https://www.w3.org/TR/wai-aria-1.2/#roles) |

java/docs/actionability.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Playwright includes auto-retrying assertions that remove flakiness by waiting un
6666
| [assertThat(locator).hasAttribute()](/api/class-locatorassertions.mdx#locator-assertions-to-have-attribute) | Element has a DOM attribute |
6767
| [assertThat(locator).hasClass()](/api/class-locatorassertions.mdx#locator-assertions-to-have-class) | Element has a class property |
6868
| [assertThat(locator).hasCount()](/api/class-locatorassertions.mdx#locator-assertions-to-have-count) | List has exact number of children |
69-
| [assertThat(locator).hasCSS()](/api/class-locatorassertions.mdx#locator-assertions-to-have-css-1) | Element has CSS property |
69+
| [assertThat(locator).hasCSS()](/api/class-locatorassertions.mdx#locator-assertions-to-have-css) | Element has CSS property |
7070
| [assertThat(locator).hasId()](/api/class-locatorassertions.mdx#locator-assertions-to-have-id) | Element has an ID |
7171
| [assertThat(locator).hasJSProperty()](/api/class-locatorassertions.mdx#locator-assertions-to-have-js-property) | Element has a JavaScript property |
7272
| [assertThat(locator).hasText()](/api/class-locatorassertions.mdx#locator-assertions-to-have-text) | Element matches text |

0 commit comments

Comments
 (0)