diff --git a/docs/src/api/class-playwrightassertions.md b/docs/src/api/class-playwrightassertions.md index 778a3f09a3..176a2babc5 100644 --- a/docs/src/api/class-playwrightassertions.md +++ b/docs/src/api/class-playwrightassertions.md @@ -54,16 +54,6 @@ reached. You can pass this timeout as an option. By default, the timeout for assertions is set to 5 seconds. -**langs: java**To use Playwright assertions add the following dependency into the `pom.xml` of your Maven project: - -```xml java - - com.microsoft.playwright - assertions - 1.17.0 - -``` - ## method: PlaywrightAssertions.expectAPIResponse * langs: js, java - alias-java: assertThat diff --git a/docs/src/release-notes-java.md b/docs/src/release-notes-java.md index dd97085259..70b5d9b622 100644 --- a/docs/src/release-notes-java.md +++ b/docs/src/release-notes-java.md @@ -5,6 +5,90 @@ title: "Release notes" +## Version 1.18 + +### API Testing + +Playwright for Java 1.18 introduces new [API Testing](./api/class-apirequestcontext) that lets you send requests to the server directly from Java! +Now you can: + +- test your server API +- prepare server side state before visiting the web application in a test +- validate server side post-conditions after running some actions in the browser + +To do a request on behalf of Playwright's Page, use **new [`property: Page.request`] API**: + +```java +// Do a GET request on behalf of page +APIResponse res = page.request().get("http://example.com/foo.json"); +``` + +Read more about it in our [API testing guide](./test-api-testing). + +### Web-First Assertions + +Playwright for Java 1.18 introduces [Web-First Assertions](./api/class-playwrightassertions). + +Consider the following example: + +```java +... +import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat; + +public class TestExample { + ... + @Test + void statusBecomesSubmitted() { + ... + page.click("#submit-button"); + assertThat(page.locator(".status")).hasText("Submitted"); + } +} +``` + +Playwright will be re-testing the node with the selector `.status` until +fetched Node has the `"Submitted"` text. It will be re-fetching the node and +checking it over and over, until the condition is met or until the timeout is +reached. You can pass this timeout as an option. + +Read more in [our documentation](./api/class-playwrightassertions). + +### Locator Improvements + +- [`method: Locator.dragTo`] +- Each locator can now be optionally filtered by the text it contains: + ```java + page.locator("li", new Page.LocatorOptions().setHasText("my item")) + .locator("button").click(); + ``` + Read more in [locator documentation](./api/class-locator#locator-locator-option-has-text) + +### Tracing Improvements + +[Tracing](./api/class-tracing.md) now can embed Java sources to recorded +traces, using new [`setSources`](./api/class-tracing#tracing-start-option-sources) option. + +![tracing-java-sources](https://user-images.githubusercontent.com/746130/150180856-40a7df71-370c-4597-8665-40c77a5e06ad.png) + +### New APIs & changes + +- [`acceptDownloads`](./api/class-browser#browser-new-context-option-accept-downloads) option now defaults to `true`. + + + +### Browser Versions + +- Chromium 99.0.4812.0 +- Mozilla Firefox 95.0 +- WebKit 15.4 + +This version was also tested against the following stable channels: + +- Google Chrome 97 +- Microsoft Edge 97 + + + ## Version 1.17 ### Frame Locators