cherry-pick(#22778): docs: fix release notes snippets (#22784)

This PR cherry-picks the following commits:

- 6968b61fdc

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Playwright Service 2023-05-03 06:05:20 -07:00 committed by GitHub
parent 1aabc97379
commit 8da3502df5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 21 deletions

View File

@ -13,21 +13,21 @@ toc_max_heading_level: 2
In this case, you can wait for either a "New email" button, or a dialog and act accordingly:
```csharp
var newEmail = page.GetByRole(AriaRole.Button, new() { Name = "New" });
var dialog = page.GetByText("Confirm security settings");
var newEmail = Page.GetByRole(AriaRole.Button, new() { Name = "New email" });
var dialog = Page.GetByText("Confirm security settings");
await Expect(newEmail.Or(dialog)).ToBeVisibleAsync();
if (await dialog.IsVisibleAsync())
await page.GetByRole(AriaRole.Button, new () { Name = "Dismiss" }).ClickAsync();
await Page.GetByRole(AriaRole.Button, new() { Name = "Dismiss" }).ClickAsync();
await newEmail.ClickAsync();
```
* Use new options [`option: hasNot`] and [`option: hasNotText`] in [`method: Locator.filter`]
to find elements that **do not match** certain conditions.
```csharp
var rowLocator = page.Locator("tr");
var rowLocator = Page.Locator("tr");
await rowLocator
.Filter(new () { HasNotText = "text in column 1" })
.Filter(new () { HasNot = page.GetByRole(AriaRole.Button, new () { Name = "column 2 button" }))
.Filter(new() { HasNotText = "text in column 1" })
.Filter(new() { HasNot = Page.GetByRole(AriaRole.Button, new() { Name = "column 2 button" })})
.ScreenshotAsync();
```
* Use new web-first assertion [`method: LocatorAssertions.toBeAttached`] to ensure that the element

View File

@ -13,7 +13,7 @@ toc_max_heading_level: 2
In this case, you can wait for either a "New email" button, or a dialog and act accordingly:
```java
Locator newEmail = page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("New"));
Locator newEmail = page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("New email"));
Locator dialog = page.getByText("Confirm security settings");
assertThat(newEmail.or(dialog)).isVisible();
if (dialog.isVisible())

View File

@ -15,7 +15,7 @@ import LiteYouTube from '@site/src/components/LiteYouTube';
In this case, you can wait for either a "New email" button, or a dialog and act accordingly:
```js
const newEmail = page.getByRole('button', { name: 'New' });
const newEmail = page.getByRole('button', { name: 'New email' });
const dialog = page.getByText('Confirm security settings');
await expect(newEmail.or(dialog)).toBeVisible();
if (await dialog.isVisible())

View File

@ -13,22 +13,22 @@ toc_max_heading_level: 2
In this case, you can wait for either a "New email" button, or a dialog and act accordingly:
```python
const newEmail = page.get_by_role('button', name='New );
const dialog = page.get_by_text('Confirm security settings');
expect(newEmail.or_(dialog)).is_visible();
new_email = page.get_by_role("button", name="New email")
dialog = page.get_by_text("Confirm security settings")
expect(new_email.or_(dialog)).is_visible()
if (dialog.is_visible())
page.get_by_role('button', name='Dismiss').click();
newEmail.click();
page.get_by_role("button", name="Dismiss").click()
new_email.click()
```
* Use new options [`option: hasNot`] and [`option: hasNotText`] in [`method: Locator.filter`]
to find elements that **do not match** certain conditions.
```python
const rowLocator = page.locator('tr');
rowLocator
.filter(has_not_text='text in column 1')
.filter(has_not=page.get_by_role('button', name='column 2 button'))
.screenshot();
row_locator = page.locator("tr")
row_locator
.filter(has_not_text="text in column 1")
.filter(has_not=page.get_by_role("button", name="column 2 button"))
.screenshot()
```
* Use new web-first assertion [`method: LocatorAssertions.toBeAttached`] to ensure that the element
is present in the page's DOM. Do not confuse with the [`method: LocatorAssertions.toBeVisible`] that ensures that