Skip to content

Commit

Permalink
[java] Adding a test for noProxy
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed May 9, 2018
1 parent bd1ae59 commit d42e6ac
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion java/client/src/org/openqa/selenium/Proxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public String getNoProxy() {
/**
* Sets proxy bypass (noproxy) addresses
*
* @param noProxy The proxy bypass (noproxy) addresses
* @param noProxy The proxy bypass (noproxy) addresses separated by commas
* @return reference to self
*/
public Proxy setNoProxy(String noProxy) {
Expand Down
19 changes: 19 additions & 0 deletions java/client/test/org/openqa/selenium/ProxySettingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.openqa.selenium;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.openqa.selenium.remote.CapabilityType.PROXY;
import static org.openqa.selenium.testing.Driver.SAFARI;
Expand Down Expand Up @@ -86,6 +87,24 @@ public void canConfigureManualHttpProxy() {
assertTrue("Proxy should have been called", proxyServer.hasBeenCalled("simpleTest.html"));
}

@Test
@Ignore(SAFARI)
@NeedsLocalEnvironment
public void canConfigureNoProxy() {
Proxy proxyToUse = proxyServer.asProxy();
proxyToUse.setNoProxy("localhost, 127.0.0.*");
Capabilities caps = new ImmutableCapabilities(PROXY, proxyToUse);

WebDriver driver = new WebDriverBuilder().get(caps);
registerDriverTeardown(driver);

driver.get(appServer.whereIs("simpleTest.html"));
assertFalse("Proxy should not have been called", proxyServer.hasBeenCalled("simpleTest.html"));

driver.get(appServer.whereElseIs("simpleTest.html"));
assertTrue("Proxy should have been called", proxyServer.hasBeenCalled("simpleTest.html"));
}

@Test
@Ignore(SAFARI)
@NeedsLocalEnvironment
Expand Down

0 comments on commit d42e6ac

Please sign in to comment.