Skip to content

Commit

Permalink
Set default IEOptions when creating from existing Capabilities
Browse files Browse the repository at this point in the history
When doing something like `new IEOptions(capabilities)`, if
the capabilities given did not have `se:ieOptions`, these would
not be set, causing us to serialise incorrectly to a map.

Closes SeleniumHQ#6499
  • Loading branch information
shs96c committed Oct 17, 2018
1 parent a0d2b9c commit c731a53
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public InternetExplorerOptions() {
}

public InternetExplorerOptions(Capabilities source) {
super();
this();

merge(source);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.openqa.selenium.ie.InternetExplorerDriver.INITIAL_BROWSER_URL;
import static org.openqa.selenium.ie.InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS;
import static org.openqa.selenium.ie.InternetExplorerOptions.IE_OPTIONS;

import org.junit.Test;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.ImmutableCapabilities;
import org.openqa.selenium.Platform;
import org.openqa.selenium.json.Json;
import org.openqa.selenium.remote.DesiredCapabilities;

import java.util.Map;

Expand Down Expand Up @@ -94,4 +97,17 @@ public void shouldSurviveASerializationRoundTrip() {

assertThat(freshOptions).isEqualTo(options);
}

@Test
public void shouldSetIeOptionsCapabilityWhenConstructedFromExistingCapabilities() {
InternetExplorerOptions expected = new InternetExplorerOptions();
expected.setCapability("requireWindowFocus", true);

DesiredCapabilities desiredCapabilities = new DesiredCapabilities().internetExplorer();
desiredCapabilities.setPlatform(Platform.WINDOWS);
InternetExplorerOptions seen = new InternetExplorerOptions(desiredCapabilities);
seen.setCapability("requireWindowFocus", true);

assertThat(seen.getCapability(IE_OPTIONS)).isEqualTo(expected.getCapability(IE_OPTIONS));
}
}

0 comments on commit c731a53

Please sign in to comment.