Skip to content

Commit ac7b1e4

Browse files
authored
chore: roll driver v1.10.0 (#360)
1 parent 41735ff commit ac7b1e4

File tree

6 files changed

+76
-36
lines changed

6 files changed

+76
-36
lines changed

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,14 @@ class NewContextOptions {
124124
*/
125125
public Boolean recordHarOmitContent;
126126
/**
127-
* Path on the filesystem to write the HAR file to.
127+
* Enables <a href="http://www.softwareishard.com/blog/har-12-spec">HAR</a> recording for all pages into the specified HAR
128+
* file on the filesystem. If not specified, the HAR is not recorded. Make sure to call {@link BrowserContext#close
129+
* BrowserContext.close()} for the HAR to be saved.
128130
*/
129131
public Path recordHarPath;
130132
/**
131-
* Path to the directory to put videos into.
133+
* Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure
134+
* to call {@link BrowserContext#close BrowserContext.close()} for videos to be saved.
132135
*/
133136
public Path recordVideoDir;
134137
/**
@@ -344,11 +347,14 @@ class NewPageOptions {
344347
*/
345348
public Boolean recordHarOmitContent;
346349
/**
347-
* Path on the filesystem to write the HAR file to.
350+
* Enables <a href="http://www.softwareishard.com/blog/har-12-spec">HAR</a> recording for all pages into the specified HAR
351+
* file on the filesystem. If not specified, the HAR is not recorded. Make sure to call {@link BrowserContext#close
352+
* BrowserContext.close()} for the HAR to be saved.
348353
*/
349354
public Path recordHarPath;
350355
/**
351-
* Path to the directory to put videos into.
356+
* Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure
357+
* to call {@link BrowserContext#close BrowserContext.close()} for videos to be saved.
352358
*/
353359
public Path recordVideoDir;
354360
/**

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

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,9 @@ class LaunchOptions {
6969
*/
7070
public List<String> args;
7171
/**
72-
* Chromium distribution channel, one of
73-
* <ul>
74-
* <li> chrome</li>
75-
* <li> chrome-beta</li>
76-
* <li> chrome-dev</li>
77-
* <li> chrome-canary</li>
78-
* <li> msedge</li>
79-
* <li> msedge-beta</li>
80-
* <li> msedge-dev</li>
81-
* <li> msedge-canary</li>
82-
* </ul>
83-
*/
84-
public String channel;
72+
* Browser distribution channel.
73+
*/
74+
public BrowserChannel channel;
8575
/**
8676
* Enable Chromium sandboxing. Defaults to {@code false}.
8777
*/
@@ -158,7 +148,7 @@ public LaunchOptions setArgs(List<String> args) {
158148
this.args = args;
159149
return this;
160150
}
161-
public LaunchOptions setChannel(String channel) {
151+
public LaunchOptions setChannel(BrowserChannel channel) {
162152
this.channel = channel;
163153
return this;
164154
}
@@ -241,19 +231,9 @@ class LaunchPersistentContextOptions {
241231
*/
242232
public Boolean bypassCSP;
243233
/**
244-
* Chromium distribution channel, one of
245-
* <ul>
246-
* <li> chrome</li>
247-
* <li> chrome-beta</li>
248-
* <li> chrome-dev</li>
249-
* <li> chrome-canary</li>
250-
* <li> msedge</li>
251-
* <li> msedge-beta</li>
252-
* <li> msedge-dev</li>
253-
* <li> msedge-canary</li>
254-
* </ul>
234+
* Browser distribution channel.
255235
*/
256-
public String channel;
236+
public BrowserChannel channel;
257237
/**
258238
* Enable Chromium sandboxing. Defaults to {@code true}.
259239
*/
@@ -365,11 +345,14 @@ class LaunchPersistentContextOptions {
365345
*/
366346
public Boolean recordHarOmitContent;
367347
/**
368-
* Path on the filesystem to write the HAR file to.
348+
* Enables <a href="http://www.softwareishard.com/blog/har-12-spec">HAR</a> recording for all pages into the specified HAR
349+
* file on the filesystem. If not specified, the HAR is not recorded. Make sure to call {@link BrowserContext#close
350+
* BrowserContext.close()} for the HAR to be saved.
369351
*/
370352
public Path recordHarPath;
371353
/**
372-
* Path to the directory to put videos into.
354+
* Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure
355+
* to call {@link BrowserContext#close BrowserContext.close()} for videos to be saved.
373356
*/
374357
public Path recordVideoDir;
375358
/**
@@ -415,7 +398,7 @@ public LaunchPersistentContextOptions setBypassCSP(boolean bypassCSP) {
415398
this.bypassCSP = bypassCSP;
416399
return this;
417400
}
418-
public LaunchPersistentContextOptions setChannel(String channel) {
401+
public LaunchPersistentContextOptions setChannel(BrowserChannel channel) {
419402
this.channel = channel;
420403
return this;
421404
}

playwright/src/main/java/com/microsoft/playwright/impl/Serialization.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ static Gson gson() {
3838
if (gson == null) {
3939
gson = new GsonBuilder()
4040
.registerTypeAdapter(SameSiteAttribute.class, new SameSiteAdapter().nullSafe())
41+
.registerTypeAdapter(BrowserChannel.class, new BrowserChannelSerializer())
4142
.registerTypeAdapter(ColorScheme.class, new ColorSchemeAdapter().nullSafe())
4243
.registerTypeAdapter(Media.class, new MediaSerializer())
4344
.registerTypeAdapter(ScreenshotType.class, new ToLowerCaseSerializer<ScreenshotType>())
@@ -295,6 +296,13 @@ public JsonElement serialize(Map<String, String> src, Type typeOfSrc, JsonSerial
295296
}
296297
}
297298

299+
private static class BrowserChannelSerializer implements JsonSerializer<BrowserChannel> {
300+
@Override
301+
public JsonElement serialize(BrowserChannel src, Type typeOfSrc, JsonSerializationContext context) {
302+
return new JsonPrimitive(src.toString().toLowerCase().replace('_', '-'));
303+
}
304+
}
305+
298306
private static class MediaSerializer implements JsonSerializer<Media> {
299307
@Override
300308
public JsonElement serialize(Media src, Type typeOfSrc, JsonSerializationContext context) {
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.microsoft.playwright.options;
18+
19+
public enum BrowserChannel {
20+
CHROME,
21+
CHROME_BETA,
22+
CHROME_DEV,
23+
CHROME_CANARY,
24+
MSEDGE,
25+
MSEDGE_BETA,
26+
MSEDGE_DEV,
27+
MSEDGE_CANARY
28+
}

playwright/src/test/java/com/microsoft/playwright/TestBase.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.microsoft.playwright;
1818

19+
import com.microsoft.playwright.options.BrowserChannel;
1920
import org.junit.jupiter.api.AfterAll;
2021
import org.junit.jupiter.api.AfterEach;
2122
import org.junit.jupiter.api.BeforeAll;
@@ -53,8 +54,22 @@ static boolean isFirefox() {
5354
return "firefox".equals(getBrowserNameFromEnv());
5455
}
5556

56-
private static String getBrowserChannelFromEnv() {
57-
return System.getenv("BROWSER_CHANNEL");
57+
private static BrowserChannel getBrowserChannelFromEnv() {
58+
String channel = System.getenv("BROWSER_CHANNEL");
59+
if (channel == null) {
60+
return null;
61+
}
62+
switch (channel) {
63+
case "chrome": return BrowserChannel.CHROME;
64+
case "chrome-beta": return BrowserChannel.CHROME_BETA;
65+
case "chrome-dev": return BrowserChannel.CHROME_DEV;
66+
case "chrome-canary": return BrowserChannel.CHROME_CANARY;
67+
case "msedge": return BrowserChannel.MSEDGE;
68+
case "msedge-beta": return BrowserChannel.MSEDGE_BETA;
69+
case "msedge-dev": return BrowserChannel.MSEDGE_DEV;
70+
case "msedge-canary": return BrowserChannel.MSEDGE_CANARY;
71+
default: throw new IllegalArgumentException("Unknown BROWSER_CHANNEL " + channel);
72+
}
5873
}
5974

6075
static BrowserType.LaunchOptions createLaunchOptions() {

scripts/CLI_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.10.0-next-1616100617000
1+
1.10.0

0 commit comments

Comments
 (0)