From bd34148a987f561f75b846fe244dd75af3330ed8 Mon Sep 17 00:00:00 2001 From: "microsoft-playwright-automation[bot]" <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 10:09:26 +0000 Subject: [PATCH] feat(roll): roll to ToT Playwright (09-07-25) --- dotnet/docs/api/class-consolemessage.mdx | 2 +- java/docs/api/class-consolemessage.mdx | 2 +- nodejs/docs/api/class-browsercontext.mdx | 3 --- nodejs/docs/api/class-consolemessage.mdx | 2 -- nodejs/docs/chrome-extensions.mdx | 25 +++++++------------ nodejs/docs/intro.mdx | 14 ++++++++--- nodejs/docs/test-reporters.mdx | 1 + python/docs/api/class-browsercontext.mdx | 3 --- python/docs/api/class-consolemessage.mdx | 2 -- python/docs/chrome-extensions.mdx | 31 ++++++++++-------------- 10 files changed, 36 insertions(+), 49 deletions(-) diff --git a/dotnet/docs/api/class-consolemessage.mdx b/dotnet/docs/api/class-consolemessage.mdx index e60739829cd..d468abddc16 100644 --- a/dotnet/docs/api/class-consolemessage.mdx +++ b/dotnet/docs/api/class-consolemessage.mdx @@ -115,7 +115,7 @@ ConsoleMessage.Type ``` **Returns** -- `enum ConsoleMessageType { Log, Debug, Info, Error, Warning, Dir, Dirxml, Table, Trace, Clear, StartGroup, StartGroupCollapsed, EndGroup, Assert, Profile, ProfileEnd, Count, TimeEnd }`# +- [string]# [Accessibility]: /api/class-accessibility.mdx "Accessibility" diff --git a/java/docs/api/class-consolemessage.mdx b/java/docs/api/class-consolemessage.mdx index 2dab192088b..a545927a9ef 100644 --- a/java/docs/api/class-consolemessage.mdx +++ b/java/docs/api/class-consolemessage.mdx @@ -116,7 +116,7 @@ ConsoleMessage.type(); ``` **Returns** -- `enum ConsoleMessageType { LOG, DEBUG, INFO, ERROR, WARNING, DIR, DIRXML, TABLE, TRACE, CLEAR, STARTGROUP, STARTGROUPCOLLAPSED, ENDGROUP, ASSERT, PROFILE, PROFILEEND, COUNT, TIMEEND }`# +- [String]# [APIRequest]: /api/class-apirequest.mdx "APIRequest" diff --git a/nodejs/docs/api/class-browsercontext.mdx b/nodejs/docs/api/class-browsercontext.mdx index abc1a87c11f..510e28809c3 100644 --- a/nodejs/docs/api/class-browsercontext.mdx +++ b/nodejs/docs/api/class-browsercontext.mdx @@ -899,9 +899,6 @@ await browserContext.storageState(options); - `sameSite` "Strict" | "Lax" | "None" - - `partitionKey` [string] *(optional)* - - - `origins` [Array]<[Object]> - `origin` [string] diff --git a/nodejs/docs/api/class-consolemessage.mdx b/nodejs/docs/api/class-consolemessage.mdx index 61420df30cc..2b92dadfdae 100644 --- a/nodejs/docs/api/class-consolemessage.mdx +++ b/nodejs/docs/api/class-consolemessage.mdx @@ -115,8 +115,6 @@ consoleMessage.text(); Added before v1.9consoleMessage.type -One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'`, `'dir'`, `'dirxml'`, `'table'`, `'trace'`, `'clear'`, `'startGroup'`, `'startGroupCollapsed'`, `'endGroup'`, `'assert'`, `'profile'`, `'profileEnd'`, `'count'`, `'timeEnd'`. - **Usage** ```js diff --git a/nodejs/docs/chrome-extensions.mdx b/nodejs/docs/chrome-extensions.mdx index 58600712ef4..a0b1c340890 100644 --- a/nodejs/docs/chrome-extensions.mdx +++ b/nodejs/docs/chrome-extensions.mdx @@ -13,7 +13,7 @@ import HTMLCard from '@site/src/components/HTMLCard'; Extensions only work in Chrome / Chromium launched with a persistent context. Use custom browser args at your own risk, as some of them may break Playwright functionality. ::: -The snippet below retrieves the [background page](https://developer.chrome.com/extensions/background_pages) of a [Manifest v2](https://developer.chrome.com/docs/extensions/mv2/) extension whose source is located in `./my-extension`. +The snippet below retrieves the [service worker](https://developer.chrome.com/docs/extensions/develop/concepts/service-workers) of a [Manifest v3](https://developer.chrome.com/docs/extensions/develop/migrate) extension whose source is located in `./my-extension`. Note the use of the `chromium` channel that allows to run extensions in headless mode. Alternatively, you can launch the browser in headed mode. @@ -30,11 +30,11 @@ const { chromium } = require('playwright'); `--load-extension=${pathToExtension}` ] }); - let [backgroundPage] = browserContext.backgroundPages(); - if (!backgroundPage) - backgroundPage = await browserContext.waitForEvent('backgroundpage'); + let [serviceWorker] = browserContext.serviceWorkers(); + if (!serviceWorker) + serviceWorker = await browserContext.waitForEvent('serviceworker'); - // Test the background page as you would any other page. + // Test the service worker as you would any other worker. await browserContext.close(); })(); ``` @@ -68,19 +68,12 @@ export const test = base.extend<{ await context.close(); }, extensionId: async ({ context }, use) => { - /* - // for manifest v2: - let [background] = context.backgroundPages() - if (!background) - background = await context.waitForEvent('backgroundpage') - */ - // for manifest v3: - let [background] = context.serviceWorkers(); - if (!background) - background = await context.waitForEvent('serviceworker'); + let [serviceWorker] = context.serviceWorkers(); + if (!serviceWorker) + serviceWorker = await context.waitForEvent('serviceworker'); - const extensionId = background.url().split('/')[2]; + const extensionId = serviceWorker.url().split('/')[2]; await use(extensionId); }, }); diff --git a/nodejs/docs/intro.mdx b/nodejs/docs/intro.mdx index 8f5ce8463a4..de310012e32 100644 --- a/nodejs/docs/intro.mdx +++ b/nodejs/docs/intro.mdx @@ -18,7 +18,11 @@ Playwright Test was created specifically to accommodate the needs of end-to-end ## Installing Playwright -Get started by installing Playwright using npm, yarn or pnpm. Alternatively you can also get started and run your tests using the [VS Code Extension](./getting-started-vscode.mdx). +Get started by installing Playwright using one of the following methods. + +### Using npm, yarn or pnpm + +The command below either initializes a new project with Playwright, or adds Playwright setup to your current project. @@ -50,10 +54,14 @@ pnpm create playwright Run the install command and select the following to get started: - Choose between TypeScript or JavaScript (default is TypeScript) -- Name of your Tests folder (default is tests or e2e if you already have a tests folder in your project) +- Name of your Tests folder (default is `tests`, or `e2e` if you already have a `tests` folder in your project) - Add a GitHub Actions workflow to easily run tests on CI - Install Playwright browsers (default is true) +### Using the VS Code Extension + +Alternatively you can also get started and run your tests using the [VS Code Extension](./getting-started-vscode.mdx). + ## What's Installed Playwright will download the browsers needed as well as create the following files. @@ -245,7 +253,7 @@ pnpm exec playwright --version ## System requirements -- Latest version of Node.js 18, 20 or 22. +- Latest version of Node.js 20, 22 or 24. - Windows 10+, Windows Server 2016+ or Windows Subsystem for Linux (WSL). - macOS 14 Ventura, or later. - Debian 12, Ubuntu 22.04, Ubuntu 24.04, on x86-64 and arm64 architecture. diff --git a/nodejs/docs/test-reporters.mdx b/nodejs/docs/test-reporters.mdx index e77c04982fc..fbf782ca202 100644 --- a/nodejs/docs/test-reporters.mdx +++ b/nodejs/docs/test-reporters.mdx @@ -252,6 +252,7 @@ HTML report supports the following configuration options and environment variabl | `PLAYWRIGHT_HTML_HOST` | `host` | When report opens in the browser, it will be served bound to this hostname. | `localhost` | `PLAYWRIGHT_HTML_PORT` | `port` | When report opens in the browser, it will be served on this port. | `9323` or any available port when `9323` is not available. | `PLAYWRIGHT_HTML_ATTACHMENTS_BASE_URL` | `attachmentsBaseURL` | A separate location where attachments from the `data` subdirectory are uploaded. Only needed when you upload report and `data` separately to different locations. | `data/` +| `PLAYWRIGHT_HTML_NO_SNIPPETS` | `noSnippets` | If true, disable rendering code snippets in the action log. If there is a top level error, that report section with code snippet will still render. Supports `true`, `1`, `false`, and `0`. | `false` ### Blob reporter diff --git a/python/docs/api/class-browsercontext.mdx b/python/docs/api/class-browsercontext.mdx index a18eb8e8232..6d3d5e37dcd 100644 --- a/python/docs/api/class-browsercontext.mdx +++ b/python/docs/api/class-browsercontext.mdx @@ -1227,9 +1227,6 @@ browser_context.storage_state(**kwargs) - `sameSite` "Strict" | "Lax" | "None" - - `partitionKey` [str] *(optional)* - - - `origins` [List]\[[Dict]\] - `origin` [str] diff --git a/python/docs/api/class-consolemessage.mdx b/python/docs/api/class-consolemessage.mdx index 5a2dd155f0f..c59988a3847 100644 --- a/python/docs/api/class-consolemessage.mdx +++ b/python/docs/api/class-consolemessage.mdx @@ -145,8 +145,6 @@ console_message.text Added before v1.9consoleMessage.type -One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'`, `'dir'`, `'dirxml'`, `'table'`, `'trace'`, `'clear'`, `'startGroup'`, `'startGroupCollapsed'`, `'endGroup'`, `'assert'`, `'profile'`, `'profileEnd'`, `'count'`, `'timeEnd'`. - **Usage** ```python diff --git a/python/docs/chrome-extensions.mdx b/python/docs/chrome-extensions.mdx index 35de29a02cd..6ce0d59914a 100644 --- a/python/docs/chrome-extensions.mdx +++ b/python/docs/chrome-extensions.mdx @@ -13,7 +13,7 @@ import HTMLCard from '@site/src/components/HTMLCard'; Extensions only work in Chrome / Chromium launched with a persistent context. Use custom browser args at your own risk, as some of them may break Playwright functionality. ::: -The snippet below retrieves the [background page](https://developer.chrome.com/extensions/background_pages) of a [Manifest v2](https://developer.chrome.com/docs/extensions/mv2/) extension whose source is located in `./my-extension`. +The snippet below retrieves the [service worker](https://developer.chrome.com/docs/extensions/develop/concepts/service-workers) of a [Manifest v3](https://developer.chrome.com/docs/extensions/develop/migrate) extension whose source is located in `./my-extension`. Note the use of the `chromium` channel that allows to run extensions in headless mode. Alternatively, you can launch the browser in headed mode. @@ -43,12 +43,12 @@ def run(playwright: Playwright): f"--load-extension={path_to_extension}", ], ) - if len(context.background_pages) == 0: - background_page = context.wait_for_event('backgroundpage') + if len(context.service_workers) == 0: + service_worker = context.wait_for_event('serviceworker') else: - background_page = context.background_pages[0] + service_worker = context.service_workers[0] - # Test the background page as you would any other page. + # Test the service worker as you would any other worker. context.close() @@ -77,12 +77,12 @@ async def run(playwright: Playwright): ], ) - if len(context.background_pages) == 0: - background_page = await context.wait_for_event('backgroundpage') + if len(context.service_workers) == 0: + service_worker = await context.wait_for_event('serviceworker') else: - background_page = context.background_pages[0] + service_worker = context.service_workers[0] - # Test the background page as you would any other page. + # Test the service worker as you would any other worker. await context.close() @@ -129,17 +129,12 @@ def context(playwright: Playwright) -> Generator[BrowserContext, None, None]: @pytest.fixture() def extension_id(context) -> Generator[str, None, None]: - # for manifest v2: - # background = context.background_pages[0] - # if not background: - # background = context.wait_for_event("backgroundpage") - # for manifest v3: - background = context.service_workers[0] - if not background: - background = context.wait_for_event("serviceworker") + service_worker = context.service_workers[0] + if not service_worker: + service_worker = context.wait_for_event("serviceworker") - extension_id = background.url.split("/")[2] + extension_id = service_worker.url.split("/")[2] yield extension_id ```