From 88010333f3842a8d74a9f54de5fa333f8327ce9d Mon Sep 17 00:00:00 2001 From: Debbie O'Brien Date: Thu, 6 Jul 2023 15:04:03 +0200 Subject: [PATCH] docs: fix har example (#23982) --- docs/src/mock.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/src/mock.md b/docs/src/mock.md index 6d1e756268..563dd8e6bb 100644 --- a/docs/src/mock.md +++ b/docs/src/mock.md @@ -242,6 +242,9 @@ test('records or updates the HAR file', async ({ page }) => { // Go to the page await page.goto('https://demo.playwright.dev/api-mocking'); + + // Assert that the fruit is visible + await expect(page.getByText('Strawberry')).toBeVisible(); }); ``` @@ -252,6 +255,9 @@ async def records_or_updates_the_har_file(page: Page): # Go to the page await page.goto("https://demo.playwright.dev/api-mocking") + + # Assert that the fruit is visible + await expect(page.get_by_text("Strawberry")).to_be_visible() ``` ```python sync @@ -261,6 +267,9 @@ def records_or_updates_the_har_file(page: Page): # Go to the page page.goto("https://demo.playwright.dev/api-mocking") + + # Assert that the fruit is visible + expect(page.get_by_text("Strawberry")).to_be_visible() ``` ```csharp @@ -272,6 +281,9 @@ await page.RouteFromHARAsync("./hars/fruit.har", new () { // Go to the page await page.GotoAsync("https://demo.playwright.dev/api-mocking"); + +// Assert that the fruit is visible +await Expect(page.GetByText("Strawberry")).ToBeVisibleAsync(); ``` ```java @@ -283,6 +295,9 @@ page.routeFromHAR("./hars/fruit.har", new RouteFromHAROptions() // Go to the page page.goto("https://demo.playwright.dev/api-mocking"); + +// Assert that the fruit is visible +assertThat(page.getByText("Strawberry")).isVisible(); ``` ### Modifying a HAR file