From a62a67fba3672d40ca4eeaf684404d3a1f2ed3dc Mon Sep 17 00:00:00 2001 From: John Hawkinson Date: Mon, 10 Oct 2022 14:54:17 -0400 Subject: [PATCH] docs(library) fix js example (#17933) Co-authored-by: Max Schmitt --- docs/src/library-js.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/src/library-js.md b/docs/src/library-js.md index 3cebaadcb2..1b0ab65842 100644 --- a/docs/src/library-js.md +++ b/docs/src/library-js.md @@ -24,6 +24,7 @@ The following is an example of using the Playwright Library directly to launch C ```js tab=js-ts import playwright, { devices } from 'playwright'; +import assert from 'node:assert'; (async () => { // Setup @@ -35,7 +36,7 @@ import playwright, { devices } from 'playwright'; await context.route('**.jpg', route => route.abort()); await page.goto('https://example.com/'); - assert(await page.title() === 'Example'); // 👎 not a Web First assertion + assert(await page.title() === 'Example Domain'); // 👎 not a Web First assertion // Teardown await context.close(); @@ -44,19 +45,20 @@ import playwright, { devices } from 'playwright'; ``` ```js tab=js-js +const assert = require('node:assert'); const playwright = require('playwright'); (async () => { // Setup const browser = await playwright.chromium.launch(); - const context = await browser.newContext(devices['iPhone 11']); + const context = await browser.newContext(playwright.devices['iPhone 11']); const page = await context.newPage(); // The actual interesting bit await context.route('**.jpg', route => route.abort()); await page.goto('https://example.com/'); - assert(await page.title() === 'Example'); // 👎 not a Web First assertion + assert(await page.title() === 'Example Domain'); // 👎 not a Web First assertion // Teardown await context.close();