Skip to content

Commit b15c1f2

Browse files
feat(roll): roll to ToT Playwright (30-09-23) (#1174)
1 parent e8a87d6 commit b15c1f2

File tree

5 files changed

+252
-1
lines changed

5 files changed

+252
-1
lines changed

Diff for: dotnet/docs/api/class-locator.mdx

+52
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ foreach (var li in await page.GetByRole("listitem").AllAsync())
4444

4545
Returns an array of `node.innerText` values for all matching nodes.
4646

47+
:::caution Asserting text
48+
If you need to assert text on the page, prefer [Expect(Locator).ToHaveTextAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-text) with `useInnerText` option to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
49+
:::
50+
4751
**Usage**
4852

4953
```csharp
@@ -61,6 +65,10 @@ var texts = await page.GetByRole(AriaRole.Link).AllInnerTextsAsync();
6165

6266
Returns an array of `node.textContent` values for all matching nodes.
6367

68+
:::caution Asserting text
69+
If you need to assert text on the page, prefer [Expect(Locator).ToHaveTextAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-text) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
70+
:::
71+
6472
**Usage**
6573

6674
```csharp
@@ -322,6 +330,10 @@ When all steps combined have not finished during the specified `timeout`, this m
322330

323331
Returns the number of elements matching the locator.
324332

333+
:::caution Asserting count
334+
If you need to assert the number of elements on the page, prefer [Expect(Locator).ToHaveCountAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-count) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
335+
:::
336+
325337
**Usage**
326338

327339
```csharp
@@ -766,6 +778,10 @@ await locator.ClickAsync();
766778

767779
Returns the matching element's attribute value.
768780

781+
:::caution Asserting attributes
782+
If you need to assert an element's attribute, prefer [Expect(Locator).ToHaveAttributeAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-attribute) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
783+
:::
784+
769785
**Usage**
770786

771787
```csharp
@@ -1208,6 +1224,10 @@ await Locator.InnerHTMLAsync(options);
12081224

12091225
Returns the [`element.innerText`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText).
12101226

1227+
:::caution Asserting text
1228+
If you need to assert text on the page, prefer [Expect(Locator).ToHaveTextAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-text) with `useInnerText` option to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
1229+
:::
1230+
12111231
**Usage**
12121232

12131233
```csharp
@@ -1231,6 +1251,10 @@ await Locator.InnerTextAsync(options);
12311251

12321252
Returns the value for the matching `<input>` or `<textarea>` or `<select>` element.
12331253

1254+
:::caution Asserting value
1255+
If you need to assert input value, prefer [Expect(Locator).ToHaveValueAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-value) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
1256+
:::
1257+
12341258
**Usage**
12351259

12361260
```csharp
@@ -1258,6 +1282,10 @@ Throws elements that are not an input, textarea or a select. However, if the ele
12581282

12591283
Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
12601284

1285+
:::caution Asserting checked state
1286+
If you need to assert that checkobx is checked, prefer [Expect(Locator).ToBeCheckedAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-be-checked) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
1287+
:::
1288+
12611289
**Usage**
12621290

12631291
```csharp
@@ -1281,6 +1309,10 @@ var isChecked = await page.GetByRole(AriaRole.Checkbox).IsCheckedAsync();
12811309

12821310
Returns whether the element is disabled, the opposite of [enabled](../actionability.mdx#enabled).
12831311

1312+
:::caution Asserting disabled state
1313+
If you need to assert that an element is disabled, prefer [Expect(Locator).ToBeDisabledAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-be-disabled) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
1314+
:::
1315+
12841316
**Usage**
12851317

12861318
```csharp
@@ -1304,6 +1336,10 @@ Boolean disabled = await page.GetByRole(AriaRole.Button).IsDisabledAsync();
13041336

13051337
Returns whether the element is [editable](../actionability.mdx#editable).
13061338

1339+
:::caution Asserting editable state
1340+
If you need to assert that an element is editable, prefer [Expect(Locator).ToBeEditableAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-be-editable) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
1341+
:::
1342+
13071343
**Usage**
13081344

13091345
```csharp
@@ -1327,6 +1363,10 @@ Boolean editable = await page.GetByRole(AriaRole.Textbox).IsEditableAsync();
13271363

13281364
Returns whether the element is [enabled](../actionability.mdx#enabled).
13291365

1366+
:::caution Asserting enabled state
1367+
If you need to assert that an element is enabled, prefer [Expect(Locator).ToBeEnabledAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-be-enabled) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
1368+
:::
1369+
13301370
**Usage**
13311371

13321372
```csharp
@@ -1350,6 +1390,10 @@ Boolean enabled = await page.GetByRole(AriaRole.Button).IsEnabledAsync();
13501390

13511391
Returns whether the element is hidden, the opposite of [visible](../actionability.mdx#visible).
13521392

1393+
:::caution Asserting visibility
1394+
If you need to assert that element is hidden, prefer [Expect(Locator).ToBeHiddenAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-be-hidden) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
1395+
:::
1396+
13531397
**Usage**
13541398

13551399
```csharp
@@ -1376,6 +1420,10 @@ Boolean hidden = await page.GetByRole(AriaRole.Button).IsHiddenAsync();
13761420

13771421
Returns whether the element is [visible](../actionability.mdx#visible).
13781422

1423+
:::caution Asserting visibility
1424+
If you need to assert that element is visible, prefer [Expect(Locator).ToBeVisibleAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-be-visible) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
1425+
:::
1426+
13791427
**Usage**
13801428

13811429
```csharp
@@ -1960,6 +2008,10 @@ When all steps combined have not finished during the specified `timeout`, this m
19602008

19612009
Returns the [`node.textContent`](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent).
19622010

2011+
:::caution Asserting text
2012+
If you need to assert text on the page, prefer [Expect(Locator).ToHaveTextAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-text) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
2013+
:::
2014+
19632015
**Usage**
19642016

19652017
```csharp

Diff for: java/docs/api/class-locator.mdx

+52
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ for (Locator li : page.getByRole('listitem').all())
4444

4545
Returns an array of `node.innerText` values for all matching nodes.
4646

47+
:::caution Asserting text
48+
If you need to assert text on the page, prefer [assertThat(locator).hasText()](/api/class-locatorassertions.mdx#locator-assertions-to-have-text) with `useInnerText` option to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
49+
:::
50+
4751
**Usage**
4852

4953
```java
@@ -61,6 +65,10 @@ String[] texts = page.getByRole(AriaRole.LINK).allInnerTexts();
6165

6266
Returns an array of `node.textContent` values for all matching nodes.
6367

68+
:::caution Asserting text
69+
If you need to assert text on the page, prefer [assertThat(locator).hasText()](/api/class-locatorassertions.mdx#locator-assertions-to-have-text) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
70+
:::
71+
6472
**Usage**
6573

6674
```java
@@ -322,6 +330,10 @@ When all steps combined have not finished during the specified `timeout`, this m
322330

323331
Returns the number of elements matching the locator.
324332

333+
:::caution Asserting count
334+
If you need to assert the number of elements on the page, prefer [assertThat(locator).hasCount()](/api/class-locatorassertions.mdx#locator-assertions-to-have-count) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
335+
:::
336+
325337
**Usage**
326338

327339
```java
@@ -766,6 +778,10 @@ locator.click();
766778

767779
Returns the matching element's attribute value.
768780

781+
:::caution Asserting attributes
782+
If you need to assert an element's attribute, prefer [assertThat(locator).hasAttribute()](/api/class-locatorassertions.mdx#locator-assertions-to-have-attribute) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
783+
:::
784+
769785
**Usage**
770786

771787
```java
@@ -1208,6 +1224,10 @@ Locator.innerHTML(options);
12081224

12091225
Returns the [`element.innerText`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText).
12101226

1227+
:::caution Asserting text
1228+
If you need to assert text on the page, prefer [assertThat(locator).hasText()](/api/class-locatorassertions.mdx#locator-assertions-to-have-text) with `useInnerText` option to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
1229+
:::
1230+
12111231
**Usage**
12121232

12131233
```java
@@ -1232,6 +1252,10 @@ Locator.innerText(options);
12321252

12331253
Returns the value for the matching `<input>` or `<textarea>` or `<select>` element.
12341254

1255+
:::caution Asserting value
1256+
If you need to assert input value, prefer [assertThat(locator).hasValue()](/api/class-locatorassertions.mdx#locator-assertions-to-have-value) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
1257+
:::
1258+
12351259
**Usage**
12361260

12371261
```java
@@ -1259,6 +1283,10 @@ Throws elements that are not an input, textarea or a select. However, if the ele
12591283

12601284
Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
12611285

1286+
:::caution Asserting checked state
1287+
If you need to assert that checkobx is checked, prefer [assertThat(locator).isChecked()](/api/class-locatorassertions.mdx#locator-assertions-to-be-checked) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
1288+
:::
1289+
12621290
**Usage**
12631291

12641292
```java
@@ -1282,6 +1310,10 @@ boolean checked = page.getByRole(AriaRole.CHECKBOX).isChecked();
12821310

12831311
Returns whether the element is disabled, the opposite of [enabled](../actionability.mdx#enabled).
12841312

1313+
:::caution Asserting disabled state
1314+
If you need to assert that an element is disabled, prefer [assertThat(locator).isDisabled()](/api/class-locatorassertions.mdx#locator-assertions-to-be-disabled) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
1315+
:::
1316+
12851317
**Usage**
12861318

12871319
```java
@@ -1305,6 +1337,10 @@ boolean disabled = page.getByRole(AriaRole.BUTTON).isDisabled();
13051337

13061338
Returns whether the element is [editable](../actionability.mdx#editable).
13071339

1340+
:::caution Asserting editable state
1341+
If you need to assert that an element is editable, prefer [assertThat(locator).isEditable()](/api/class-locatorassertions.mdx#locator-assertions-to-be-editable) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
1342+
:::
1343+
13081344
**Usage**
13091345

13101346
```java
@@ -1328,6 +1364,10 @@ boolean editable = page.getByRole(AriaRole.TEXTBOX).isEditable();
13281364

13291365
Returns whether the element is [enabled](../actionability.mdx#enabled).
13301366

1367+
:::caution Asserting enabled state
1368+
If you need to assert that an element is enabled, prefer [assertThat(locator).isEnabled()](/api/class-locatorassertions.mdx#locator-assertions-to-be-enabled) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
1369+
:::
1370+
13311371
**Usage**
13321372

13331373
```java
@@ -1351,6 +1391,10 @@ boolean enabled = page.getByRole(AriaRole.BUTTON).isEnabled();
13511391

13521392
Returns whether the element is hidden, the opposite of [visible](../actionability.mdx#visible).
13531393

1394+
:::caution Asserting visibility
1395+
If you need to assert that element is hidden, prefer [assertThat(locator).isHidden()](/api/class-locatorassertions.mdx#locator-assertions-to-be-hidden) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
1396+
:::
1397+
13541398
**Usage**
13551399

13561400
```java
@@ -1377,6 +1421,10 @@ boolean hidden = page.getByRole(AriaRole.BUTTON).isHidden();
13771421

13781422
Returns whether the element is [visible](../actionability.mdx#visible).
13791423

1424+
:::caution Asserting visibility
1425+
If you need to assert that element is visible, prefer [assertThat(locator).isVisible()](/api/class-locatorassertions.mdx#locator-assertions-to-be-visible) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
1426+
:::
1427+
13801428
**Usage**
13811429

13821430
```java
@@ -1960,6 +2008,10 @@ When all steps combined have not finished during the specified `timeout`, this m
19602008

19612009
Returns the [`node.textContent`](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent).
19622010

2011+
:::caution Asserting text
2012+
If you need to assert text on the page, prefer [assertThat(locator).hasText()](/api/class-locatorassertions.mdx#locator-assertions-to-have-text) to avoid flakiness. See [assertions guide](../test-assertions.mdx) for more details.
2013+
:::
2014+
19632015
**Usage**
19642016

19652017
```java

0 commit comments

Comments
 (0)