Skip to content

Commit 48d7679

Browse files
authored
Merge branch 'trunk' into FixError15697-2-pal
2 parents 4080d29 + f86a747 commit 48d7679

File tree

13 files changed

+57
-36
lines changed

13 files changed

+57
-36
lines changed

common/repositories.bzl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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.0b5/linux-x86_64/en-US/firefox-140.0b5.tar.xz",
54+
sha256 = "c3a9510169f3c4dae1595cd5da18332ef333ec99f309d2450b4f5718b68c321a",
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.0b5/mac/en-US/Firefox%20140.0b5.dmg",
76+
sha256 = "795fdcf2076aef760b0276620ad8c0a3357737574e8a5a99bc0c44fdd3c5c90a",
7777
build_file_content = """
7878
load("@aspect_rules_js//js:defs.bzl", "js_library")
7979
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.62/edgedriver_linux64.zip",
169+
sha256 = "9857afcbc78f94cd68ddae1f12f2a77687a4216fbcac78571580ef8a8f09f924",
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.62/edgedriver_mac64.zip",
186+
sha256 = "eb26a678e9fd90142fe23b528b9f2a2bb821c8005bbd95e686c26b525ce0b6bc",
187187
build_file_content = """
188188
load("@aspect_rules_js//js:defs.bzl", "js_library")
189189
package(default_visibility = ["//visibility:public"])

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");

java/test/org/openqa/selenium/grid/node/config/NodeOptionsTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import static org.junit.jupiter.api.Assertions.fail;
2727
import static org.junit.jupiter.api.Assumptions.assumeFalse;
2828
import static org.junit.jupiter.api.Assumptions.assumeTrue;
29+
import static org.openqa.selenium.remote.CapabilityType.ENABLE_DOWNLOADS;
2930

3031
import com.google.common.collect.ImmutableMap;
3132
import java.io.StringReader;
@@ -156,7 +157,7 @@ boolean isDownloadEnabled(WebDriverInfo driver, String customMsg) {
156157
.filter(caps -> expected.equalsIgnoreCase(caps.getBrowserName()))
157158
.findFirst()
158159
.orElseThrow(() -> new AssertionError("Unable to find " + customMsg + " info"));
159-
return Optional.ofNullable(found.getCapability("se:downloadsEnabled"))
160+
return Optional.ofNullable(found.getCapability(ENABLE_DOWNLOADS))
160161
.map(value -> Boolean.parseBoolean(value.toString()))
161162
.orElse(Boolean.FALSE);
162163
}

0 commit comments

Comments
 (0)