Skip to content

Commit

Permalink
Deleting more tests related to ancient geckodriver support
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed Jul 11, 2018
1 parent 821c6f3 commit 046ab75
Showing 1 changed file with 0 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,6 @@ public void requestShouldIncludeJsonWireProtocolCapabilities() throws IOExceptio
assertEquals(ImmutableMap.of(), json.get("desiredCapabilities"));
}

@Test
public void requestShouldIncludeOlderGeckoDriverCapabilities() throws IOException {
Map<String, Object> params = ImmutableMap.of("desiredCapabilities", new ImmutableCapabilities());
Command command = new Command(null, DriverCommand.NEW_SESSION, params);

HttpResponse response = new HttpResponse();
response.setStatus(HTTP_OK);
response.setContent(
"{\"value\": {\"sessionId\": \"23456789\", \"capabilities\": {}}}".getBytes(UTF_8));
RecordingHttpClient client = new RecordingHttpClient(response);

new ProtocolHandshake().createSession(client, command);

Map<String, Object> json = getRequestPayloadAsMap(client);
Map<String, Object> capabilities = (Map<String, Object>) json.get("capabilities");

assertEquals(ImmutableMap.of(), capabilities.get("desiredCapabilities"));
}

@Test
public void requestShouldIncludeSpecCompliantW3CCapabilities() throws IOException {
Map<String, Object> params = ImmutableMap.of("desiredCapabilities", new ImmutableCapabilities());
Expand Down Expand Up @@ -127,24 +108,6 @@ public void shouldParseW3CNewSessionResponse() throws IOException {
assertEquals(result.getDialect(), Dialect.W3C);
}

@Test
public void shouldParseOlderW3CNewSessionResponse() throws IOException {
Map<String, Object> params = ImmutableMap.of("desiredCapabilities", new ImmutableCapabilities());
Command command = new Command(null, DriverCommand.NEW_SESSION, params);

HttpResponse response = new HttpResponse();
response.setStatus(HTTP_OK);
// Some drivers (e.g., GeckoDriver 0.15.0) return the capabilities in a key named "value",
// rather than "capabilities"; essentially this is the old Wire Protocol format, wrapped in a
// "value" key.
response.setContent(
"{\"value\": {\"sessionId\": \"23456789\", \"value\": {}}}".getBytes(UTF_8));
RecordingHttpClient client = new RecordingHttpClient(response);

ProtocolHandshake.Result result = new ProtocolHandshake().createSession(client, command);
assertEquals(result.getDialect(), Dialect.W3C);
}

@Test
public void shouldParseWireProtocolNewSessionResponse() throws IOException {
Map<String, Object> params = ImmutableMap.of("desiredCapabilities", new ImmutableCapabilities());
Expand All @@ -160,34 +123,6 @@ public void shouldParseWireProtocolNewSessionResponse() throws IOException {
assertEquals(result.getDialect(), Dialect.OSS);
}

@Test
public void shouldAddBothGeckoDriverAndW3CCapabilitiesToRootCapabilitiesProperty()
throws IOException {
Map<String, Object> params = ImmutableMap.of("desiredCapabilities", new ImmutableCapabilities());
Command command = new Command(null, DriverCommand.NEW_SESSION, params);

HttpResponse response = new HttpResponse();
response.setStatus(HTTP_OK);
response.setContent(
"{\"sessionId\": \"23456789\", \"status\": 0, \"value\": {}}".getBytes(UTF_8));
RecordingHttpClient client = new RecordingHttpClient(response);

new ProtocolHandshake().createSession(client, command);

Map<String, Object> handshakeRequest = getRequestPayloadAsMap(client);

Object rawCaps = handshakeRequest.get("capabilities");
assertTrue(rawCaps instanceof Map);

Map<?, ?> capabilities = (Map<?, ?>) rawCaps;

// GeckoDriver
assertTrue(capabilities.containsKey("desiredCapabilities"));

// W3C
assertFalse(mergeW3C(handshakeRequest).isEmpty());
}

@Test
public void shouldNotIncludeNonProtocolExtensionKeys() throws IOException {
Capabilities caps = new ImmutableCapabilities(
Expand Down

0 comments on commit 046ab75

Please sign in to comment.