Skip to content

Commit 1e8a443

Browse files
authored
Merge branch 'trunk' into server
2 parents 1597e03 + d8b02c6 commit 1e8a443

File tree

24 files changed

+612
-286
lines changed

24 files changed

+612
-286
lines changed

.github/workflows/ci-python.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
run: |
2929
python -m pip install --upgrade pip
3030
pip install tox==4.25.0
31-
- name: Test with tox
31+
- name: Generate docs
3232
run: tox -c py/tox.ini
3333
env:
3434
TOXENV: docs
@@ -48,10 +48,9 @@ jobs:
4848
run: |
4949
python -m pip install --upgrade pip
5050
pip install tox==4.25.0
51-
- name: Test with tox
51+
- name: Run type checking
5252
run: |
53-
tox -c py/tox.ini -- --cobertura-xml-report ci || true
54-
bash <(curl -s https://codecov.io/bash) -f py/ci/cobertura.xml
53+
tox -c py/tox.ini || true
5554
env:
5655
TOXENV: mypy
5756

common/repositories.bzl

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ def pin_browsers():
1111

1212
http_archive(
1313
name = "linux_firefox",
14-
url = "https://ftp.mozilla.org/pub/firefox/releases/139.0.1/linux-x86_64/en-US/firefox-139.0.1.tar.xz",
15-
sha256 = "f1a264f61d41700e8fcfa2310478d0c909655399a413072664fddaf612b53c07",
14+
url = "https://ftp.mozilla.org/pub/firefox/releases/139.0.4/linux-x86_64/en-US/firefox-139.0.4.tar.xz",
15+
sha256 = "fe22686f09a0c46390fea430b26cccc323d92af26869699f394f25b5e71527a3",
1616
build_file_content = """
1717
load("@aspect_rules_js//js:defs.bzl", "js_library")
1818
package(default_visibility = ["//visibility:public"])
@@ -33,8 +33,8 @@ js_library(
3333

3434
dmg_archive(
3535
name = "mac_firefox",
36-
url = "https://ftp.mozilla.org/pub/firefox/releases/139.0.1/mac/en-US/Firefox%20139.0.1.dmg",
37-
sha256 = "243478e2a2fd5d9dd0cc261c812b0146e433d703fec960c27c7284b2de7e65bc",
36+
url = "https://ftp.mozilla.org/pub/firefox/releases/139.0.4/mac/en-US/Firefox%20139.0.4.dmg",
37+
sha256 = "fc058bf34094828c0919ad81672d697cf01dfa291ba9b11e0b1c119588878405",
3838
build_file_content = """
3939
load("@aspect_rules_js//js:defs.bzl", "js_library")
4040
package(default_visibility = ["//visibility:public"])
@@ -50,8 +50,8 @@ js_library(
5050

5151
http_archive(
5252
name = "linux_beta_firefox",
53-
url = "https://ftp.mozilla.org/pub/firefox/releases/140.0b4/linux-x86_64/en-US/firefox-140.0b4.tar.xz",
54-
sha256 = "40820674c78e05b1413458c2844e874c8521670780fdb4489e62379a42fba704",
53+
url = "https://ftp.mozilla.org/pub/firefox/releases/140.0b8/linux-x86_64/en-US/firefox-140.0b8.tar.xz",
54+
sha256 = "1fa8bcb1e242ffbad091b3ee7067ece582d34508db394e656832ab07b058e96e",
5555
build_file_content = """
5656
load("@aspect_rules_js//js:defs.bzl", "js_library")
5757
package(default_visibility = ["//visibility:public"])
@@ -72,8 +72,8 @@ js_library(
7272

7373
dmg_archive(
7474
name = "mac_beta_firefox",
75-
url = "https://ftp.mozilla.org/pub/firefox/releases/140.0b4/mac/en-US/Firefox%20140.0b4.dmg",
76-
sha256 = "dce036c33d4749910cc2d87ce4c6786f7538a83dfe22f1ae1f9bfd17d4a23523",
75+
url = "https://ftp.mozilla.org/pub/firefox/releases/140.0b8/mac/en-US/Firefox%20140.0b8.dmg",
76+
sha256 = "7e648f5e0305a6abedb698ea5b29971cd1eb58225b998baa85a82d94bcf75342",
7777
build_file_content = """
7878
load("@aspect_rules_js//js:defs.bzl", "js_library")
7979
package(default_visibility = ["//visibility:public"])
@@ -123,10 +123,10 @@ js_library(
123123

124124
pkg_archive(
125125
name = "mac_edge",
126-
url = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/1b7ce123-70b7-486d-a381-9e418df1feb8/MicrosoftEdge-137.0.3296.62.pkg",
127-
sha256 = "e2c537663569fc81ff14f3278495e071e7b1e5d8c759b7bcf17f7d807403f957",
126+
url = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/881a4aef-792c-4d81-a76f-3cf546510d68/MicrosoftEdge-137.0.3296.68.pkg",
127+
sha256 = "4de62ee93ba67db666597807fc991e749f073af07a577dfdfc56dbf19409c87d",
128128
move = {
129-
"MicrosoftEdge-137.0.3296.62.pkg/Payload/Microsoft Edge.app": "Edge.app",
129+
"MicrosoftEdge-137.0.3296.68.pkg/Payload/Microsoft Edge.app": "Edge.app",
130130
},
131131
build_file_content = """
132132
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -143,8 +143,8 @@ js_library(
143143

144144
deb_archive(
145145
name = "linux_edge",
146-
url = "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_137.0.3296.62-1_amd64.deb",
147-
sha256 = "f5f1e57029fb8f85baa5441e9a45aeeb7aa6a6f3759d3c458c1b15297ed115bc",
146+
url = "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_137.0.3296.68-1_amd64.deb",
147+
sha256 = "76099017ace977c74060aa134a289d93c554e9d67f6561039580fdd483da0c41",
148148
build_file_content = """
149149
load("@aspect_rules_js//js:defs.bzl", "js_library")
150150
package(default_visibility = ["//visibility:public"])
@@ -165,8 +165,8 @@ js_library(
165165

166166
http_archive(
167167
name = "linux_edgedriver",
168-
url = "https://msedgedriver.azureedge.net/137.0.3296.58/edgedriver_linux64.zip",
169-
sha256 = "5e6872dcd8736b4fd208bfe18ae29d87dbda1f293932e0ae523c0f9449b98c18",
168+
url = "https://msedgedriver.azureedge.net/137.0.3296.68/edgedriver_linux64.zip",
169+
sha256 = "0605ae9e651befd470826ff3c3baf74b3d40599c25f1edd60b09d10f5b97144a",
170170
build_file_content = """
171171
load("@aspect_rules_js//js:defs.bzl", "js_library")
172172
package(default_visibility = ["//visibility:public"])
@@ -182,8 +182,8 @@ js_library(
182182

183183
http_archive(
184184
name = "mac_edgedriver",
185-
url = "https://msedgedriver.azureedge.net/137.0.3296.58/edgedriver_mac64.zip",
186-
sha256 = "4dcc5e8537c49746ed1f35bf105946f25a2f0daf7eda68018b0360ae4ec33071",
185+
url = "https://msedgedriver.azureedge.net/137.0.3296.68/edgedriver_mac64.zip",
186+
sha256 = "29b331d365361f0e9ef68c2e573f33ca895b3fa607823a66de9d6f226dbe4a54",
187187
build_file_content = """
188188
load("@aspect_rules_js//js:defs.bzl", "js_library")
189189
package(default_visibility = ["//visibility:public"])
@@ -199,8 +199,8 @@ js_library(
199199

200200
http_archive(
201201
name = "linux_chrome",
202-
url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.68/linux64/chrome-linux64.zip",
203-
sha256 = "5e92980724bb8577964d6914a6faa8021ff9b640944673e9b5fcb6eccfc16c8e",
202+
url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.70/linux64/chrome-linux64.zip",
203+
sha256 = "da1424d975dbe963b0a7f7f8e8c2e477bfed6b3430a2bc0b287f1c247ec62ee3",
204204
build_file_content = """
205205
load("@aspect_rules_js//js:defs.bzl", "js_library")
206206
package(default_visibility = ["//visibility:public"])
@@ -221,8 +221,8 @@ js_library(
221221

222222
http_archive(
223223
name = "mac_chrome",
224-
url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.68/mac-x64/chrome-mac-x64.zip",
225-
sha256 = "d15327182bee2493286f5f0c526ab6efb7888944d6714ffba5b67997e6c1af93",
224+
url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.70/mac-x64/chrome-mac-x64.zip",
225+
sha256 = "2ea79a9457dbaffae6fbdf592c93776ac859dca98b448f7513cdd68234454a07",
226226
strip_prefix = "chrome-mac-x64",
227227
patch_cmds = [
228228
"mv 'Google Chrome for Testing.app' Chrome.app",
@@ -243,8 +243,8 @@ js_library(
243243

244244
http_archive(
245245
name = "linux_chromedriver",
246-
url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.68/linux64/chromedriver-linux64.zip",
247-
sha256 = "05e356b3dd497a26f5e3412c67b59976853458f1b3aa5b2b9f606cecdf922586",
246+
url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.70/linux64/chromedriver-linux64.zip",
247+
sha256 = "cade69e8d67f4951049e56d796111755e0bf9240d26378975a95c8423bb3f55a",
248248
strip_prefix = "chromedriver-linux64",
249249
build_file_content = """
250250
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -261,8 +261,8 @@ js_library(
261261

262262
http_archive(
263263
name = "mac_chromedriver",
264-
url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.68/mac-x64/chromedriver-mac-x64.zip",
265-
sha256 = "f369406a48ca98edfc1845e3900be039ab4c93deabe941288514bb402631a5c1",
264+
url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.70/mac-x64/chromedriver-mac-x64.zip",
265+
sha256 = "d80825e87543d99ad7a8b9356fb236ddb7df3ba087f8f314991195da27a7ccc3",
266266
strip_prefix = "chromedriver-mac-x64",
267267
build_file_content = """
268268
load("@aspect_rules_js//js:defs.bzl", "js_library")

java/src/org/openqa/selenium/HasDownloads.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,23 @@ public interface HasDownloads {
3333
* @throws WebDriverException if capability to enable downloads is not set
3434
*/
3535
default void requireDownloadsEnabled(Capabilities capabilities) {
36-
boolean downloadsEnabled = capabilities.is("se:downloadsEnabled");
37-
if (!downloadsEnabled) {
36+
if (!isDownloadsEnabled(capabilities)) {
3837
throw new WebDriverException(
3938
"You must enable downloads in order to work with downloadable files.");
4039
}
4140
}
4241

42+
/**
43+
* Checks if downloads are enabled
44+
*
45+
* @return true if this webdriver has capability "se:downloadsEnabled" = true
46+
*/
47+
boolean isDownloadsEnabled();
48+
49+
static boolean isDownloadsEnabled(Capabilities capabilities) {
50+
return capabilities.is("se:downloadsEnabled");
51+
}
52+
4353
/**
4454
* Gets the downloadable files.
4555
*

java/src/org/openqa/selenium/grid/data/DefaultSlotMatcher.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
package org.openqa.selenium.grid.data;
1919

20+
import static org.openqa.selenium.remote.CapabilityType.ENABLE_DOWNLOADS;
21+
2022
import java.io.Serializable;
2123
import java.util.Arrays;
2224
import java.util.List;
@@ -129,13 +131,13 @@ private Boolean initialMatch(Capabilities stereotype, Capabilities capabilities)
129131

130132
private Boolean managedDownloadsEnabled(Capabilities stereotype, Capabilities capabilities) {
131133
// First lets check if user wanted a Node with managed downloads enabled
132-
Object raw = capabilities.getCapability("se:downloadsEnabled");
134+
Object raw = capabilities.getCapability(ENABLE_DOWNLOADS);
133135
if (raw == null || !Boolean.parseBoolean(raw.toString())) {
134136
// User didn't ask. So lets move on to the next matching criteria
135137
return true;
136138
}
137139
// User wants managed downloads enabled to be done on this Node, let's check the stereotype
138-
raw = stereotype.getCapability("se:downloadsEnabled");
140+
raw = stereotype.getCapability(ENABLE_DOWNLOADS);
139141
// Try to match what the user requested
140142
return raw != null && Boolean.parseBoolean(raw.toString());
141143
}

java/src/org/openqa/selenium/grid/node/config/NodeOptions.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
package org.openqa.selenium.grid.node.config;
1919

20+
import static org.openqa.selenium.remote.CapabilityType.ENABLE_DOWNLOADS;
21+
2022
import com.google.common.annotations.VisibleForTesting;
2123
import com.google.common.collect.HashMultimap;
2224
import com.google.common.collect.ImmutableMap;
@@ -749,8 +751,7 @@ public Capabilities enhanceStereotype(Capabilities capabilities) {
749751
.setCapability("se:noVncPort", noVncPort());
750752
}
751753
if (isManagedDownloadsEnabled() && canConfigureDownloadsDir(capabilities)) {
752-
capabilities =
753-
new PersistentCapabilities(capabilities).setCapability("se:downloadsEnabled", true);
754+
capabilities = new PersistentCapabilities(capabilities).setCapability(ENABLE_DOWNLOADS, true);
754755
}
755756
return capabilities;
756757
}

java/src/org/openqa/selenium/grid/node/local/LocalNode.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import static org.openqa.selenium.grid.data.Availability.DRAINING;
2424
import static org.openqa.selenium.grid.data.Availability.UP;
2525
import static org.openqa.selenium.grid.node.CapabilityResponseEncoder.getEncoder;
26+
import static org.openqa.selenium.remote.CapabilityType.ENABLE_DOWNLOADS;
2627
import static org.openqa.selenium.remote.HttpSessionId.getSessionId;
2728
import static org.openqa.selenium.remote.RemoteTags.CAPABILITIES;
2829
import static org.openqa.selenium.remote.RemoteTags.SESSION_ID;
@@ -575,7 +576,7 @@ public Either<WebDriverException, CreateSessionResponse> newSession(
575576
}
576577

577578
private boolean managedDownloadsRequested(Capabilities capabilities) {
578-
Object downloadsEnabled = capabilities.getCapability("se:downloadsEnabled");
579+
Object downloadsEnabled = capabilities.getCapability(ENABLE_DOWNLOADS);
579580
return managedDownloadsEnabled
580581
&& downloadsEnabled != null
581582
&& Boolean.parseBoolean(downloadsEnabled.toString());

java/src/org/openqa/selenium/remote/RemoteWebDriver.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,11 @@ public void removeVirtualAuthenticator(VirtualAuthenticator authenticator) {
649649
Map.of("authenticatorId", authenticator.getId()));
650650
}
651651

652+
@Override
653+
public boolean isDownloadsEnabled() {
654+
return HasDownloads.isDownloadsEnabled(capabilities);
655+
}
656+
652657
/**
653658
* Retrieves the names of the downloadable files.
654659
*

java/test/org/openqa/selenium/chrome/ChromeOptionsTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import static org.openqa.selenium.chromium.ChromiumDriverLogLevel.OFF;
2828
import static org.openqa.selenium.chromium.ChromiumDriverLogLevel.SEVERE;
2929
import static org.openqa.selenium.remote.CapabilityType.ACCEPT_INSECURE_CERTS;
30+
import static org.openqa.selenium.remote.CapabilityType.ENABLE_DOWNLOADS;
3031
import static org.openqa.selenium.remote.CapabilityType.TIMEOUTS;
3132

3233
import java.io.File;
@@ -98,7 +99,7 @@ void canAddW3CCompliantOptions() {
9899
assertThat(mappedOptions.get("acceptInsecureCerts")).isEqualTo(true);
99100
assertThat(mappedOptions.get("pageLoadStrategy")).hasToString("eager");
100101
assertThat(mappedOptions.get("strictFileInteractability")).isEqualTo(true);
101-
assertThat(mappedOptions.get("se:downloadsEnabled")).isEqualTo(true);
102+
assertThat(mappedOptions.get(ENABLE_DOWNLOADS)).isEqualTo(true);
102103

103104
Map<String, Long> expectedTimeouts = new HashMap<>();
104105
expectedTimeouts.put("implicit", 1000L);
@@ -239,7 +240,8 @@ void mergingOptionsWithMutableCapabilities() {
239240

240241
MutableCapabilities one = new MutableCapabilities();
241242

242-
ChromeOptions options = new ChromeOptions();
243+
org.openqa.selenium.chrome.ChromeOptions options =
244+
new org.openqa.selenium.chrome.ChromeOptions();
243245
options.addArguments("verbose");
244246
options.addArguments("silent");
245247
options.setExperimentalOption("opt1", "val1");

java/test/org/openqa/selenium/grid/data/DefaultSlotMatcherTest.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.openqa.selenium.grid.data;
1919

2020
import static org.assertj.core.api.Assertions.assertThat;
21+
import static org.openqa.selenium.remote.CapabilityType.ENABLE_DOWNLOADS;
2122

2223
import org.junit.jupiter.api.Test;
2324
import org.openqa.selenium.Capabilities;
@@ -198,15 +199,15 @@ void fullMatchExtensionCaps() {
198199
"firefox",
199200
CapabilityType.PLATFORM_NAME,
200201
Platform.WINDOWS,
201-
"se:downloadsEnabled",
202+
ENABLE_DOWNLOADS,
202203
true);
203204
Capabilities capabilities =
204205
new ImmutableCapabilities(
205206
CapabilityType.BROWSER_NAME,
206207
"firefox",
207208
CapabilityType.PLATFORM_NAME,
208209
Platform.WINDOWS,
209-
"se:downloadsEnabled",
210+
ENABLE_DOWNLOADS,
210211
true);
211212
assertThat(slotMatcher.matches(stereotype, capabilities)).isTrue();
212213
}
@@ -307,29 +308,25 @@ void matchesBrowser() {
307308
@Test
308309
void matchDownloadsForRegularTestMatchingAgainstADownloadAwareNode() {
309310
Capabilities stereotype =
310-
new ImmutableCapabilities(
311-
CapabilityType.BROWSER_NAME, "chrome", "se:downloadsEnabled", true);
311+
new ImmutableCapabilities(CapabilityType.BROWSER_NAME, "chrome", ENABLE_DOWNLOADS, true);
312312
Capabilities capabilities = new ImmutableCapabilities(CapabilityType.BROWSER_NAME, "chrome");
313313
assertThat(slotMatcher.matches(stereotype, capabilities)).isTrue();
314314
}
315315

316316
@Test
317317
void matchDownloadsForAutoDownloadTestMatchingAgainstADownloadAwareNode() {
318318
Capabilities stereotype =
319-
new ImmutableCapabilities(
320-
CapabilityType.BROWSER_NAME, "chrome", "se:downloadsEnabled", true);
319+
new ImmutableCapabilities(CapabilityType.BROWSER_NAME, "chrome", ENABLE_DOWNLOADS, true);
321320
Capabilities capabilities =
322-
new ImmutableCapabilities(
323-
CapabilityType.BROWSER_NAME, "chrome", "se:downloadsEnabled", true);
321+
new ImmutableCapabilities(CapabilityType.BROWSER_NAME, "chrome", ENABLE_DOWNLOADS, true);
324322
assertThat(slotMatcher.matches(stereotype, capabilities)).isTrue();
325323
}
326324

327325
@Test
328326
void ensureNoMatchFOrDownloadAwareTestMatchingAgainstOrdinaryNode() {
329327
Capabilities stereotype = new ImmutableCapabilities(CapabilityType.BROWSER_NAME, "chrome");
330328
Capabilities capabilities =
331-
new ImmutableCapabilities(
332-
CapabilityType.BROWSER_NAME, "chrome", "se:downloadsEnabled", true);
329+
new ImmutableCapabilities(CapabilityType.BROWSER_NAME, "chrome", ENABLE_DOWNLOADS, true);
333330
assertThat(slotMatcher.matches(stereotype, capabilities)).isFalse();
334331
}
335332

java/test/org/openqa/selenium/grid/node/NodeTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import static org.assertj.core.api.Assertions.assertThatThrownBy;
2525
import static org.assertj.core.api.InstanceOfAssertFactories.MAP;
2626
import static org.openqa.selenium.json.Json.MAP_TYPE;
27+
import static org.openqa.selenium.remote.CapabilityType.ENABLE_DOWNLOADS;
2728
import static org.openqa.selenium.remote.http.Contents.string;
2829
import static org.openqa.selenium.remote.http.HttpMethod.DELETE;
2930
import static org.openqa.selenium.remote.http.HttpMethod.GET;
@@ -124,8 +125,8 @@ public void setUp(TestInfo testInfo) throws URISyntaxException {
124125
stereotype = new ImmutableCapabilities("browserName", "cheese");
125126
caps = new ImmutableCapabilities("browserName", "cheese");
126127
if (isDownloadsTestCase) {
127-
stereotype = new ImmutableCapabilities("browserName", "chrome", "se:downloadsEnabled", true);
128-
caps = new ImmutableCapabilities("browserName", "chrome", "se:downloadsEnabled", true);
128+
stereotype = new ImmutableCapabilities("browserName", "chrome", ENABLE_DOWNLOADS, true);
129+
caps = new ImmutableCapabilities("browserName", "chrome", ENABLE_DOWNLOADS, true);
129130
}
130131

131132
uri = new URI("http://localhost:1234");

0 commit comments

Comments
 (0)