Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(roll): roll to ToT Playwright (roll/next-14-09-24) #1523

Merged
merged 1 commit into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions dotnet/docs/api/class-page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,23 @@ class PageExamples

---

### ForceGarbageCollectionAsync {#page-force-garbage-collection}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.47</font><x-search>page.ForceGarbageCollectionAsync</x-search>

Force the browser to perform garbage collection.

**Usage**

```csharp
await Page.ForceGarbageCollectionAsync();
```

**Returns**
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-force-garbage-collection-return"/><a href="#page-force-garbage-collection-return" class="list-anchor">#</a>

---

### Frame {#page-frame}

<font size="2" style={{position: "relative", top: "-20px"}}>Added before v1.9</font><x-search>page.Frame</x-search>
Expand Down
8 changes: 4 additions & 4 deletions dotnet/docs/api/class-tracing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var page = await context.NewPageAsync();
await page.GotoAsync("https://playwright.dev");
await context.Tracing.StopAsync(new()
{
Path = "trace.zip"
Path = "trace.pwtrace.zip"
});
```

Expand Down Expand Up @@ -54,7 +54,7 @@ var page = await context.NewPageAsync();
await page.GotoAsync("https://playwright.dev");
await context.Tracing.StopAsync(new()
{
Path = "trace.zip"
Path = "trace.pwtrace.zip"
});
```

Expand Down Expand Up @@ -108,15 +108,15 @@ await page.GetByText("Get Started").ClickAsync();
// Everything between StartChunkAsync and StopChunkAsync will be recorded in the trace.
await context.Tracing.StopChunkAsync(new()
{
Path = "trace1.zip"
Path = "trace1.pwtrace.zip"
});

await context.Tracing.StartChunkAsync();
await page.GotoAsync("http://example.com");
// Save a second trace file with different actions.
await context.Tracing.StopChunkAsync(new()
{
Path = "trace2.zip"
Path = "trace2.pwtrace.zip"
});
```

Expand Down
6 changes: 3 additions & 3 deletions dotnet/docs/trace-viewer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,10 @@ public class ExampleTest : PageTest

## Opening the trace

You can open the saved trace using the Playwright CLI or in your browser on [`trace.playwright.dev`](https://trace.playwright.dev). Make sure to add the full path to where your `trace.zip` file is located.
You can open the saved trace using the Playwright CLI or in your browser on [`trace.playwright.dev`](https://trace.playwright.dev). Make sure to add the full path to where your `trace.pwtrace.zip` file is located.

```bash
pwsh bin/Debug/netX/playwright.ps1 show-trace trace.zip
pwsh bin/Debug/netX/playwright.ps1 show-trace trace.pwtrace.zip
```

## Using [trace.playwright.dev](https://trace.playwright.dev)
Expand All @@ -329,7 +329,7 @@ pwsh bin/Debug/netX/playwright.ps1 show-trace trace.zip
You can open remote traces using its URL. They could be generated on a CI run which makes it easy to view the remote trace without having to manually download the file.

```bash
pwsh bin/Debug/netX/playwright.ps1 show-trace https://example.com/trace.zip
pwsh bin/Debug/netX/playwright.ps1 show-trace https://example.com/trace.pwtrace.zip
```

You can also pass the URL of your uploaded trace (e.g. inside your CI) from some accessible storage as a parameter. CORS (Cross-Origin Resource Sharing) rules might apply.
Expand Down
17 changes: 17 additions & 0 deletions java/docs/api/class-page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,23 @@ public class Example {

---

### forceGarbageCollection {#page-force-garbage-collection}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.47</font><x-search>page.forceGarbageCollection</x-search>

Force the browser to perform garbage collection.

**Usage**

```java
Page.forceGarbageCollection();
```

**Returns**
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="page-force-garbage-collection-return"/><a href="#page-force-garbage-collection-return" class="list-anchor">#</a>

---

### frame {#page-frame}

<font size="2" style={{position: "relative", top: "-20px"}}>Added before v1.9</font><x-search>page.frame</x-search>
Expand Down
8 changes: 4 additions & 4 deletions java/docs/api/class-tracing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ context.tracing().start(new Tracing.StartOptions()
Page page = context.newPage();
page.navigate("https://playwright.dev");
context.tracing().stop(new Tracing.StopOptions()
.setPath(Paths.get("trace.zip")));
.setPath(Paths.get("trace.pwtrace.zip")));
```


Expand All @@ -43,7 +43,7 @@ context.tracing().start(new Tracing.StartOptions()
Page page = context.newPage();
page.navigate("https://playwright.dev");
context.tracing().stop(new Tracing.StopOptions()
.setPath(Paths.get("trace.zip")));
.setPath(Paths.get("trace.pwtrace.zip")));
```

**Arguments**
Expand Down Expand Up @@ -90,13 +90,13 @@ context.tracing().startChunk();
page.getByText("Get Started").click();
// Everything between startChunk and stopChunk will be recorded in the trace.
context.tracing().stopChunk(new Tracing.StopChunkOptions()
.setPath(Paths.get("trace1.zip")));
.setPath(Paths.get("trace1.pwtrace.zip")));

context.tracing().startChunk();
page.navigate("http://example.com");
// Save a second trace file with different actions.
context.tracing().stopChunk(new Tracing.StopChunkOptions()
.setPath(Paths.get("trace2.zip")));
.setPath(Paths.get("trace2.pwtrace.zip")));
```

**Arguments**
Expand Down
12 changes: 6 additions & 6 deletions java/docs/ci.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
name: 'Playwright Tests'
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright/java:v1.46.0-jammy
image: mcr.microsoft.com/playwright/java:v1.47.0-jammy
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
Expand Down Expand Up @@ -166,7 +166,7 @@ trigger:

pool:
vmImage: ubuntu-latest
container: mcr.microsoft.com/playwright/java:v1.46.0-noble
container: mcr.microsoft.com/playwright/java:v1.47.0-noble

steps:
- task: JavaToolInstaller@0
Expand All @@ -189,7 +189,7 @@ Running Playwright on CircleCI is very similar to running on GitHub Actions. In
executors:
pw-jammy-development:
docker:
- image: mcr.microsoft.com/playwright/java:v1.46.0-noble
- image: mcr.microsoft.com/playwright/java:v1.47.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 @@ -200,7 +200,7 @@ Jenkins supports Docker agents for pipelines. Use the [Playwright Docker image](

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

### GitLab CI
Expand All @@ -230,7 +230,7 @@ stages:

tests:
stage: test
image: mcr.microsoft.com/playwright/java:v1.46.0-noble
image: mcr.microsoft.com/playwright/java:v1.47.0-noble
script:
...
```
Expand Down
14 changes: 7 additions & 7 deletions java/docs/docker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,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/java:v1.46.0-noble
docker pull mcr.microsoft.com/playwright/java:v1.47.0-noble
```

### Run the image
Expand All @@ -33,15 +33,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/java:v1.46.0-noble /bin/bash
docker run -it --rm --ipc=host mcr.microsoft.com/playwright/java:v1.47.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/java:v1.46.0-noble /bin/bash
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/java:v1.47.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 @@ -74,10 +74,10 @@ See our [Continuous Integration guides](./ci.mdx) for sample configs.
See [all available image tags].

We currently publish images with the following tags:
- `:v1.46.0` - Playwright v1.46.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat).
- `:v1.46.0-noble` - Playwright v1.46.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat).
- `:v1.46.0-jammy` - Playwright v1.46.0 release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish).
- `:v1.46.0-focal` - Playwright v1.46.0 release docker image based on Ubuntu 20.04 LTS (Focal Fossa).
- `:v1.47.0` - Playwright v1.47.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat).
- `:v1.47.0-noble` - Playwright v1.47.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat).
- `:v1.47.0-jammy` - Playwright v1.47.0 release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish).
- `:v1.47.0-focal` - Playwright v1.47.0 release docker image based on Ubuntu 20.04 LTS (Focal Fossa).

:::note
It is recommended to always pin your Docker image to a specific version if possible. If the Playwright version in your Docker image does not match the version in your project/tests, Playwright will be unable to locate browser executables.
Expand Down
2 changes: 1 addition & 1 deletion java/docs/intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class App {
<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>playwright</artifactId>
<version>1.46.0</version>
<version>1.47.0</version>
</dependency>
</dependencies>
<build>
Expand Down
4 changes: 2 additions & 2 deletions java/docs/test-runners.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ repositories {
}

dependencies {
implementation 'com.microsoft.playwright:playwright:1.46.0'
implementation 'com.microsoft.playwright:playwright:1.47.0'
}

application {
Expand Down Expand Up @@ -231,7 +231,7 @@ repositories {
}

dependencies {
implementation("com.microsoft.playwright:playwright:1.46.0")
implementation("com.microsoft.playwright:playwright:1.47.0")
}

application {
Expand Down
6 changes: 3 additions & 3 deletions java/docs/trace-viewer-intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ page.navigate("https://playwright.dev");

// Stop tracing and export it into a zip archive.
context.tracing().stop(new Tracing.StopOptions()
.setPath(Paths.get("trace.zip")));
.setPath(Paths.get("trace.pwtrace.zip")));
```

This will record the trace and place it into the file named `trace.zip`.
This will record the trace and place it into the file named `trace.pwtrace.zip`.

## Opening the trace

You can open the saved trace using the Playwright CLI or in your browser on [`trace.playwright.dev`](https://trace.playwright.dev). Make sure to add the full path to where your trace's zip file is located. Once opened you can click on each action or use the timeline to see the state of the page before and after each action. You can also inspect the log, source and network during each step of the test. The trace viewer creates a DOM snapshot so you can fully interact with it, open devtools etc.

```bash
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace trace.zip"
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace trace.pwtrace.zip"
```

######
Expand Down
10 changes: 5 additions & 5 deletions java/docs/trace-viewer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,17 @@ page.navigate("https://playwright.dev");

// Stop tracing and export it into a zip archive.
context.tracing().stop(new Tracing.StopOptions()
.setPath(Paths.get("trace.zip")));
.setPath(Paths.get("trace.pwtracezip")));
```

This will record the trace and place it into the file named `trace.zip`.
This will record the trace and place it into the file named `trace.pwtrace.zip`.

## Opening the trace

You can open the saved trace using the Playwright CLI or in your browser on [`trace.playwright.dev`](https://trace.playwright.dev). Make sure to add the full path to where your `trace.zip` file is located.
You can open the saved trace using the Playwright CLI or in your browser on [`trace.playwright.dev`](https://trace.playwright.dev). Make sure to add the full path to where your `trace.pwtrace.zip` file is located.

```bash
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace trace.zip"
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace trace.pwtrace.zip"
```

## Using [trace.playwright.dev](https://trace.playwright.dev)
Expand All @@ -144,7 +144,7 @@ mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="sh
You can open remote traces using its URL. They could be generated on a CI run which makes it easy to view the remote trace without having to manually download the file.

```bash
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace https://example.com/trace.zip"
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace https://example.com/trace.pwtrace.zip"
```

You can also pass the URL of your uploaded trace (e.g. inside your CI) from some accessible storage as a parameter. CORS (Cross-Origin Resource Sharing) rules might apply.
Expand Down
Loading
Loading