Skip to content

Commit 7db695f

Browse files
authored
cherry-pick(#15158) docs: add Java release notes (#15160)
1 parent 5c6335e commit 7db695f

File tree

3 files changed

+90
-2
lines changed

3 files changed

+90
-2
lines changed

docs/src/release-notes-java.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,93 @@ title: "Release notes"
55

66
<!-- TOC -->
77

8+
## Version 1.23
9+
10+
### Network Replay
11+
12+
Now you can record network traffic into a HAR file and re-use this traffic in your tests.
13+
14+
To record network into HAR file:
15+
16+
```bash
17+
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="open --save-har=example.har --save-har-glob='**/api/**' https://example.com"
18+
```
19+
20+
Alternatively, you can record HAR programmatically:
21+
22+
```java
23+
BrowserContext context = browser.newContext(new Browser.NewContextOptions()
24+
.setRecordHarPath(Paths.get("example.har"))
25+
.setRecordHarUrlFilter("**/api/**"));
26+
27+
// ... Perform actions ...
28+
29+
// Close context to ensure HAR is saved to disk.
30+
context.close();
31+
```
32+
33+
Use the new methods [`method: Page.routeFromHAR`] or [`method: BrowserContext.routeFromHAR`] to serve matching responses from the [HAR](http://www.softwareishard.com/blog/har-12-spec/) file:
34+
35+
36+
```java
37+
context.routeFromHAR(Paths.get("example.har"));
38+
```
39+
40+
Read more in [our documentation](./network#record-and-replay-requests).
41+
42+
43+
### Advanced Routing
44+
45+
You can now use [`method: Route.fallback`] to defer routing to other handlers.
46+
47+
Consider the following example:
48+
49+
```java
50+
// Remove a header from all requests.
51+
page.route("**/*", route -> {
52+
Map<String, String> headers = new HashMap<>(route.request().headers());
53+
headers.remove("X-Secret");
54+
route.resume(new Route.ResumeOptions().setHeaders(headers));
55+
});
56+
57+
// Abort all images.
58+
page.route("**/*", route -> {
59+
if ("image".equals(route.request().resourceType()))
60+
route.abort();
61+
else
62+
route.fallback();
63+
});
64+
```
65+
66+
Note that the new methods [`method: Page.routeFromHAR`] and [`method: BrowserContext.routeFromHAR`] also participate in routing and could be deferred to.
67+
68+
### Web-First Assertions Update
69+
70+
* New method [`method: LocatorAssertions.toHaveValues`] that asserts all selected values of `<select multiple>` element.
71+
* Methods [`method: LocatorAssertions.toContainText`] and [`method: LocatorAssertions.toHaveText`] now accept `ignoreCase` option.
72+
73+
### Miscellaneous
74+
75+
* If there's a service worker that's in your way, you can now easily disable it with a new context option `serviceWorkers`:
76+
```java
77+
BrowserContext context = browser.newContext(new Browser.NewContextOptions()
78+
.setServiceWorkers(ServiceWorkerPolicy.BLOCK));
79+
```
80+
* Using `.zip` path for `recordHar` context option automatically zips the resulting HAR:
81+
```java
82+
BrowserContext context = browser.newContext(new Browser.NewContextOptions()
83+
.setRecordHarPath(Paths.get("example.har.zip")));
84+
```
85+
* If you intend to edit HAR by hand, consider using the `"minimal"` HAR recording mode
86+
that only records information that is essential for replaying:
87+
```java
88+
BrowserContext context = browser.newContext(new Browser.NewContextOptions()
89+
.setRecordHarPath(Paths.get("example.har.zip"))
90+
.setRecordHarMode(HarMode.MINIMAL));
91+
```
92+
* Playwright now runs on Ubuntu 22 amd64 and Ubuntu 22 arm64. We also publish new docker image `mcr.microsoft.com/playwright/java:v1.23.0-jammy`.
93+
94+
895
## Version 1.22
996

1097
### Highlights

docs/src/release-notes-js.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Read more about [component testing with Playwright](./test-components).
106106
}
107107
});
108108
```
109-
* Playwright now runs on Ubuntu 22 amd64 and Ubuntu 22 arm64. We also publish new docker image `mcr.microsoft.com/playwright:v1.23.0-focal`.
109+
* Playwright now runs on Ubuntu 22 amd64 and Ubuntu 22 arm64. We also publish new docker image `mcr.microsoft.com/playwright:v1.23.0-jammy`.
110110

111111
### ⚠️ Breaking Changes ⚠️
112112

utils/doclint/cli.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ async function run() {
7979
for (const filePath of getAllMarkdownFiles(path.join(PROJECT_DIR, 'docs'))) {
8080
let content = fs.readFileSync(filePath).toString();
8181
content = content.replace(new RegExp('(mcr.microsoft.com/playwright[^:]*):([\\w\\d-.]+)', 'ig'), (match, imageName, imageVersion) => {
82-
return `${imageName}:v${playwrightVersion}-focal`;
82+
const [version, distroName] = imageVersion.split('-');
83+
return `${imageName}:v${playwrightVersion}-${distroName ?? 'focal'}`;
8384
});
8485
writeAssumeNoop(filePath, content, dirtyFiles);
8586
}

0 commit comments

Comments
 (0)