Skip to content

Commit 65140d7

Browse files
committed
chore: roll to 1.59.1-beta-1775752988000
- Replace Overlay with Screencast (overlay/chapter/actions APIs moved to page.screencast()). - Add Browser.bind/unbind backed by startServer/stopServer protocol calls. - Drop Video.start/stop (moved to Screencast.start) and remove obsolete TestOverlay/TestVideo cases. - Teach ApiGenerator to handle function callbacks whose return type is Promise and add a Screencast.start.options.onFrame mapping to Consumer<ScreencastFrame>. - Port upstream test fix from microsoft/playwright#39840: navigate to server.EMPTY_PAGE instead of about:blank in TestRouteWebSocket so the arraybuffer parameterized variant no longer hangs.
1 parent 5ccdd3e commit 65140d7

File tree

23 files changed

+800
-495
lines changed

23 files changed

+800
-495
lines changed

.claude/skills/playwright-roll/SKILL.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,17 @@ Common patterns:
9494

9595
**Protocol parameter renames** — protocol parameter names can change between versions (e.g. `wsEndpoint``endpoint` in `BrowserType.connect`). When a test fails with `expected string, got undefined` or similar validation errors from the driver, check `packages/protocol/src/protocol.yml` for the current parameter names and update the corresponding `params.addProperty(...)` call in the Impl class. Also check the JS client (`src/client/`) to see how it builds the params object.
9696

97+
## Rebuilding the driver-bundle after a roll
98+
99+
`./scripts/roll_driver.sh` does the whole roll pipeline end-to-end: bumps `DRIVER_VERSION`, downloads new driver files into `driver-bundle/src/main/resources/driver/<platform>/`, regenerates `api.json` and the Java interfaces, and updates the README. When all of that succeeds, the next `mvn` invocation that touches `driver-bundle` will pick up the new files and you don't need to think about it.
100+
101+
But if any step in the pipeline fails (the very common case is the API generator throwing on a new type — see *Fixing generator and compilation errors*), the run aborts before `driver-bundle/target/classes/` has been refreshed. From that point on, until you manually rebuild `driver-bundle`, the test JVM will load the **old** driver from the cached `target/classes`/installed jar even though the source resources have already been swapped to the new version.
102+
103+
Fix — rebuild `driver-bundle` once before re-running tests:
104+
```
105+
mvn -f driver-bundle/pom.xml install -DskipTests
106+
```
107+
97108
## Porting and verifying tests
98109

99110
**Before porting an upstream test file, check the API exists in Java.** The upstream repo may have test files for brand-new APIs that haven't been added to the Java interface yet (e.g., `screencast.spec.ts` tests `page.screencast` which may not be in the generated `Page.java`). Check `git diff main --name-only` to see what interfaces were added this roll, and verify the method exists in the generated Java interface before porting.
@@ -104,6 +115,21 @@ Common patterns:
104115

105116
**Run the full suite to catch regressions, re-run flaky failures in isolation.** Some tests (e.g., `TestClientCertificates#shouldKeepSupportingHttp`) time out only under heavy parallel load. Run the failing test alone to confirm it's flaky before investigating further.
106117

118+
## Diagnosing hanging tests
119+
120+
When `mvn test` hangs and surefire eventually times the JVM out, it writes thread dumps to `playwright/target/surefire-reports/<timestamp>-jvmRun*.dump`. To find the stuck test:
121+
122+
```
123+
grep "com.microsoft.playwright.Test" playwright/target/surefire-reports/*-jvmRun1.dump | sort -u
124+
```
125+
126+
Each line is a stack frame inside a test method — typically you'll see one or two test methods blocked on a `Future.get()`, `waitForCondition`, or similar. That's the hanging test.
127+
128+
When you've identified a hanging test:
129+
1. Run it in isolation: `mvn -f playwright/pom.xml test -Dtest='TestClass#testMethod'`. If it passes alone, it's a parallel-load flake — note it but move on.
130+
2. If it still hangs in isolation, look for a recent fix in the upstream repo for the *same* test name. Use `git log --oneline tests/library/<spec>.spec.ts` in `~/playwright`. Upstream fixes for client-side hangs are often small and portable (e.g. `about:blank``server.EMPTY_PAGE` from microsoft/playwright#39840 fixed `route-web-socket.spec.ts` arraybuffer hangs — apparently some browser changed the WebSocket origin policy on `about:blank`).
131+
3. When porting an upstream fix, mirror the helper signature change rather than hard-coding workarounds. E.g. if upstream added a `server` parameter to `setupWS`, do the same in Java by injecting `Server server` via the JUnit fixture (`@FixtureTest` already wires up `ServerLifecycle`, so adding `Server server` to the test method signature is enough — no class-level boilerplate). Watch for local-variable shadowing when you add a `Server server` parameter to a method that already has a `WebSocketRoute server` local; rename the local.
132+
107133
## Commit Convention
108134

109135
Semantic commit messages: `label(scope): description`

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom
1111
| | Linux | macOS | Windows |
1212
| :--- | :---: | :---: | :---: |
1313
| Chromium <!-- GEN:chromium-version -->147.0.7727.15<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
14-
| WebKit <!-- GEN:webkit-version -->26.0<!-- GEN:stop --> ||||
14+
| WebKit <!-- GEN:webkit-version -->26.4<!-- GEN:stop --> ||||
1515
| Firefox <!-- GEN:firefox-version -->148.0.2<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
1616

1717
## Documentation

playwright/src/main/java/com/microsoft/playwright/Browser.java

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,6 +1222,44 @@ public NewPageOptions setViewportSize(ViewportSize viewportSize) {
12221222
return this;
12231223
}
12241224
}
1225+
class BindOptions {
1226+
/**
1227+
* Host to bind the web socket server to. When specified, a web socket server is created instead of a named pipe.
1228+
*/
1229+
public String host;
1230+
/**
1231+
* Port to bind the web socket server to. When specified, a web socket server is created instead of a named pipe. Use
1232+
* {@code 0} to let the OS pick an available port.
1233+
*/
1234+
public Integer port;
1235+
/**
1236+
* Working directory associated with this browser server.
1237+
*/
1238+
public String workspaceDir;
1239+
1240+
/**
1241+
* Host to bind the web socket server to. When specified, a web socket server is created instead of a named pipe.
1242+
*/
1243+
public BindOptions setHost(String host) {
1244+
this.host = host;
1245+
return this;
1246+
}
1247+
/**
1248+
* Port to bind the web socket server to. When specified, a web socket server is created instead of a named pipe. Use
1249+
* {@code 0} to let the OS pick an available port.
1250+
*/
1251+
public BindOptions setPort(int port) {
1252+
this.port = port;
1253+
return this;
1254+
}
1255+
/**
1256+
* Working directory associated with this browser server.
1257+
*/
1258+
public BindOptions setWorkspaceDir(String workspaceDir) {
1259+
this.workspaceDir = workspaceDir;
1260+
return this;
1261+
}
1262+
}
12251263
class StartTracingOptions {
12261264
/**
12271265
* specify custom categories to use instead of default.
@@ -1404,6 +1442,22 @@ default Page newPage() {
14041442
* @since v1.8
14051443
*/
14061444
Page newPage(NewPageOptions options);
1445+
/**
1446+
* Binds the browser to a named pipe or web socket, making it available for other clients to connect to.
1447+
*
1448+
* @param title Title of the browser server, used for identification.
1449+
* @since v1.59
1450+
*/
1451+
default Bind bind(String title) {
1452+
return bind(title, null);
1453+
}
1454+
/**
1455+
* Binds the browser to a named pipe or web socket, making it available for other clients to connect to.
1456+
*
1457+
* @param title Title of the browser server, used for identification.
1458+
* @since v1.59
1459+
*/
1460+
Bind bind(String title, BindOptions options);
14071461
/**
14081462
* <strong>NOTE:</strong> This API controls <a href="https://www.chromium.org/developers/how-tos/trace-event-profiling-tool">Chromium Tracing</a>
14091463
* which is a low-level chromium-specific debugging tool. API to control <a
@@ -1484,6 +1538,12 @@ default void startTracing() {
14841538
* @since v1.11
14851539
*/
14861540
byte[] stopTracing();
1541+
/**
1542+
* Unbinds the browser server previously bound with {@link com.microsoft.playwright.Browser#bind Browser.bind()}.
1543+
*
1544+
* @since v1.59
1545+
*/
1546+
void unbind();
14871547
/**
14881548
* Returns the browser version.
14891549
*

playwright/src/main/java/com/microsoft/playwright/Locator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,7 +2261,7 @@ public WaitForOptions setTimeout(double timeout) {
22612261
*
22622262
* <p> <strong>Usage</strong>
22632263
* <pre>{@code
2264-
* String[] texts = page.getByRole(AriaRole.LINK).allInnerTexts();
2264+
* List<String> texts = page.getByRole(AriaRole.LINK).allInnerTexts();
22652265
* }</pre>
22662266
*
22672267
* @since v1.14
@@ -2276,7 +2276,7 @@ public WaitForOptions setTimeout(double timeout) {
22762276
*
22772277
* <p> <strong>Usage</strong>
22782278
* <pre>{@code
2279-
* String[] texts = page.getByRole(AriaRole.LINK).allTextContents();
2279+
* List<String> texts = page.getByRole(AriaRole.LINK).allTextContents();
22802280
* }</pre>
22812281
*
22822282
* @since v1.14

playwright/src/main/java/com/microsoft/playwright/Overlay.java

Lines changed: 0 additions & 109 deletions
This file was deleted.

playwright/src/main/java/com/microsoft/playwright/Page.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5880,12 +5880,6 @@ default Locator locator(String selector) {
58805880
* @since v1.8
58815881
*/
58825882
Mouse mouse();
5883-
/**
5884-
*
5885-
*
5886-
* @since v1.59
5887-
*/
5888-
Overlay overlay();
58895883
/**
58905884
* Adds one-off {@code Dialog} handler. The handler will be removed immediately after next {@code Dialog} is created.
58915885
* <pre>{@code
@@ -6879,6 +6873,14 @@ default void routeFromHAR(Path har) {
68796873
* @since v1.48
68806874
*/
68816875
void routeWebSocket(Predicate<String> url, Consumer<WebSocketRoute> handler);
6876+
/**
6877+
* {@code Screencast} object associated with this page.
6878+
*
6879+
* <p> <strong>Usage</strong>
6880+
*
6881+
* @since v1.59
6882+
*/
6883+
Screencast screencast();
68826884
/**
68836885
* Returns the buffer with the captured screenshot.
68846886
*
@@ -7756,9 +7758,8 @@ default void unroute(Predicate<String> url) {
77567758
*/
77577759
String url();
77587760
/**
7759-
* Video object associated with this page. Can be used to control video recording with {@link
7760-
* com.microsoft.playwright.Video#start Video.start()} and {@link com.microsoft.playwright.Video#stop Video.stop()}, or to
7761-
* access the video file when using the {@code recordVideo} context option.
7761+
* Video object associated with this page. Can be used to access the video file when using the {@code recordVideo} context
7762+
* option.
77627763
*
77637764
* @since v1.8
77647765
*/

0 commit comments

Comments
 (0)