Skip to content

Commit 53f4983

Browse files
feat(roll): roll to 1.50 Playwright
1 parent ffb3d9f commit 53f4983

File tree

110 files changed

+2783
-817
lines changed

Some content is hidden

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

110 files changed

+2783
-817
lines changed

dotnet/versioned_docs/version-stable/actionability.mdx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,20 @@ Element is considered stable when it has maintained the same bounding box for at
9393

9494
## Enabled
9595

96-
Element is considered enabled unless it is a `<button>`, `<select>`, `<input>` or `<textarea>` with a `disabled` property.
96+
Element is considered enabled when it is **not disabled**.
97+
98+
Element is **disabled** when:
99+
- it is a `<button>`, `<select>`, `<input>`, `<textarea>`, `<option>` or `<optgroup>` with a `[disabled]` attribute;
100+
- it is a `<button>`, `<select>`, `<input>`, `<textarea>`, `<option>` or `<optgroup>` that is a part of a `<fieldset>` with a `[disabled]` attribute;
101+
- it is a descendant of an element with `[aria-disabled=true]` attribute.
97102

98103
## Editable
99104

100-
Element is considered editable when it is [enabled] and does not have `readonly` property set.
105+
Element is considered editable when it is [enabled] and is **not readonly**.
106+
107+
Element is **readonly** when:
108+
- it is a `<select>`, `<input>` or `<textarea>` with a `[readonly]` attribute;
109+
- it has an `[aria-readonly=true]` attribute and an aria role that [supports it](https://w3c.github.io/aria/#aria-readonly).
101110

102111
## Receives Events
103112

dotnet/versioned_docs/version-stable/api/class-browser.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ In case this browser is connected to, clears all created contexts belonging to t
5252

5353
:::note
5454

55-
This is similar to force quitting the browser. Therefore, you should call [BrowserContext.CloseAsync()](/api/class-browsercontext.mdx#browser-context-close) on any [BrowserContext]'s you explicitly created earlier with [Browser.NewContextAsync()](/api/class-browser.mdx#browser-new-context) **before** calling [Browser.CloseAsync()](/api/class-browser.mdx#browser-close).
55+
This is similar to force-quitting the browser. To close pages gracefully and ensure you receive page close events, call [BrowserContext.CloseAsync()](/api/class-browsercontext.mdx#browser-context-close) on any [BrowserContext] instances you explicitly created earlier using [Browser.NewContextAsync()](/api/class-browser.mdx#browser-new-context) **before** calling [Browser.CloseAsync()](/api/class-browser.mdx#browser-close).
5656
:::
5757

5858
The [Browser] object itself is considered to be disposed and cannot be used anymore.

dotnet/versioned_docs/version-stable/api/class-browsercontext.mdx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,15 @@ await BrowserContext.GrantPermissionsAsync(permissions, options);
413413
**Arguments**
414414
- `permissions` [IEnumerable]&lt;[string]&gt;<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-context-grant-permissions-option-permissions"/><a href="#browser-context-grant-permissions-option-permissions" class="list-anchor">#</a>
415415

416-
A permission or an array of permissions to grant. Permissions can be one of the following values:
416+
A list of permissions to grant.
417+
418+
:::danger
419+
420+
Supported permissions differ between browsers, and even between different versions of the same browser. Any permission may stop working after an update.
421+
:::
422+
423+
Here are some permissions that may be supported by some browsers:
417424
* `'accelerometer'`
418-
* `'accessibility-events'`
419425
* `'ambient-light-sensor'`
420426
* `'background-sync'`
421427
* `'camera'`
@@ -810,7 +816,7 @@ BrowserContext.SetDefaultTimeout(timeout);
810816
**Arguments**
811817
- `timeout` [float]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-context-set-default-timeout-option-timeout"/><a href="#browser-context-set-default-timeout-option-timeout" class="list-anchor">#</a>
812818

813-
Maximum time in milliseconds
819+
Maximum time in milliseconds. Pass `0` to disable timeout.
814820

815821
---
816822

dotnet/versioned_docs/version-stable/api/class-browsertype.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ var browser = await playwright.Chromium.LaunchAsync(new() {
172172

173173
Browser distribution channel.
174174

175-
Use "chromium" to [opt in to new headless mode](../browsers.mdx#opt-in-to-new-headless-mode).
175+
Use "chromium" to [opt in to new headless mode](../browsers.mdx#chromium-new-headless-mode).
176176

177177
Use "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge", "msedge-beta", "msedge-dev", or "msedge-canary" to use branded [Google Chrome and Microsoft Edge](../browsers.mdx#google-chrome--microsoft-edge).
178178
- `ChromiumSandbox` [bool]? *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-type-launch-option-chromium-sandbox"/><a href="#browser-type-launch-option-chromium-sandbox" class="list-anchor">#</a>
@@ -289,7 +289,7 @@ await BrowserType.LaunchPersistentContextAsync(userDataDir, options);
289289

290290
Browser distribution channel.
291291

292-
Use "chromium" to [opt in to new headless mode](../browsers.mdx#opt-in-to-new-headless-mode).
292+
Use "chromium" to [opt in to new headless mode](../browsers.mdx#chromium-new-headless-mode).
293293

294294
Use "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge", "msedge-beta", "msedge-dev", or "msedge-canary" to use branded [Google Chrome and Microsoft Edge](../browsers.mdx#google-chrome--microsoft-edge).
295295
- `ChromiumSandbox` [bool]? *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-type-launch-persistent-context-option-chromium-sandbox"/><a href="#browser-type-launch-persistent-context-option-chromium-sandbox" class="list-anchor">#</a>

dotnet/versioned_docs/version-stable/api/class-clock.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ await page.Clock.PauseAtAsync(DateTime.Parse("2020-02-02"));
8989
await page.Clock.PauseAtAsync("2020-02-02");
9090
```
9191

92+
For best results, install the clock before navigating the page and set it to a time slightly before the intended test time. This ensures that all timers run normally during page loading, preventing the page from getting stuck. Once the page has fully loaded, you can safely use [Clock.PauseAtAsync()](/api/class-clock.mdx#clock-pause-at) to pause the clock.
93+
9294
**Arguments**
9395
- `time` [Date] | [string]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="clock-pause-at-option-time"/><a href="#clock-pause-at-option-time" class="list-anchor">#</a>
9496

dotnet/versioned_docs/version-stable/api/class-locator.mdx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ var button = page.GetByRole(AriaRole.Button).And(page.GetByTitle("Subscribe"));
115115

116116
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.49</font><x-search>locator.AriaSnapshotAsync</x-search>
117117

118-
Captures the aria snapshot of the given element. Read more about [aria snapshots](../aria-snapshots.mdx) and [Expect(Locator).ToMatchAriaSnapshotAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-match-aria-snapshot) for the corresponding assertion.
118+
Captures the aria snapshot of the given element. Read more about [aria snapshots](../aria-snapshots.mdx) and [Expect(Locator).ToMatchAriaSnapshotAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-match-aria-snapshot-1) for the corresponding assertion.
119119

120120
**Usage**
121121

@@ -1492,7 +1492,7 @@ Boolean disabled = await page.GetByRole(AriaRole.Button).IsDisabledAsync();
14921492

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

1495-
Returns whether the element is [editable](../actionability.mdx#editable).
1495+
Returns whether the element is [editable](../actionability.mdx#editable). If the target element is not an `<input>`, `<textarea>`, `<select>`, `[contenteditable]` and does not have a role allowing `[aria-readonly]`, this method throws an error.
14961496

14971497
:::warning[Asserting editable state]
14981498

@@ -1692,16 +1692,21 @@ var banana = await page.GetByRole(AriaRole.Listitem).Nth(2);
16921692

16931693
Creates a locator matching all elements that match one or both of the two locators.
16941694

1695-
Note that when both locators match something, the resulting locator will have multiple matches and violate [locator strictness](../locators.mdx#strictness) guidelines.
1695+
Note that when both locators match something, the resulting locator will have multiple matches, potentially causing a [locator strictness](../locators.mdx#strictness) violation.
16961696

16971697
**Usage**
16981698

16991699
Consider a scenario where you'd like to click on a "New email" button, but sometimes a security settings dialog shows up instead. In this case, you can wait for either a "New email" button, or a dialog and act accordingly.
17001700

1701+
:::note
1702+
1703+
If both "New email" button and security dialog appear on screen, the "or" locator will match both of them, possibly throwing the ["strict mode violation" error](../locators.mdx#strictness). In this case, you can use [Locator.First](/api/class-locator.mdx#locator-first) to only match one of them.
1704+
:::
1705+
17011706
```csharp
17021707
var newEmail = page.GetByRole(AriaRole.Button, new() { Name = "New" });
17031708
var dialog = page.GetByText("Confirm security settings");
1704-
await Expect(newEmail.Or(dialog)).ToBeVisibleAsync();
1709+
await Expect(newEmail.Or(dialog).First).ToBeVisibleAsync();
17051710
if (await dialog.IsVisibleAsync())
17061711
await page.GetByRole(AriaRole.Button, new() { Name = "Dismiss" }).ClickAsync();
17071712
await newEmail.ClickAsync();

dotnet/versioned_docs/version-stable/api/class-locatorassertions.mdx

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ await Expect(locator).ToBeCheckedAsync();
7373
**Arguments**
7474
- `options` `LocatorAssertionsToBeCheckedOptions?` *(optional)*
7575
- `Checked` [bool]? *(optional)* <font size="2">Added in: v1.18</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-be-checked-option-checked"/><a href="#locator-assertions-to-be-checked-option-checked" class="list-anchor">#</a>
76+
77+
Provides state to assert for. Asserts for input to be checked by default. This option can't be used when [Indeterminate](/api/class-locatorassertions.mdx#locator-assertions-to-be-checked-option-indeterminate) is set to true.
78+
- `Indeterminate` [bool]? *(optional)* <font size="2">Added in: v1.50</font><a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-be-checked-option-indeterminate"/><a href="#locator-assertions-to-be-checked-option-indeterminate" class="list-anchor">#</a>
79+
80+
Asserts that the element is in the indeterminate (mixed) state. Only supported for checkboxes and radio buttons. This option can't be true when [Checked](/api/class-locatorassertions.mdx#locator-assertions-to-be-checked-option-checked) is provided.
7681
- `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-be-checked-option-timeout"/><a href="#locator-assertions-to-be-checked-option-timeout" class="list-anchor">#</a>
7782

7883
Time to retry the assertion for in milliseconds. Defaults to `5000`.
@@ -165,7 +170,7 @@ Ensures the [Locator] points to an enabled element.
165170

166171
```csharp
167172
var locator = Page.Locator("button.submit");
168-
await Expect(locator).toBeEnabledAsync();
173+
await Expect(locator).ToBeEnabledAsync();
169174
```
170175

171176
**Arguments**
@@ -377,7 +382,7 @@ Ensures the [Locator] points to an element with a given [accessible description]
377382

378383
```csharp
379384
var locator = Page.GetByTestId("save-button");
380-
await Expect(locator).toHaveAccessibleDescriptionAsync("Save results to disk");
385+
await Expect(locator).ToHaveAccessibleDescriptionAsync("Save results to disk");
381386
```
382387

383388
**Arguments**
@@ -397,6 +402,36 @@ await Expect(locator).toHaveAccessibleDescriptionAsync("Save results to disk");
397402

398403
---
399404

405+
### ToHaveAccessibleErrorMessageAsync {#locator-assertions-to-have-accessible-error-message}
406+
407+
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.50</font><x-search>locatorAssertions.ToHaveAccessibleErrorMessageAsync</x-search>
408+
409+
Ensures the [Locator] points to an element with a given [aria errormessage](https://w3c.github.io/aria/#aria-errormessage).
410+
411+
**Usage**
412+
413+
```csharp
414+
var locator = Page.GetByTestId("username-input");
415+
await Expect(locator).ToHaveAccessibleErrorMessageAsync("Username is required.");
416+
```
417+
418+
**Arguments**
419+
- `errorMessage` [string] | [Regex]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-have-accessible-error-message-option-error-message"/><a href="#locator-assertions-to-have-accessible-error-message-option-error-message" class="list-anchor">#</a>
420+
421+
Expected accessible error message.
422+
- `options` `LocatorAssertionsToHaveAccessibleErrorMessageOptions?` *(optional)*
423+
- `IgnoreCase` [bool]? *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-have-accessible-error-message-option-ignore-case"/><a href="#locator-assertions-to-have-accessible-error-message-option-ignore-case" class="list-anchor">#</a>
424+
425+
Whether to perform case-insensitive match. [IgnoreCase](/api/class-locatorassertions.mdx#locator-assertions-to-have-accessible-error-message-option-ignore-case) option takes precedence over the corresponding regular expression flag if specified.
426+
- `Timeout` [float]? *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-have-accessible-error-message-option-timeout"/><a href="#locator-assertions-to-have-accessible-error-message-option-timeout" class="list-anchor">#</a>
427+
428+
Time to retry the assertion for in milliseconds. Defaults to `5000`.
429+
430+
**Returns**
431+
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-have-accessible-error-message-return"/><a href="#locator-assertions-to-have-accessible-error-message-return" class="list-anchor">#</a>
432+
433+
---
434+
400435
### ToHaveAccessibleNameAsync {#locator-assertions-to-have-accessible-name}
401436

402437
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.44</font><x-search>locatorAssertions.ToHaveAccessibleNameAsync</x-search>
@@ -407,7 +442,7 @@ Ensures the [Locator] points to an element with a given [accessible name](https:
407442

408443
```csharp
409444
var locator = Page.GetByTestId("save-button");
410-
await Expect(locator).toHaveAccessibleNameAsync("Save to disk");
445+
await Expect(locator).ToHaveAccessibleNameAsync("Save to disk");
411446
```
412447

413448
**Arguments**
@@ -464,21 +499,21 @@ await Expect(locator).ToHaveAttributeAsync("type", "text");
464499

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

467-
Ensures the [Locator] points to an element with given CSS classes. This needs to be a full match or using a relaxed regular expression.
502+
Ensures the [Locator] points to an element with given CSS classes. When a string is provided, it must fully match the element's `class` attribute. To match individual classes or perform partial matches, use a regular expression:
468503

469504
**Usage**
470505

471506
```html
472-
<div class='selected row' id='component'></div>
507+
<div class='middle selected row' id='component'></div>
473508
```
474509

475510
```csharp
476511
var locator = Page.Locator("#component");
477-
await Expect(locator).ToHaveClassAsync(new Regex("selected"));
478-
await Expect(locator).ToHaveClassAsync("selected row");
512+
await Expect(locator).ToHaveClassAsync(new Regex("(^|\\s)selected(\\s|$)"));
513+
await Expect(locator).ToHaveClassAsync("middle selected row");
479514
```
480515

481-
Note that if array is passed as an expected value, entire lists of elements can be asserted:
516+
When an array is passed, the method asserts that the list of elements located matches the corresponding list of expected class values. Each element's class attribute is matched against the corresponding string or regular expression in the array:
482517

483518
```csharp
484519
var locator = Page.Locator("list > .component");
@@ -776,7 +811,7 @@ await Expect(locator).ToHaveValuesAsync(new Regex[] { new Regex("R"), new Regex(
776811

777812
---
778813

779-
### ToMatchAriaSnapshotAsync {#locator-assertions-to-match-aria-snapshot}
814+
### ToMatchAriaSnapshotAsync {#locator-assertions-to-match-aria-snapshot-1}
780815

781816
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.49</font><x-search>locatorAssertions.ToMatchAriaSnapshotAsync</x-search>
782817

@@ -793,14 +828,14 @@ await Expect(page.Locator("body")).ToMatchAriaSnapshotAsync(@"
793828
```
794829

795830
**Arguments**
796-
- `expected` [string]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-match-aria-snapshot-option-expected"/><a href="#locator-assertions-to-match-aria-snapshot-option-expected" class="list-anchor">#</a>
831+
- `expected` [string]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-match-aria-snapshot-1-option-expected"/><a href="#locator-assertions-to-match-aria-snapshot-1-option-expected" class="list-anchor">#</a>
797832
- `options` `LocatorAssertionsToMatchAriaSnapshotOptions?` *(optional)*
798-
- `Timeout` [float]? *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-match-aria-snapshot-option-timeout"/><a href="#locator-assertions-to-match-aria-snapshot-option-timeout" class="list-anchor">#</a>
833+
- `Timeout` [float]? *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-match-aria-snapshot-1-option-timeout"/><a href="#locator-assertions-to-match-aria-snapshot-1-option-timeout" class="list-anchor">#</a>
799834

800835
Time to retry the assertion for in milliseconds. Defaults to `5000`.
801836

802837
**Returns**
803-
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-match-aria-snapshot-return"/><a href="#locator-assertions-to-match-aria-snapshot-return" class="list-anchor">#</a>
838+
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-assertions-to-match-aria-snapshot-1-return"/><a href="#locator-assertions-to-match-aria-snapshot-1-return" class="list-anchor">#</a>
804839

805840
---
806841

dotnet/versioned_docs/version-stable/api/class-page.mdx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,11 +1339,6 @@ await Page.PauseAsync();
13391339

13401340
Returns the PDF buffer.
13411341

1342-
:::note
1343-
1344-
Generating a pdf is currently only supported in Chromium headless.
1345-
:::
1346-
13471342
`page.pdf()` generates a pdf of the page with `print` css media. To generate a pdf with `screen` media, call [Page.EmulateMediaAsync()](/api/class-page.mdx#page-emulate-media) before calling `page.pdf()`:
13481343

13491344
:::note
@@ -2389,7 +2384,7 @@ Page.SetDefaultTimeout(timeout);
23892384
**Arguments**
23902385
- `timeout` [float]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-set-default-timeout-option-timeout"/><a href="#page-set-default-timeout-option-timeout" class="list-anchor">#</a>
23912386

2392-
Maximum time in milliseconds
2387+
Maximum time in milliseconds. Pass `0` to disable timeout.
23932388

23942389
---
23952390

0 commit comments

Comments
 (0)