diff --git a/docs/src/api/class-locatorassertions.md b/docs/src/api/class-locatorassertions.md index 9c53d95875..6bfd06a841 100644 --- a/docs/src/api/class-locatorassertions.md +++ b/docs/src/api/class-locatorassertions.md @@ -1,5 +1,4 @@ # class: LocatorAssertions -* langs: java, python, js The [LocatorAssertions] class provides assertion methods that can be used to make assertions about the [Locator] state in the tests. A new instance of [LocatorAssertions] is created by calling [`method: PlaywrightAssertions.expectLocator`]: @@ -46,8 +45,31 @@ def test_status_becomes_submitted(page: Page) -> None: expect(page.locator(".status")).to_have_text("Submitted") ``` +```csharp +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Microsoft.Playwright.NUnit; +using NUnit.Framework; + +using static Microsoft.Playwright.Assertions; + +namespace PlaywrightTests +{ + public class ExampleTests : PageTest + { + [Test] + public async Task StatusBecomesSubmitted() + { + // .. + await Page.ClickAsync("#submit-button"); + await Expect(Page.Locator(".status")).ToHaveTextAsync("Submitted"); + } + } +} +``` + ## method: LocatorAssertions.not -* langs: java, js +* langs: java, js, csharp - returns: <[LocatorAssertions]> Makes the assertion check for the opposite condition. For example, this code tests that the Locator doesn't contain text `"error"`: @@ -60,56 +82,60 @@ await expect(locator).not.toContainText('error'); assertThat(locator).not().containsText("error"); ``` -## method: LocatorAssertions.NotToBeChecked +```csharp +await Expect(locator).Not.ToContainTextAsync("error"); +``` + +## async method: LocatorAssertions.NotToBeChecked * langs: python The opposite of [`method: LocatorAssertions.toBeChecked`]. ### option: LocatorAssertions.NotToBeChecked.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.NotToBeDisabled +## async method: LocatorAssertions.NotToBeDisabled * langs: python The opposite of [`method: LocatorAssertions.toBeDisabled`]. ### option: LocatorAssertions.NotToBeDisabled.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.NotToBeEditable +## async method: LocatorAssertions.NotToBeEditable * langs: python The opposite of [`method: LocatorAssertions.toBeEditable`]. ### option: LocatorAssertions.NotToBeEditable.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.NotToBeEmpty +## async method: LocatorAssertions.NotToBeEmpty * langs: python The opposite of [`method: LocatorAssertions.toBeEmpty`]. ### option: LocatorAssertions.NotToBeEmpty.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.NotToBeEnabled +## async method: LocatorAssertions.NotToBeEnabled * langs: python The opposite of [`method: LocatorAssertions.toBeEnabled`]. ### option: LocatorAssertions.NotToBeEnabled.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.NotToBeFocused +## async method: LocatorAssertions.NotToBeFocused * langs: python The opposite of [`method: LocatorAssertions.toBeFocused`]. ### option: LocatorAssertions.NotToBeFocused.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.NotToBeHidden +## async method: LocatorAssertions.NotToBeHidden * langs: python The opposite of [`method: LocatorAssertions.toBeHidden`]. ### option: LocatorAssertions.NotToBeHidden.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.NotToBeVisible +## async method: LocatorAssertions.NotToBeVisible * langs: python The opposite of [`method: LocatorAssertions.toBeVisible`]. @@ -117,7 +143,7 @@ The opposite of [`method: LocatorAssertions.toBeVisible`]. ### option: LocatorAssertions.NotToBeVisible.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.NotToContainText +## async method: LocatorAssertions.NotToContainText * langs: python The opposite of [`method: LocatorAssertions.toContainText`]. @@ -134,7 +160,7 @@ Whether to use `element.innerText` instead of `element.textContent` when retriev ### option: LocatorAssertions.NotToContainText.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.NotToHaveAttribute +## async method: LocatorAssertions.NotToHaveAttribute * langs: python The opposite of [`method: LocatorAssertions.toHaveAttribute`]. @@ -151,7 +177,7 @@ Expected attribute value. ### option: LocatorAssertions.NotToHaveAttribute.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.NotToHaveClass +## async method: LocatorAssertions.NotToHaveClass * langs: python The opposite of [`method: LocatorAssertions.toHaveClass`]. @@ -163,7 +189,7 @@ Expected class or RegExp or a list of those. ### option: LocatorAssertions.NotToHaveClass.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.NotToHaveCount +## async method: LocatorAssertions.NotToHaveCount * langs: python The opposite of [`method: LocatorAssertions.toHaveCount`]. @@ -175,7 +201,7 @@ Expected count. ### option: LocatorAssertions.NotToHaveCount.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.NotToHaveCSS +## async method: LocatorAssertions.NotToHaveCSS * langs: python The opposite of [`method: LocatorAssertions.toHaveCSS`]. @@ -192,7 +218,7 @@ CSS property value. ### option: LocatorAssertions.NotToHaveCSS.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.NotToHaveId +## async method: LocatorAssertions.NotToHaveId * langs: python The opposite of [`method: LocatorAssertions.toHaveId`]. @@ -204,7 +230,7 @@ Element id. ### option: LocatorAssertions.NotToHaveId.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.NotToHaveJSProperty +## async method: LocatorAssertions.NotToHaveJSProperty * langs: python The opposite of [`method: LocatorAssertions.toHaveJSProperty`]. @@ -215,13 +241,13 @@ The opposite of [`method: LocatorAssertions.toHaveJSProperty`]. Property name. ### param: LocatorAssertions.NotToHaveJSProperty.value -- `value` <[Serializable]> +- `value` <[any]> Property value. ### option: LocatorAssertions.NotToHaveJSProperty.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.NotToHaveText +## async method: LocatorAssertions.NotToHaveText * langs: python The opposite of [`method: LocatorAssertions.toHaveText`]. @@ -238,7 +264,7 @@ Whether to use `element.innerText` instead of `element.textContent` when retriev ### option: LocatorAssertions.NotToHaveText.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.NotToHaveValue +## async method: LocatorAssertions.NotToHaveValue * langs: python The opposite of [`method: LocatorAssertions.toHaveValue`]. @@ -251,7 +277,7 @@ Expected value. ### option: LocatorAssertions.NotToHaveValue.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.toBeChecked +## async method: LocatorAssertions.toBeChecked * langs: - alias-java: isChecked @@ -280,13 +306,18 @@ locator = page.locator(".subscribe") expect(locator).to_be_checked() ``` +```csharp +var locator = Page.Locator(".subscribe"); +await Expect(locator).ToBeCheckedAsync(); +``` + ### option: LocatorAssertions.toBeChecked.checked - `checked` <[boolean]> ### option: LocatorAssertions.toBeChecked.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.toBeDisabled +## async method: LocatorAssertions.toBeDisabled * langs: - alias-java: isDisabled @@ -315,10 +346,15 @@ locator = page.locator("button.submit") expect(locator).to_be_disabled() ``` +```csharp +var locator = Page.Locator("button.submit"); +await Expect(locator).ToBeDisabledAsync(); +``` + ### option: LocatorAssertions.toBeDisabled.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.toBeEditable +## async method: LocatorAssertions.toBeEditable * langs: - alias-java: isEditable @@ -347,10 +383,15 @@ locator = page.locator(".input") expect(locator).to_be_editable() ``` +```csharp +var locator = Page.Locator("input"); +await Expect(locator).ToBeEditableAsync(); +``` + ### option: LocatorAssertions.toBeEditable.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.toBeEmpty +## async method: LocatorAssertions.toBeEmpty * langs: - alias-java: isEmpty @@ -379,10 +420,15 @@ locator = page.locator("div.warning") expect(locator).to_be_empty() ``` +```csharp +var locator = Page.Locator("div.warning"); +await Expect(locator).ToBeEmptyAsync(); +``` + ### option: LocatorAssertions.toBeEmpty.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.toBeEnabled +## async method: LocatorAssertions.toBeEnabled * langs: - alias-java: isEnabled @@ -411,10 +457,15 @@ locator = page.locator("button.submit") expect(locator).to_be_enabled() ``` +```csharp +var locator = Page.Locator("button.submit"); +await Expect(locator).toBeEnabledAsync(); +``` + ### option: LocatorAssertions.toBeEnabled.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.toBeFocused +## async method: LocatorAssertions.toBeFocused * langs: - alias-java: isFocused @@ -443,10 +494,15 @@ locator = page.locator('input') expect(locator).to_be_focused() ``` +```csharp +var locator = Page.Locator("input"); +await Expect(locator).ToBeFocusedAsync(); +``` + ### option: LocatorAssertions.toBeFocused.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.toBeHidden +## async method: LocatorAssertions.toBeHidden * langs: - alias-java: isHidden @@ -475,10 +531,15 @@ locator = page.locator('.my-element') expect(locator).to_be_hidden() ``` +```csharp +var locator = Page.Locator(".my-element"); +await Expect(locator).ToBeHiddenAsync(); +``` + ### option: LocatorAssertions.toBeHidden.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.toBeVisible +## async method: LocatorAssertions.toBeVisible * langs: - alias-java: isVisible @@ -507,9 +568,14 @@ locator = page.locator('.my-element') expect(locator).to_be_visible() ``` +```csharp +var locator = Page.Locator(".my-element"); +await Expect(locator).ToBeVisibleAsync(); +``` + ### option: LocatorAssertions.toBeVisible.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.toContainText +## async method: LocatorAssertions.toContainText * langs: - alias-java: containsText @@ -543,6 +609,12 @@ expect(locator).to_contain_text("substring") expect(locator).to_contain_text(re.compile(r"\d messages")) ``` +```csharp +var locator = Page.Locator(".title"); +await Expect(locator).ToContainTextAsync("substring"); +await Expect(locator).ToContainTextAsync(new Regex("\\d messages")); +``` + Note that if array is passed as an expected value, entire lists of elements can be asserted: ```js @@ -570,6 +642,11 @@ locator = page.locator("list > .list-item") expect(locator).to_contain_text(["Text 1", "Text 4", "Text 5"]) ``` +```csharp +var locator = Page.Locator("list > .list-item"); +await Expect(locator).ToContainTextAsync(new string[] { "Text 1", "Text 4", "Text 5" }); +``` + ### param: LocatorAssertions.toContainText.expected * langs: python, js - `expected` <[string]|[RegExp]|[Array]<[string]|[RegExp]>> @@ -577,7 +654,7 @@ expect(locator).to_contain_text(["Text 1", "Text 4", "Text 5"]) Expected substring or RegExp or a list of those. ### param: LocatorAssertions.toContainText.expected -* langs: java +* langs: java, csharp - `expected` <[string]|[RegExp]|[Array]<[string]>|[Array]<[RegExp]>> Expected substring or RegExp or a list of those. @@ -590,7 +667,7 @@ Whether to use `element.innerText` instead of `element.textContent` when retriev ### option: LocatorAssertions.toContainText.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.toHaveAttribute +## async method: LocatorAssertions.toHaveAttribute * langs: - alias-java: hasAttribute @@ -619,6 +696,11 @@ locator = page.locator("input") expect(locator).to_have_attribute("type", "text") ``` +```csharp +var locator = Page.Locator("input"); +await Expect(locator).ToHaveAttributeAsync("type", "text"); +``` + ### param: LocatorAssertions.toHaveAttribute.name - `name` <[string]> @@ -631,7 +713,7 @@ Expected attribute value. ### option: LocatorAssertions.toHaveAttribute.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.toHaveClass +## async method: LocatorAssertions.toHaveClass * langs: - alias-java: hasClass @@ -660,6 +742,11 @@ locator = page.locator("#component") expect(locator).to_have_class(re.compile(r"selected")) ``` +```csharp +var locator = Page.Locator("#component"); +await Expect(locator).ToHaveClassAsync(new Regex("selected")); +``` + Note that if array is passed as an expected value, entire lists of elements can be asserted: ```js @@ -685,6 +772,11 @@ locator = page.locator("list > .component") expect(locator).to_have_class(["component", "component selected", "component"]) ``` +```csharp +var locator = Page.Locator("list > .component"); +await Expect(locator).ToHaveClassAsync(new string[]{"component", "component selected", "component"}); +``` + ### param: LocatorAssertions.toHaveClass.expected * langs: python, js - `expected` <[string]|[RegExp]|[Array]<[string]|[RegExp]>> @@ -692,7 +784,7 @@ expect(locator).to_have_class(["component", "component selected", "component"]) Expected class or RegExp or a list of those. ### param: LocatorAssertions.toHaveClass.expected -* langs: java +* langs: java, csharp - `expected` <[string]|[RegExp]|[Array]<[string]>|[Array]<[RegExp]>> Expected class or RegExp or a list of those. @@ -700,7 +792,7 @@ Expected class or RegExp or a list of those. ### option: LocatorAssertions.toHaveClass.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.toHaveCount +## async method: LocatorAssertions.toHaveCount * langs: - alias-java: hasCount @@ -729,6 +821,11 @@ locator = page.locator("list > .component") expect(locator).to_have_count(3) ``` +```csharp +var locator = Page.Locator("list > .component"); +await Expect(locator).ToHaveCountAsync(3); +``` + ### param: LocatorAssertions.toHaveCount.count - `count` <[int]> @@ -736,7 +833,7 @@ Expected count. ### option: LocatorAssertions.toHaveCount.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.toHaveCSS +## async method: LocatorAssertions.toHaveCSS * langs: - alias-java: hasCSS @@ -765,6 +862,11 @@ locator = page.locator("button") expect(locator).to_have_css("display", "flex") ``` +```csharp +var locator = Page.Locator("button"); +await Expect(locator).ToHaveCSSAsync("display", "flex"); +``` + ### param: LocatorAssertions.toHaveCSS.name - `name` <[string]> @@ -777,7 +879,7 @@ CSS property value. ### option: LocatorAssertions.toHaveCSS.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.toHaveId +## async method: LocatorAssertions.toHaveId * langs: - alias-java: hasId @@ -806,6 +908,11 @@ locator = page.locator("input") expect(locator).to_have_id("lastname") ``` +```csharp +var locator = Page.Locator("input"); +await Expect(locator).ToHaveIdAsync("lastname"); +``` + ### param: LocatorAssertions.toHaveId.id - `id` <[string]|[RegExp]> @@ -814,7 +921,7 @@ Element id. ### option: LocatorAssertions.toHaveId.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.toHaveJSProperty +## async method: LocatorAssertions.toHaveJSProperty * langs: - alias-java: hasJSProperty @@ -844,19 +951,24 @@ locator = page.locator(".component") expect(locator).to_have_js_property("loaded", True) ``` +```csharp +var locator = Page.Locator(".component"); +await Expect(locator).ToHaveJSPropertyAsync("loaded", true); +``` + ### param: LocatorAssertions.toHaveJSProperty.name - `name` <[string]> Property name. ### param: LocatorAssertions.toHaveJSProperty.value -- `value` <[Serializable]> +- `value` <[any]> Property value. ### option: LocatorAssertions.toHaveJSProperty.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.toHaveText +## async method: LocatorAssertions.toHaveText * langs: - alias-java: hasText @@ -891,6 +1003,13 @@ expect(locator).to_have_text(re.compile(r"Welcome, Test User")) expect(locator).to_have_text(re.compile(r"Welcome, .*")) ``` +```csharp +var locator = Page.Locator(".title"); +await Expect(locator).ToHaveTextAsync(new Regex("Welcome, Test User")); +await Expect(locator).ToHaveTextAsync(new Regex("Welcome, .*")); +``` + + Note that if array is passed as an expected value, entire lists of elements can be asserted: ```js @@ -916,6 +1035,11 @@ locator = page.locator("list > .component") expect(locator).to_have_text(["Text 1", "Text 2", "Text 3"]) ``` +```csharp +var locator = Page.Locator("list > .component"); +await Expect(locator).toHaveTextAsync(new string[]{ "Text 1", "Text 2", "Text 3" }); +``` + ### param: LocatorAssertions.toHaveText.expected * langs: python, js - `expected` <[string]|[RegExp]|[Array]<[string]|[RegExp]>> @@ -923,7 +1047,7 @@ expect(locator).to_have_text(["Text 1", "Text 2", "Text 3"]) Expected substring or RegExp or a list of those. ### param: LocatorAssertions.toHaveText.expected -* langs: java +* langs: java, csharp - `expected` <[string]|[RegExp]|[Array]<[string]>|[Array]<[RegExp]>> Expected substring or RegExp or a list of those. @@ -935,7 +1059,7 @@ Whether to use `element.innerText` instead of `element.textContent` when retriev ### option: LocatorAssertions.toHaveText.timeout = %%-assertions-timeout-%% -## method: LocatorAssertions.toHaveValue +## async method: LocatorAssertions.toHaveValue * langs: - alias-java: hasValue @@ -966,6 +1090,11 @@ locator = page.locator("input[type=number]") expect(locator).to_have_value(re.compile(r"[0-9]")) ``` +```csharp +var locator = Page.Locator("input[type=number]"); +await Expect(locator).ToHaveValueAsync(new Regex("[0-9]")); +``` + ### param: LocatorAssertions.toHaveValue.value - `value` <[string]|[RegExp]> diff --git a/docs/src/api/class-pageassertions.md b/docs/src/api/class-pageassertions.md index e90598a69e..e8805b3850 100644 --- a/docs/src/api/class-pageassertions.md +++ b/docs/src/api/class-pageassertions.md @@ -1,5 +1,4 @@ # class: PageAssertions -* langs: java, python, js The [PageAssertions] class provides assertion methods that can be used to make assertions about the [Page] state in the tests. A new instance of [PageAssertions] is created by calling [`method: PlaywrightAssertions.expectPage`]: @@ -48,9 +47,31 @@ def test_navigates_to_login_page(page: Page) -> None: expect(page).to_have_url(re.compile(r".*/login")) ``` +```csharp +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Microsoft.Playwright.NUnit; +using NUnit.Framework; + +using static Microsoft.Playwright.Assertions; + +namespace PlaywrightTests +{ + public class ExampleTests : PageTest + { + [Test] + public async Task NavigatetoLoginPage() + { + // .. + await Page.ClickAsync("#login"); + await Expect(Page.Locator("div#foobar")).ToHaveURL(new Regex(".*/login")); + } + } +} +``` ## method: PageAssertions.not -* langs: java, js +* langs: java, js, csharp - returns: <[PageAssertions]> Makes the assertion check for the opposite condition. For example, this code tests that the page URL doesn't contain `"error"`: @@ -63,7 +84,11 @@ await expect(page).not.toHaveURL('error'); assertThat(page).not().hasURL("error"); ``` -## method: PageAssertions.NotToHaveTitle +```csharp +await Expect(page).Not.ToHaveURL("error"); +``` + +## async method: PageAssertions.NotToHaveTitle * langs: python The opposite of [`method: PageAssertions.toHaveTitle`]. @@ -76,7 +101,7 @@ Expected title or RegExp. ### option: PageAssertions.NotToHaveTitle.timeout = %%-assertions-timeout-%% -## method: PageAssertions.NotToHaveURL +## async method: PageAssertions.NotToHaveURL * langs: python - alias-java: hasURL @@ -89,7 +114,7 @@ Expected substring or RegExp. ### option: PageAssertions.NotToHaveURL.timeout = %%-assertions-timeout-%% -## method: PageAssertions.toHaveTitle +## async method: PageAssertions.toHaveTitle * langs: - alias-java: hasTitle @@ -119,6 +144,10 @@ from playwright.sync_api import expect expect(page).to_have_title(re.compile(r".*checkout")) ``` +```csharp +await Expect(page).ToHaveTitle("Playwright"); +``` + ### param: PageAssertions.toHaveTitle.titleOrRegExp - `titleOrRegExp` <[string]|[RegExp]> @@ -126,7 +155,7 @@ Expected title or RegExp. ### option: PageAssertions.toHaveTitle.timeout = %%-assertions-timeout-%% -## method: PageAssertions.toHaveURL +## async method: PageAssertions.toHaveURL * langs: - alias-java: hasURL @@ -156,6 +185,10 @@ from playwright.sync_api import expect expect(page).to_have_url(re.compile(".*checkout")) ``` +```csharp +await Expect(page).ToHaveURL(new Regex(".*checkout")); +``` + ### param: PageAssertions.toHaveURL.urlOrRegExp - `urlOrRegExp` <[string]|[RegExp]> diff --git a/docs/src/api/class-playwrightassertions.md b/docs/src/api/class-playwrightassertions.md index f9de4db3a6..efae573653 100644 --- a/docs/src/api/class-playwrightassertions.md +++ b/docs/src/api/class-playwrightassertions.md @@ -1,5 +1,4 @@ # class: PlaywrightAssertions -* langs: java, python, js The [PlaywrightAssertions] class provides convenience methods for creating assertions that will wait until the expected condition is met. @@ -48,6 +47,26 @@ public class TestExample { } ``` +```csharp +using System.Threading.Tasks; +using Microsoft.Playwright.NUnit; +using NUnit.Framework; + +using static Microsoft.Playwright.Assertions; + +namespace Playwright.TestingHarnessTest.NUnit +{ + public class ExampleTests : PageTest + { + [Test] + public async Task StatusBecomesSubmitted() + { + await Expect(Page.Locator(".status")).ToHaveTextAsync("Submitted"); + } + } +} +``` + Playwright will be re-testing the node with the selector `.status` until fetched Node has the `"Submitted"` text. It will be re-fetching the node and checking it over and over, until the condition is met or until the timeout is reached. You can pass this timeout as an option. @@ -59,6 +78,7 @@ By default, the timeout for assertions is set to 5 seconds. - alias-java: assertThat - alias-python: expect - alias-js: expect + - alias-csharp: Expect - returns: <[APIResponseAssertions]> Creates a [APIResponseAssertions] object for the given [APIResponse]. @@ -73,10 +93,11 @@ PlaywrightAssertions.assertThat(response).isOK(); [APIResponse] object to use for assertions. ## method: PlaywrightAssertions.expectLocator -* langs: java, python, js +* langs: - alias-java: assertThat - alias-python: expect - alias-js: expect + - alias-csharp: Expect - returns: <[LocatorAssertions]> Creates a [LocatorAssertions] object for the given [Locator]. @@ -85,16 +106,21 @@ Creates a [LocatorAssertions] object for the given [Locator]. PlaywrightAssertions.assertThat(locator).isVisible(); ``` +```csharp +await Expect(locator).ToBeVisibleAsync(); +``` + ### param: PlaywrightAssertions.expectLocator.locator - `locator` <[Locator]> [Locator] object to use for assertions. ## method: PlaywrightAssertions.expectPage -* langs: java, python, js +* langs: - alias-java: assertThat - alias-python: expect - alias-js: expect + - alias-csharp: Expect - returns: <[PageAssertions]> Creates a [PageAssertions] object for the given [Page]. @@ -103,6 +129,10 @@ Creates a [PageAssertions] object for the given [Page]. PlaywrightAssertions.assertThat(page).hasTitle("News"); ``` +```csharp +await Expect(page).ToHaveTitleAsync("News"); +``` + ### param: PlaywrightAssertions.expectPage.page - `page` <[Page]> diff --git a/docs/src/api/params.md b/docs/src/api/params.md index 03bbd5180d..60ae684d17 100644 --- a/docs/src/api/params.md +++ b/docs/src/api/params.md @@ -710,7 +710,7 @@ using the [`method: AndroidDevice.setDefaultTimeout`] method. Time to retry the assertion for. Defaults to `timeout` in [`property: TestConfig.expect`]. ## assertions-timeout -* langs: java, python +* langs: java, python, csharp - `timeout` <[float]> Time to retry the assertion for.