From 19b0f5ccb38fb0dee6e04b44448a8a2a212ee393 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Tue, 7 Nov 2023 09:28:18 +0100 Subject: [PATCH] docs(dotnet): page -> Page (#27988) Fixes https://github.com/microsoft/playwright-dotnet/issues/2738 Fixes https://github.com/microsoft/playwright/pull/27946 --- docs/src/api/class-pageassertions.md | 6 +++--- docs/src/api/class-playwrightassertions.md | 2 +- docs/src/api/params.md | 4 ++-- docs/src/locators.md | 24 +++++++++++----------- docs/src/other-locators.md | 2 +- docs/src/release-notes-csharp.md | 4 ++-- docs/src/writing-tests-csharp.md | 2 +- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/docs/src/api/class-pageassertions.md b/docs/src/api/class-pageassertions.md index 9bea84e384..fcb4f38652 100644 --- a/docs/src/api/class-pageassertions.md +++ b/docs/src/api/class-pageassertions.md @@ -85,7 +85,7 @@ assertThat(page).not().hasURL("error"); ``` ```csharp -await Expect(page).Not.ToHaveURL("error"); +await Expect(Page).Not.ToHaveURL("error"); ``` ## async method: PageAssertions.NotToHaveTitle @@ -261,7 +261,7 @@ expect(page).to_have_title(re.compile(r".*checkout")) ``` ```csharp -await Expect(page).ToHaveTitle("Playwright"); +await Expect(Page).ToHaveTitle("Playwright"); ``` ### param: PageAssertions.toHaveTitle.titleOrRegExp @@ -310,7 +310,7 @@ expect(page).to_have_url(re.compile(".*checkout")) ``` ```csharp -await Expect(page).ToHaveURL(new Regex(".*checkout")); +await Expect(Page).ToHaveURL(new Regex(".*checkout")); ``` ### param: PageAssertions.toHaveURL.urlOrRegExp diff --git a/docs/src/api/class-playwrightassertions.md b/docs/src/api/class-playwrightassertions.md index bb5bb305a9..0d8a2c9ce8 100644 --- a/docs/src/api/class-playwrightassertions.md +++ b/docs/src/api/class-playwrightassertions.md @@ -157,7 +157,7 @@ PlaywrightAssertions.assertThat(page).hasTitle("News"); ``` ```csharp -await Expect(page).ToHaveTitleAsync("News"); +await Expect(Page).ToHaveTitleAsync("News"); ``` ### param: PlaywrightAssertions.expectPage.page diff --git a/docs/src/api/params.md b/docs/src/api/params.md index 81fa010aee..293b415c44 100644 --- a/docs/src/api/params.md +++ b/docs/src/api/params.md @@ -1589,7 +1589,7 @@ page.getByRole(AriaRole.BUTTON, ``` ```csharp -await Expect(page +await Expect(Page .GetByRole(AriaRole.Heading, new() { Name = "Sign up" })) .ToBeVisibleAsync(); @@ -1641,7 +1641,7 @@ expect(page.get_by_title("Issues count")).to_have_text("25 issues") ``` ```csharp -await Expect(page.GetByTitle("Issues count")).toHaveText("25 issues"); +await Expect(Page.GetByTitle("Issues count")).toHaveText("25 issues"); ``` ## test-config-snapshot-path-template diff --git a/docs/src/locators.md b/docs/src/locators.md index bbecedfd1f..ee036dbf79 100644 --- a/docs/src/locators.md +++ b/docs/src/locators.md @@ -68,7 +68,7 @@ await page.GetByLabel("Password").FillAsync("secret-password"); await page.GetByRole(AriaRole.Button, new() { Name = "Sign in" }).ClickAsync(); -await Expect(page.GetByText("Welcome, John!")).ToBeVisibleAsync(); +await Expect(Page.GetByText("Welcome, John!")).ToBeVisibleAsync(); ``` ## Locating elements @@ -245,7 +245,7 @@ page.getByRole(AriaRole.BUTTON, ``` ```csharp -await Expect(page +await Expect(Page .GetByRole(AriaRole.Heading, new() { Name = "Sign up" })) .ToBeVisibleAsync(); @@ -373,7 +373,7 @@ expect(page.get_by_text("Welcome, John")).to_be_visible() ``` ```csharp -await Expect(page.GetByText("Welcome, John")).ToBeVisibleAsync(); +await Expect(Page.GetByText("Welcome, John")).ToBeVisibleAsync(); ``` Set an exact match: @@ -396,7 +396,7 @@ expect(page.get_by_text("Welcome, John", exact=True)).to_be_visible() ``` ```csharp -await Expect(page +await Expect(Page .GetByText("Welcome, John", new() { Exact = true })) .ToBeVisibleAsync(); ``` @@ -424,7 +424,7 @@ expect(page.get_by_text(re.compile("welcome, john", re.IGNORECASE))).to_be_visib ``` ```csharp -await Expect(page +await Expect(Page .GetByText(new Regex("welcome, john", RegexOptions.IgnoreCase))) .ToBeVisibleAsync(); ``` @@ -504,7 +504,7 @@ expect(page.get_by_title("Issues count")).to_have_text("25 issues") ``` ```csharp -await Expect(page.GetByTitle("Issues count")).toHaveText("25 issues"); +await Expect(Page.GetByTitle("Issues count")).toHaveText("25 issues"); ``` :::note When to use title locators @@ -784,7 +784,7 @@ await expect(page.locator("x-details")).to_contain_text("Details") expect(page.locator("x-details")).to_contain_text("Details") ``` ```csharp -await Expect(page.Locator("x-details")).ToContainTextAsync("Details"); +await Expect(Page.Locator("x-details")).ToContainTextAsync("Details"); ``` ## Filtering Locators @@ -910,7 +910,7 @@ expect(page.get_by_role("listitem").filter(has_not_text="Out of stock")).to_have ```csharp // 5 in-stock items -await Expect(page.getByRole(AriaRole.Listitem).Filter(new() { HasNotText = "Out of stock" })) +await Expect(Page.getByRole(AriaRole.Listitem).Filter(new() { HasNotText = "Out of stock" })) .ToHaveCountAsync(5); ``` @@ -1006,7 +1006,7 @@ expect( ``` ```csharp -await Expect(page +await Expect(Page .GetByRole(AriaRole.Listitem) .Filter(new() { Has = page.GetByRole(AriaRole.Heading, new() { Name = "Product 2" }) @@ -1049,7 +1049,7 @@ expect( ``` ```csharp -await Expect(page +await Expect(Page .GetByRole(AriaRole.Listitem) .Filter(new() { HasNot = page.GetByRole(AriaRole.Heading, new() { Name = "Product 2" }) @@ -1309,7 +1309,7 @@ assertThat(page.getByRole(AriaRole.LISTITEM).hasCount(3); ``` ```csharp -await Expect(page.GetByRole(AriaRole.Listitem)).ToHaveCountAsync(3); +await Expect(Page.GetByRole(AriaRole.Listitem)).ToHaveCountAsync(3); ``` ### Assert all text in a list @@ -1349,7 +1349,7 @@ assertThat(page ``` ```csharp -await Expect(page +await Expect(Page .GetByRole(AriaRole.Listitem)) .ToHaveTextAsync(new string[] {"apple", "banana", "orange"}); ``` diff --git a/docs/src/other-locators.md b/docs/src/other-locators.md index 665dcce2c5..2950d937b8 100644 --- a/docs/src/other-locators.md +++ b/docs/src/other-locators.md @@ -726,7 +726,7 @@ expect(page.locator("label")).to_have_text("Password") ```csharp // Fill the input by targeting the label. -await Expect(page.Locator("label")).ToHaveTextAsync("Password"); +await Expect(Page.Locator("label")).ToHaveTextAsync("Password"); ``` ## Legacy text locator diff --git a/docs/src/release-notes-csharp.md b/docs/src/release-notes-csharp.md index 440981298a..1383b0a0b3 100644 --- a/docs/src/release-notes-csharp.md +++ b/docs/src/release-notes-csharp.md @@ -373,7 +373,7 @@ await page.GetByLabel("Password").FillAsync("secret-password"); await page.GetByRole(AriaRole.Button, new() { NameString = "Sign in" }).ClickAsync(); -await Expect(page.GetByText("Welcome, John!")).ToBeVisibleAsync(); +await Expect(Page.GetByText("Welcome, John!")).ToBeVisibleAsync(); ``` All the same methods are also available on [Locator], [FrameLocator] and [Frame] classes. @@ -387,7 +387,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)).ToHaveAttribute("disabled", ""); ``` ### Browser Versions diff --git a/docs/src/writing-tests-csharp.md b/docs/src/writing-tests-csharp.md index ca3a1b41ab..1aea228c68 100644 --- a/docs/src/writing-tests-csharp.md +++ b/docs/src/writing-tests-csharp.md @@ -50,7 +50,7 @@ public class Tests : PageTest await getStarted.ClickAsync(); // Expects page to have a heading with the name of Installation. - await Expect(page + await Expect(Page .GetByRole(AriaRole.Heading, new() { Name = "Installation" })) .ToBeVisibleAsync(); }