Skip to content

Commit 4efa174

Browse files
authored
feat: roll driver, implement new APIs (microsoft#1142)
1 parent 048bca9 commit 4efa174

47 files changed

Lines changed: 3449 additions & 2825 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom
1111

1212
| | Linux | macOS | Windows |
1313
| :--- | :---: | :---: | :---: |
14-
| Chromium <!-- GEN:chromium-version -->108.0.5359.29<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
14+
| Chromium <!-- GEN:chromium-version -->109.0.5414.46<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
1515
| WebKit <!-- GEN:webkit-version -->16.4<!-- GEN:stop --> ||||
16-
| Firefox <!-- GEN:firefox-version -->106.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
16+
| Firefox <!-- GEN:firefox-version -->107.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
1717

1818
Headless execution is supported for all the browsers on all platforms. Check out [system requirements](https://playwright.dev/java/docs/next/intro/#system-requirements) for details.
1919

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,17 @@ class NewContextOptions {
5757
*/
5858
public Proxy proxy;
5959
/**
60-
* Populates context with given storage state. This option can be used to initialize context with logged-in information
61-
* obtained via {@link BrowserContext#storageState BrowserContext.storageState()} or {@link APIRequestContext#storageState
62-
* APIRequestContext.storageState()}. Either a path to the file with saved storage, or the value returned by one of {@link
63-
* BrowserContext#storageState BrowserContext.storageState()} or {@link APIRequestContext#storageState
64-
* APIRequestContext.storageState()} methods.
60+
* Populates context with given storage state. This option can be used to initialize context with logged-in
61+
* information obtained via {@link BrowserContext#storageState BrowserContext.storageState()} or {@link
62+
* APIRequestContext#storageState APIRequestContext.storageState()}. Either a path to the file with saved storage, or the
63+
* value returned by one of {@link BrowserContext#storageState BrowserContext.storageState()} or {@link
64+
* APIRequestContext#storageState APIRequestContext.storageState()} methods.
6565
*/
6666
public String storageState;
6767
/**
68-
* Populates context with given storage state. This option can be used to initialize context with logged-in information
69-
* obtained via {@link BrowserContext#storageState BrowserContext.storageState()}. Path to the file with saved storage
70-
* state.
68+
* Populates context with given storage state. This option can be used to initialize context with logged-in
69+
* information obtained via {@link BrowserContext#storageState BrowserContext.storageState()}. Path to the file with saved
70+
* storage state.
7171
*/
7272
public Path storageStatePath;
7373
/**
@@ -136,20 +136,20 @@ public NewContextOptions setProxy(Proxy proxy) {
136136
return this;
137137
}
138138
/**
139-
* Populates context with given storage state. This option can be used to initialize context with logged-in information
140-
* obtained via {@link BrowserContext#storageState BrowserContext.storageState()} or {@link APIRequestContext#storageState
141-
* APIRequestContext.storageState()}. Either a path to the file with saved storage, or the value returned by one of {@link
142-
* BrowserContext#storageState BrowserContext.storageState()} or {@link APIRequestContext#storageState
143-
* APIRequestContext.storageState()} methods.
139+
* Populates context with given storage state. This option can be used to initialize context with logged-in
140+
* information obtained via {@link BrowserContext#storageState BrowserContext.storageState()} or {@link
141+
* APIRequestContext#storageState APIRequestContext.storageState()}. Either a path to the file with saved storage, or the
142+
* value returned by one of {@link BrowserContext#storageState BrowserContext.storageState()} or {@link
143+
* APIRequestContext#storageState APIRequestContext.storageState()} methods.
144144
*/
145145
public NewContextOptions setStorageState(String storageState) {
146146
this.storageState = storageState;
147147
return this;
148148
}
149149
/**
150-
* Populates context with given storage state. This option can be used to initialize context with logged-in information
151-
* obtained via {@link BrowserContext#storageState BrowserContext.storageState()}. Path to the file with saved storage
152-
* state.
150+
* Populates context with given storage state. This option can be used to initialize context with logged-in
151+
* information obtained via {@link BrowserContext#storageState BrowserContext.storageState()}. Path to the file with saved
152+
* storage state.
153153
*/
154154
public NewContextOptions setStorageStatePath(Path storageStatePath) {
155155
this.storageStatePath = storageStatePath;

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

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
import java.nio.file.Path;
2121

2222
/**
23-
* This API is used for the Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare
24-
* environment or the service to your e2e test.
23+
* This API is used for the Web API testing. You can use it to trigger API endpoints, configure micro-services,
24+
* prepare environment or the service to your e2e test.
2525
*
2626
* <p> Each Playwright browser context has associated with it {@code APIRequestContext} instance which shares cookie storage with the
2727
* browser context and can be accessed via {@link BrowserContext#request BrowserContext.request()} or {@link Page#request
@@ -36,8 +36,8 @@
3636
* automatically update {@code BrowserContext} cookies and requests made from the page will pick them up. This means that if you
3737
* log in using this API, your e2e test will be logged in and vice versa.
3838
*
39-
* <p> If you want API requests to not interfere with the browser cookies you should create a new {@code APIRequestContext} by
40-
* calling {@link APIRequest#newContext APIRequest.newContext()}. Such {@code APIRequestContext} object will have its own
39+
* <p> If you want API requests to not interfere with the browser cookies you should create a new {@code APIRequestContext}
40+
* by calling {@link APIRequest#newContext APIRequest.newContext()}. Such {@code APIRequestContext} object will have its own
4141
* isolated cookie storage.
4242
*/
4343
public interface APIRequestContext {
@@ -83,10 +83,11 @@ default APIResponse delete(String url) {
8383
*/
8484
void dispose();
8585
/**
86-
* Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
87-
* context cookies from the response. The method will automatically follow redirects.
86+
* Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and
87+
* update context cookies from the response. The method will automatically follow redirects. JSON objects can be passed
88+
* directly to the request.
8889
*
89-
* <p> JSON objects can be passed directly to the request:
90+
* <p> **Usage**
9091
* <pre>{@code
9192
* Map<String, Object> data = new HashMap();
9293
* data.put("title", "Book Title");
@@ -117,10 +118,11 @@ default APIResponse fetch(String urlOrRequest) {
117118
return fetch(urlOrRequest, null);
118119
}
119120
/**
120-
* Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
121-
* context cookies from the response. The method will automatically follow redirects.
121+
* Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and
122+
* update context cookies from the response. The method will automatically follow redirects. JSON objects can be passed
123+
* directly to the request.
122124
*
123-
* <p> JSON objects can be passed directly to the request:
125+
* <p> **Usage**
124126
* <pre>{@code
125127
* Map<String, Object> data = new HashMap();
126128
* data.put("title", "Book Title");
@@ -150,10 +152,11 @@ default APIResponse fetch(String urlOrRequest) {
150152
*/
151153
APIResponse fetch(String urlOrRequest, RequestOptions params);
152154
/**
153-
* Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
154-
* context cookies from the response. The method will automatically follow redirects.
155+
* Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and
156+
* update context cookies from the response. The method will automatically follow redirects. JSON objects can be passed
157+
* directly to the request.
155158
*
156-
* <p> JSON objects can be passed directly to the request:
159+
* <p> **Usage**
157160
* <pre>{@code
158161
* Map<String, Object> data = new HashMap();
159162
* data.put("title", "Book Title");
@@ -184,10 +187,11 @@ default APIResponse fetch(Request urlOrRequest) {
184187
return fetch(urlOrRequest, null);
185188
}
186189
/**
187-
* Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
188-
* context cookies from the response. The method will automatically follow redirects.
190+
* Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and
191+
* update context cookies from the response. The method will automatically follow redirects. JSON objects can be passed
192+
* directly to the request.
189193
*
190-
* <p> JSON objects can be passed directly to the request:
194+
* <p> **Usage**
191195
* <pre>{@code
192196
* Map<String, Object> data = new HashMap();
193197
* data.put("title", "Book Title");
@@ -221,6 +225,8 @@ default APIResponse fetch(Request urlOrRequest) {
221225
* response. The method will populate request cookies from the context and update context cookies from the response. The
222226
* method will automatically follow redirects.
223227
*
228+
* <p> **Usage**
229+
*
224230
* <p> Request parameters can be configured with {@code params} option, they will be serialized into the URL search parameters:
225231
* <pre>{@code
226232
* request.get("https://example.com/api/getText", RequestOptions.create()
@@ -238,6 +244,8 @@ default APIResponse get(String url) {
238244
* response. The method will populate request cookies from the context and update context cookies from the response. The
239245
* method will automatically follow redirects.
240246
*
247+
* <p> **Usage**
248+
*
241249
* <p> Request parameters can be configured with {@code params} option, they will be serialized into the URL search parameters:
242250
* <pre>{@code
243251
* request.get("https://example.com/api/getText", RequestOptions.create()
@@ -292,6 +300,8 @@ default APIResponse patch(String url) {
292300
* response. The method will populate request cookies from the context and update context cookies from the response. The
293301
* method will automatically follow redirects.
294302
*
303+
* <p> **Usage**
304+
*
295305
* <p> JSON objects can be passed directly to the request:
296306
* <pre>{@code
297307
* Map<String, Object> data = new HashMap();
@@ -335,6 +345,8 @@ default APIResponse post(String url) {
335345
* response. The method will populate request cookies from the context and update context cookies from the response. The
336346
* method will automatically follow redirects.
337347
*
348+
* <p> **Usage**
349+
*
338350
* <p> JSON objects can be passed directly to the request:
339351
* <pre>{@code
340352
* Map<String, Object> data = new HashMap();

0 commit comments

Comments
 (0)