docs: add Java 1.18 release notes (#11477)
This commit is contained in:
		
							parent
							
								
									7f4ad31627
								
							
						
					
					
						commit
						82c8baf9f6
					
				| 
						 | 
				
			
			@ -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
 | 
			
		||||
<dependency>
 | 
			
		||||
  <groupId>com.microsoft.playwright</groupId>
 | 
			
		||||
  <artifactId>assertions</artifactId>
 | 
			
		||||
  <version>1.17.0</version>
 | 
			
		||||
</dependency>
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## method: PlaywrightAssertions.expectAPIResponse
 | 
			
		||||
* langs: js, java
 | 
			
		||||
  - alias-java: assertThat
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,6 +5,90 @@ title: "Release notes"
 | 
			
		|||
 | 
			
		||||
<!-- TOC -->
 | 
			
		||||
 | 
			
		||||
## 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.
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
### 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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue