docs(dotnet): fix assertion snippets (#33622)
This commit is contained in:
parent
2aa9e11a7f
commit
e61cea597a
|
|
@ -701,7 +701,7 @@ expect(locator).to_be_enabled()
|
|||
|
||||
```csharp
|
||||
var locator = Page.Locator("button.submit");
|
||||
await Expect(locator).toBeEnabledAsync();
|
||||
await Expect(locator).ToBeEnabledAsync();
|
||||
```
|
||||
|
||||
### option: LocatorAssertions.toBeEnabled.enabled
|
||||
|
|
@ -1181,7 +1181,7 @@ expect(locator).to_have_accessible_description("Save results to disk")
|
|||
|
||||
```csharp
|
||||
var locator = Page.GetByTestId("save-button");
|
||||
await Expect(locator).toHaveAccessibleDescriptionAsync("Save results to disk");
|
||||
await Expect(locator).ToHaveAccessibleDescriptionAsync("Save results to disk");
|
||||
```
|
||||
|
||||
### param: LocatorAssertions.toHaveAccessibleDescription.description
|
||||
|
|
@ -1231,7 +1231,7 @@ expect(locator).to_have_accessible_name("Save to disk")
|
|||
|
||||
```csharp
|
||||
var locator = Page.GetByTestId("save-button");
|
||||
await Expect(locator).toHaveAccessibleNameAsync("Save to disk");
|
||||
await Expect(locator).ToHaveAccessibleNameAsync("Save to disk");
|
||||
```
|
||||
|
||||
### param: LocatorAssertions.toHaveAccessibleName.name
|
||||
|
|
|
|||
|
|
@ -164,11 +164,11 @@ await Page.GotoAsync("http://localhost:3333");
|
|||
await Page.Clock.PauseAtAsync(new DateTime(2024, 2, 2, 10, 0, 0));
|
||||
|
||||
// Assert the page state.
|
||||
await Expect(Page.GetByTestId("current-time")).ToHaveText("2/2/2024, 10:00:00 AM");
|
||||
await Expect(Page.GetByTestId("current-time")).ToHaveTextAsync("2/2/2024, 10:00:00 AM");
|
||||
|
||||
// Close the laptop lid again and open it at 10:30am.
|
||||
await Page.Clock.FastForwardAsync("30:00");
|
||||
await Expect(Page.GetByTestId("current-time")).ToHaveText("2/2/2024, 10:30:00 AM");
|
||||
await Expect(Page.GetByTestId("current-time")).ToHaveTextAsync("2/2/2024, 10:30:00 AM");
|
||||
```
|
||||
|
||||
## Test inactivity monitoring
|
||||
|
|
|
|||
|
|
@ -788,7 +788,7 @@ All the same methods are also available on [Locator], [FrameLocator] and [Frame]
|
|||
- [`method: LocatorAssertions.toHaveAttribute`] with an empty value does not match missing attribute anymore. For example, the following snippet will succeed when `button` **does not** have a `disabled` attribute.
|
||||
|
||||
```csharp
|
||||
await Expect(Page.GetByRole(AriaRole.Button)).ToHaveAttribute("disabled", "");
|
||||
await Expect(Page.GetByRole(AriaRole.Button)).ToHaveAttributeAsync("disabled", "");
|
||||
```
|
||||
|
||||
### Browser Versions
|
||||
|
|
|
|||
Loading…
Reference in a new issue