Skip to content

Commit

Permalink
feat(roll): roll to ToT Playwright (24-01-25) (#1655)
Browse files Browse the repository at this point in the history
  • Loading branch information
playwrightmachine authored Jan 24, 2025
1 parent d4aedf7 commit 9b128b2
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 60 deletions.
5 changes: 0 additions & 5 deletions dotnet/docs/api/class-locator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -656,11 +656,6 @@ Execute JavaScript code in the page, taking the matching element as an argument.

**Usage**

```csharp
var tweets = page.Locator(".tweet .retweets");
Assert.AreEqual("10 retweets", await tweets.EvaluateAsync("node => node.innerText"));
```

**Arguments**
- `expression` [string]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-evaluate-option-expression"/><a href="#locator-evaluate-option-expression" class="list-anchor">#</a>

Expand Down
5 changes: 0 additions & 5 deletions java/docs/api/class-locator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -653,11 +653,6 @@ Execute JavaScript code in the page, taking the matching element as an argument.

**Usage**

```java
Locator tweets = page.locator(".tweet .retweets");
assertEquals("10 retweets", tweets.evaluate("node => node.innerText"));
```

**Arguments**
- `expression` [String]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-evaluate-option-expression"/><a href="#locator-evaluate-option-expression" class="list-anchor">#</a>

Expand Down
5 changes: 0 additions & 5 deletions nodejs/docs/api/class-locator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -654,11 +654,6 @@ Execute JavaScript code in the page, taking the matching element as an argument.

**Usage**

```js
const tweets = page.locator('.tweet .retweets');
expect(await tweets.evaluate(node => node.innerText)).toBe('10 retweets');
```

**Arguments**
- `pageFunction` [function] | [string]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-evaluate-option-expression"/><a href="#locator-evaluate-option-expression" class="list-anchor">#</a>

Expand Down
20 changes: 10 additions & 10 deletions nodejs/docs/ci.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
name: 'Playwright Tests'
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.49.1-noble
image: mcr.microsoft.com/playwright:v1.50.0-noble
options: --user 1001
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -340,7 +340,7 @@ trigger:
pool:
vmImage: ubuntu-latest
container: mcr.microsoft.com/playwright:v1.49.1-noble
container: mcr.microsoft.com/playwright:v1.50.0-noble
steps:
- task: NodeTool@0
Expand All @@ -364,7 +364,7 @@ Running Playwright on CircleCI is very similar to running on GitHub Actions. In
executors:
pw-noble-development:
docker:
- image: mcr.microsoft.com/playwright:v1.49.1-noble
- image: mcr.microsoft.com/playwright: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.
Expand All @@ -387,7 +387,7 @@ Jenkins supports Docker agents for pipelines. Use the [Playwright Docker image](

```groovy
pipeline {
agent { docker { image 'mcr.microsoft.com/playwright:v1.49.1-noble' } }
agent { docker { image 'mcr.microsoft.com/playwright:v1.50.0-noble' } }
stages {
stage('e2e-tests') {
steps {
Expand All @@ -404,7 +404,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:v1.49.1-noble
image: mcr.microsoft.com/playwright:v1.50.0-noble
```

### GitLab CI
Expand All @@ -417,7 +417,7 @@ stages:
tests:
stage: test
image: mcr.microsoft.com/playwright:v1.49.1-noble
image: mcr.microsoft.com/playwright:v1.50.0-noble
script:
...
```
Expand All @@ -432,7 +432,7 @@ stages:
tests:
stage: test
image: mcr.microsoft.com/playwright:v1.49.1-noble
image: mcr.microsoft.com/playwright:v1.50.0-noble
parallel: 7
script:
- npm ci
Expand All @@ -447,7 +447,7 @@ stages:
tests:
stage: test
image: mcr.microsoft.com/playwright:v1.49.1-noble
image: mcr.microsoft.com/playwright:v1.50.0-noble
parallel:
matrix:
- PROJECT: ['chromium', 'webkit']
Expand All @@ -463,7 +463,7 @@ To run Playwright tests on Google Cloud Build, use our public Docker image ([see

```yml
steps:
- name: mcr.microsoft.com/playwright:v1.49.1-noble
- name: mcr.microsoft.com/playwright:v1.50.0-noble
script:
...
env:
Expand All @@ -481,7 +481,7 @@ type: docker
steps:
- name: test
image: mcr.microsoft.com/playwright:v1.49.1-noble
image: mcr.microsoft.com/playwright:v1.50.0-noble
commands:
- npx playwright test
```
Expand Down
18 changes: 9 additions & 9 deletions nodejs/docs/docker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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:v1.49.1-noble
docker pull mcr.microsoft.com/playwright:v1.50.0-noble
```

### Run the image
Expand All @@ -34,15 +34,15 @@ 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:v1.49.1-noble /bin/bash
docker run -it --rm --ipc=host mcr.microsoft.com/playwright:v1.50.0-noble /bin/bash
```

#### Crawling and scraping

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:v1.49.1-noble /bin/bash
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright: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:
Expand Down Expand Up @@ -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.1-noble /bin/sh -c "npx -y playwright@1.49.1 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
Expand All @@ -102,7 +102,7 @@ const browser = await playwright['chromium'].connect('ws://127.0.0.1:3000/');
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.1-noble /bin/sh -c "npx -y playwright@1.49.1 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.
Expand All @@ -117,9 +117,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.1` - Playwright v1.49.1 release docker image based on Ubuntu 24.04 LTS (Noble Numbat).
- `:v1.49.1-noble` - Playwright v1.49.1 release docker image based on Ubuntu 24.04 LTS (Noble Numbat).
- `:v1.49.1-jammy` - Playwright v1.49.1 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

Expand All @@ -143,7 +143,7 @@ To run Playwright inside Docker, you need to have Node.js, [Playwright browsers]
```Dockerfile
FROM node:20-bookworm

RUN npx -y playwright@1.49.1 install --with-deps
RUN npx -y playwright@1.50.0 install --with-deps
```


Expand Down
1 change: 1 addition & 0 deletions nodejs/docs/test-cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ Complete set of Playwright Test options is available in the [configuration file]
| `--ui-host <host>` | Host to serve UI on; specifying this option opens UI in a browser tab. |
| `--ui-port <port>` | Port to serve UI on, 0 for any free port; specifying this option opens UI in a browser tab. |
| `-u` or `--update-snapshots [mode]` | Update snapshots with actual results. Possible values are "all", "changed", "missing", and "none". Not passing defaults to "missing"; passing without a value defaults to "changed". |
| `--update-source-method [mode]` | Update snapshots with actual results. Possible values are "patch" (default), "3way" and "overwrite". "Patch" creates a unified diff file that can be used to update the source code later. "3way" generates merge conflict markers in source code. "Overwrite" overwrites the source code with the new snapshot values.|
| `-j <workers>` or `--workers <workers>` | Number of concurrent workers or percentage of logical CPU cores, use 1 to run in a single worker (default: 50%). |
| `-x` | Stop after the first failure. |

Expand Down
26 changes: 0 additions & 26 deletions python/docs/api/class-locator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -914,32 +914,6 @@ Execute JavaScript code in the page, taking the matching element as an argument.

**Usage**

<Tabs
groupId="python-flavor"
defaultValue="sync"
values={[
{label: 'Sync', value: 'sync'},
{label: 'Async', value: 'async'}
]
}>
<TabItem value="sync">

```py
tweets = page.locator(".tweet .retweets")
assert tweets.evaluate("node => node.innerText") == "10 retweets"
```

</TabItem>
<TabItem value="async">

```py
tweets = page.locator(".tweet .retweets")
assert await tweets.evaluate("node => node.innerText") == "10 retweets"
```

</TabItem>
</Tabs>

**Arguments**
- `expression` [str]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-evaluate-option-expression"/><a href="#locator-evaluate-option-expression" class="list-anchor">#</a>

Expand Down

0 comments on commit 9b128b2

Please sign in to comment.