Skip to content

Commit

Permalink
[java] remove requiredCapabilities from metadata ignored list
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Jan 5, 2024
1 parent b74d940 commit b5ae3f8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
3 changes: 1 addition & 2 deletions java/src/org/openqa/selenium/remote/NewSessionPayload.java
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,7 @@ public Set<Dialect> getDownstreamDialects() {
}

public Map<String, Object> getMetadata() {
Set<String> ignoredMetadataKeys =
Set.of("capabilities", "requiredCapabilities");
Set<String> ignoredMetadataKeys = Set.of("capabilities");

try (Reader reader =
new InputStreamReader(backingStore.asByteSource().openBufferedStream(), UTF_8);
Expand Down
21 changes: 1 addition & 20 deletions java/test/org/openqa/selenium/remote/NewSessionPayloadTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.openqa.selenium.json.Json.MAP_TYPE;

import com.google.common.collect.ImmutableMap;
Expand Down Expand Up @@ -196,23 +195,6 @@ void forwardsMetaDataAssociatedWithARequest() throws IOException {
}
}

@Test
void doesNotForwardRequiredCapabilitiesAsTheseAreVeryLegacy() throws IOException {
try (NewSessionPayload payload =
NewSessionPayload.create(
ImmutableMap.of(
"capabilities",
EMPTY_MAP,
"requiredCapabilities",
singletonMap("key", "so it's not empty")))) {
StringBuilder toParse = new StringBuilder();
payload.writeTo(toParse);
Map<String, Object> seen = new Json().toType(toParse.toString(), MAP_TYPE);

assertNull(seen.get("requiredCapabilities"));
}
}

@Test
void shouldPreserveMetadata() throws IOException {
Map<String, Object> raw =
Expand Down Expand Up @@ -263,8 +245,7 @@ void nullValuesInMetaDataAreIgnored() {
void keysUsedForStoringCapabilitiesAreIgnoredFromMetadata() {
Map<String, Object> raw =
ImmutableMap.of(
"capabilities", singletonMap("alwaysMatch", singletonMap("browserName", "cheese")),
"desiredCapabilities", emptyMap());
"capabilities", singletonMap("alwaysMatch", singletonMap("browserName", "cheese")));

try (NewSessionPayload payload = NewSessionPayload.create(raw)) {
Map<String, Object> seen = payload.getMetadata();
Expand Down

0 comments on commit b5ae3f8

Please sign in to comment.