From 228630fab77b4d089f84ca0b40bd3499c0a466ad Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 3 Feb 2025 22:48:50 +0000 Subject: [PATCH] feat(roll): roll to 1.50 Playwright --- .../version-stable/api/class-browsertype.mdx | 41 +++++++++++++----- dotnet/versioned_docs/version-stable/ci.mdx | 10 ++--- .../versioned_docs/version-stable/docker.mdx | 16 +++---- .../version-stable/release-notes.mdx | 26 ++++++++++++ .../version-stable/api/class-browsertype.mdx | 42 ++++++++++++++----- .../version-stable/release-notes.mdx | 23 ++++++++++ .../version-stable/api/class-browsertype.mdx | 13 +----- .../version-stable/release-notes.mdx | 2 +- .../version-stable/api/class-browsertype.mdx | 41 +++++++++++++----- python/versioned_docs/version-stable/ci.mdx | 12 +++--- .../versioned_docs/version-stable/docker.mdx | 18 ++++---- .../version-stable/release-notes.mdx | 26 ++++++++++++ 12 files changed, 197 insertions(+), 73 deletions(-) diff --git a/dotnet/versioned_docs/version-stable/api/class-browsertype.mdx b/dotnet/versioned_docs/version-stable/api/class-browsertype.mdx index 4fbc355e591..5f21adcf0c4 100644 --- a/dotnet/versioned_docs/version-stable/api/class-browsertype.mdx +++ b/dotnet/versioned_docs/version-stable/api/class-browsertype.mdx @@ -37,19 +37,42 @@ class BrowserTypeExamples Added before v1.9browserType.ConnectAsync -This method attaches Playwright to an existing browser instance created via `BrowserType.launchServer` in Node.js. - -:::note - -The major and minor version of the Playwright instance that connects needs to match the version of Playwright that launches the browser (1.2.3 → is compatible with 1.2.x). -::: +This method attaches Playwright to an existing browser instance. When connecting to another browser launched via `BrowserType.launchServer` in Node.js, the major and minor version needs to match the client version (1.2.3 → is compatible with 1.2.x). **Usage** ```csharp -await BrowserType.ConnectAsync(); +await BrowserType.ConnectAsync(wsEndpoint, options); ``` +**Arguments** +- `wsEndpoint` [string] Added in: v1.10# + + A browser websocket endpoint to connect to. +- `options` `BrowserTypeConnectOptions?` *(optional)* + - `ExposeNetwork` [string]? *(optional)* Added in: v1.37# + + This option exposes network available on the connecting client to the browser being connected to. Consists of a list of rules separated by comma. + + Available rules: + 1. Hostname pattern, for example: `example.com`, `*.org:99`, `x.*.y.com`, `*foo.org`. + 1. IP literal, for example: `127.0.0.1`, `0.0.0.0:99`, `[::1]`, `[0:0::1]:99`. + 1. `` that matches local loopback interfaces: `localhost`, `*.localhost`, `127.0.0.1`, `[::1]`. + + Some common examples: + 1. `"*"` to expose all network. + 1. `""` to expose localhost network. + 1. `"*.test.internal-domain,*.staging.internal-domain,"` to expose test/staging deployments and localhost. + - `Headers` [IDictionary]?<[string], [string]> *(optional)* Added in: v1.11# + + Additional HTTP headers to be sent with web socket connect request. Optional. + - `SlowMo` [float]? *(optional)* Added in: v1.10# + + Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. Defaults to 0. + - `Timeout` [float]? *(optional)* Added in: v1.10# + + Maximum time in milliseconds to wait for the connection to be established. Defaults to `0` (no timeout). + **Returns** - [Browser]# @@ -68,10 +91,6 @@ The default browser context is accessible via [Browser.Contexts](/api/class-brow Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers. ::: -:::note -This connection is significantly lower fidelity than the Playwright protocol connection via [BrowserType.ConnectAsync()](/api/class-browsertype.mdx#browser-type-connect). If you are experiencing issues or attempting to use advanced functionality, you probably want to use [BrowserType.ConnectAsync()](/api/class-browsertype.mdx#browser-type-connect). -::: - **Usage** ```csharp diff --git a/dotnet/versioned_docs/version-stable/ci.mdx b/dotnet/versioned_docs/version-stable/ci.mdx index 612b5b8d875..c07c454d829 100644 --- a/dotnet/versioned_docs/version-stable/ci.mdx +++ b/dotnet/versioned_docs/version-stable/ci.mdx @@ -76,7 +76,7 @@ jobs: name: 'Playwright Tests' runs-on: ubuntu-latest container: - image: mcr.microsoft.com/playwright/dotnet:v1.49.0-noble + image: mcr.microsoft.com/playwright/dotnet:v1.50.0-noble options: --user 1001 steps: - uses: actions/checkout@v4 @@ -164,7 +164,7 @@ trigger: pool: vmImage: ubuntu-latest -container: mcr.microsoft.com/playwright/dotnet:v1.49.0-noble +container: mcr.microsoft.com/playwright/dotnet:v1.50.0-noble steps: - task: UseDotNet@2 @@ -187,7 +187,7 @@ Running Playwright on CircleCI is very similar to running on GitHub Actions. In executors: pw-noble-development: docker: - - image: mcr.microsoft.com/playwright/dotnet:v1.49.0-noble + - image: mcr.microsoft.com/playwright/dotnet:v1.50.0-noble ``` Note: When using the docker agent definition, you are specifying the resource class of where playwright runs to the 'medium' tier [here](https://circleci.com/docs/configuration-reference?#docker-execution-environment). The default behavior of Playwright is to set the number of workers to the detected core count (2 in the case of the medium tier). Overriding the number of workers to greater than this number will cause unnecessary timeouts and failures. @@ -198,7 +198,7 @@ Jenkins supports Docker agents for pipelines. Use the [Playwright Docker image]( ```groovy pipeline { - agent { docker { image 'mcr.microsoft.com/playwright/dotnet:v1.49.0-noble' } } + agent { docker { image 'mcr.microsoft.com/playwright/dotnet:v1.50.0-noble' } } stages { stage('e2e-tests') { steps { @@ -215,7 +215,7 @@ pipeline { Bitbucket Pipelines can use public [Docker images as build environments](https://confluence.atlassian.com/bitbucket/use-docker-images-as-build-environments-792298897.html). To run Playwright tests on Bitbucket, use our public Docker image ([see Dockerfile](./docker.mdx)). ```yml -image: mcr.microsoft.com/playwright/dotnet:v1.49.0-noble +image: mcr.microsoft.com/playwright/dotnet:v1.50.0-noble ``` ### GitLab CI diff --git a/dotnet/versioned_docs/version-stable/docker.mdx b/dotnet/versioned_docs/version-stable/docker.mdx index 813a6e5f144..d098ae7cee6 100644 --- a/dotnet/versioned_docs/version-stable/docker.mdx +++ b/dotnet/versioned_docs/version-stable/docker.mdx @@ -22,7 +22,7 @@ This Docker image is intended to be used for testing and development purposes on ### Pull the image ```bash -docker pull mcr.microsoft.com/playwright/dotnet:v1.49.0-noble +docker pull mcr.microsoft.com/playwright/dotnet:v1.50.0-noble ``` ### Run the image @@ -34,7 +34,7 @@ By default, the Docker image will use the `root` user to run the browsers. This On trusted websites, you can avoid creating a separate user and use root for it since you trust the code which will run on the browsers. ```bash -docker run -it --rm --ipc=host mcr.microsoft.com/playwright/dotnet:v1.49.0-noble /bin/bash +docker run -it --rm --ipc=host mcr.microsoft.com/playwright/dotnet:v1.50.0-noble /bin/bash ``` #### Crawling and scraping @@ -42,7 +42,7 @@ docker run -it --rm --ipc=host mcr.microsoft.com/playwright/dotnet:v1.49.0-noble On untrusted websites, it's recommended to use a separate user for launching the browsers in combination with the seccomp profile. Inside the container or if you are using the Docker image as a base image you have to use `adduser` for it. ```bash -docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/dotnet:v1.49.0-noble /bin/bash +docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/dotnet:v1.50.0-noble /bin/bash ``` [`seccomp_profile.json`](https://github.com/microsoft/playwright/blob/main/utils/docker/seccomp_profile.json) is needed to run Chromium with sandbox. This is a [default Docker seccomp profile](https://github.com/docker/engine/blob/d0d99b04cf6e00ed3fc27e81fc3d94e7eda70af3/profiles/seccomp/default.json) with extra user namespace cloning permissions: @@ -79,7 +79,7 @@ You can run Playwright Server in Docker while keeping your tests running on the Start the Playwright Server in Docker: ```bash -docker run -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.49.0-noble /bin/sh -c "npx -y playwright@1.49.0 run-server --port 3000 --host 0.0.0.0" +docker run -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.50.0-noble /bin/sh -c "npx -y playwright@1.50.0 run-server --port 3000 --host 0.0.0.0" ``` #### Connecting to the Server @@ -96,7 +96,7 @@ await using var browser = await playwright.Chromium.ConnectAsync("ws://127.0.0.1 If you need to access local servers from within the Docker container: ```bash -docker run --add-host=hostmachine:host-gateway -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.49.0-noble /bin/sh -c "npx -y playwright@1.49.0 run-server --port 3000 --host 0.0.0.0" +docker run --add-host=hostmachine:host-gateway -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.50.0-noble /bin/sh -c "npx -y playwright@1.50.0 run-server --port 3000 --host 0.0.0.0" ``` This makes `hostmachine` point to the host's localhost. Your tests should use `hostmachine` instead of `localhost` when accessing local servers. @@ -111,9 +111,9 @@ When running tests remotely, ensure the Playwright version in your tests matches See [all available image tags]. We currently publish images with the following tags: -- `:v1.49.0` - Playwright v1.49.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). -- `:v1.49.0-noble` - Playwright v1.49.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). -- `:v1.49.0-jammy` - Playwright v1.49.0 release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish). +- `:v1.50.0` - Playwright v1.50.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). +- `:v1.50.0-noble` - Playwright v1.50.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). +- `:v1.50.0-jammy` - Playwright v1.50.0 release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish). :::note diff --git a/dotnet/versioned_docs/version-stable/release-notes.mdx b/dotnet/versioned_docs/version-stable/release-notes.mdx index 1391bc50ed0..16cab37dcc2 100644 --- a/dotnet/versioned_docs/version-stable/release-notes.mdx +++ b/dotnet/versioned_docs/version-stable/release-notes.mdx @@ -7,6 +7,32 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import HTMLCard from '@site/src/components/HTMLCard'; +## Version 1.50 + +### Support for Xunit +* Support for xUnit 2.8+ via [Microsoft.Playwright.Xunit](https://www.nuget.org/packages/Microsoft.Playwright.Xunit). Follow our [Getting Started](./intro.mdx) guide to learn more. + +### Miscellaneous +* Added method [Expect(Locator).ToHaveAccessibleErrorMessageAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-have-accessible-error-message) to assert the Locator points to an element with a given [aria errormessage](https://w3c.github.io/aria/#aria-errormessage). + +### UI updates +* New button in Codegen for picking elements to produce aria snapshots. +* Additional details (such as keys pressed) are now displayed alongside action API calls in traces. +* Display of `canvas` content in traces is error-prone. Display is now disabled by default, and can be enabled via the `Display canvas content` UI setting. +* `Call` and `Network` panels now display additional time information. + +### Breaking +* [Expect(Locator).ToBeEditableAsync()](/api/class-locatorassertions.mdx#locator-assertions-to-be-editable) and [Locator.IsEditableAsync()](/api/class-locator.mdx#locator-is-editable) now throw if the target element is not ``, ``, ``, or a number of other editable elements. + +### Browser Versions +* Chromium 133.0.6943.16 +* Mozilla Firefox 134.0 +* WebKit 18.2 + +This version was also tested against the following stable channels: +* Google Chrome 132 +* Microsoft Edge 132 + ## Version 1.49 ### Aria snapshots