Search in sources :

Example 16 with Proxy

use of org.openqa.selenium.Proxy in project jmeter-plugins by undera.

the class WebDriverConfigTest method shouldDelegateToProxyFactoryWhenCreatingManualProxyWithHttpAsDefault.

@Test
public void shouldDelegateToProxyFactoryWhenCreatingManualProxyWithHttpAsDefault() {
    final ProxyHostPort http = new ProxyHostPort("http", 1);
    final String noProxy = "host1, host2";
    config.setHttpHost(http.getHost());
    config.setHttpPort(http.getPort());
    config.setUseHttpSettingsForAllProtocols(true);
    config.setNoProxyHost(noProxy);
    when(proxyFactory.getManualProxy(http, http, http, http, noProxy)).thenReturn(new Proxy());
    config.setProxyType(ProxyType.MANUAL);
    Proxy proxy = config.createProxy();
    assertThat(proxy, is(notNullValue()));
    verify(proxyFactory, times(1)).getManualProxy(http, http, http, http, noProxy);
}
Also used : Proxy(org.openqa.selenium.Proxy) ProxyHostPort(com.googlecode.jmeter.plugins.webdriver.proxy.ProxyHostPort) Test(org.junit.Test)

Example 17 with Proxy

use of org.openqa.selenium.Proxy in project jmeter-plugins by undera.

the class WebDriverConfigTest method shouldDelegateToProxyFactoryWhenCreatingSystemProxy.

@Test
public void shouldDelegateToProxyFactoryWhenCreatingSystemProxy() {
    when(proxyFactory.getSystemProxy()).thenReturn(new Proxy());
    config.setProxyType(ProxyType.SYSTEM);
    Proxy proxy = config.createProxy();
    assertThat(proxy, is(notNullValue()));
    verify(proxyFactory, times(1)).getSystemProxy();
}
Also used : Proxy(org.openqa.selenium.Proxy) Test(org.junit.Test)

Example 18 with Proxy

use of org.openqa.selenium.Proxy in project jmeter-plugins by undera.

the class WebDriverConfigTest method shouldDelegateToProxyFactoryWhenCreatingProxyPacProxy.

@Test
public void shouldDelegateToProxyFactoryWhenCreatingProxyPacProxy() throws MalformedURLException {
    String url = "http://proxy/pac.url";
    when(proxyFactory.getConfigUrlProxy(url)).thenReturn(new Proxy());
    config.setProxyPacUrl(url);
    config.setProxyType(ProxyType.PROXY_PAC);
    Proxy proxy = config.createProxy();
    assertThat(proxy, is(notNullValue()));
    verify(proxyFactory, times(1)).getConfigUrlProxy(Mockito.isA(String.class));
}
Also used : Proxy(org.openqa.selenium.Proxy) Test(org.junit.Test)

Example 19 with Proxy

use of org.openqa.selenium.Proxy in project jmeter-plugins by undera.

the class WebDriverConfigTest method shouldDelegateToProxyFactoryWhenCreatingAutoDetectProxy.

@Test
public void shouldDelegateToProxyFactoryWhenCreatingAutoDetectProxy() {
    when(proxyFactory.getAutodetectProxy()).thenReturn(new Proxy());
    config.setProxyType(ProxyType.AUTO_DETECT);
    Proxy proxy = config.createProxy();
    assertThat(proxy, is(notNullValue()));
    verify(proxyFactory, times(1)).getAutodetectProxy();
}
Also used : Proxy(org.openqa.selenium.Proxy) Test(org.junit.Test)

Example 20 with Proxy

use of org.openqa.selenium.Proxy in project jmeter-plugins by undera.

the class WebDriverConfigTest method shouldDelegateToProxyFactoryWhenCreatingManualProxyWithAllValuesSpecified.

@Test
public void shouldDelegateToProxyFactoryWhenCreatingManualProxyWithAllValuesSpecified() {
    final ProxyHostPort http = new ProxyHostPort("http", 1);
    final ProxyHostPort https = new ProxyHostPort("https", 2);
    final ProxyHostPort ftp = new ProxyHostPort("ftp", 3);
    final ProxyHostPort socks = new ProxyHostPort("socks", 4);
    final String noProxy = "host1, host2";
    config.setHttpHost(http.getHost());
    config.setHttpPort(http.getPort());
    config.setUseHttpSettingsForAllProtocols(false);
    config.setHttpsHost(https.getHost());
    config.setHttpsPort(https.getPort());
    config.setFtpHost(ftp.getHost());
    config.setFtpPort(ftp.getPort());
    config.setSocksHost(socks.getHost());
    config.setSocksPort(socks.getPort());
    config.setNoProxyHost(noProxy);
    when(proxyFactory.getManualProxy(http, https, ftp, socks, noProxy)).thenReturn(new Proxy());
    config.setProxyType(ProxyType.MANUAL);
    Proxy proxy = config.createProxy();
    assertThat(proxy, is(notNullValue()));
    verify(proxyFactory, times(1)).getManualProxy(http, https, ftp, socks, noProxy);
}
Also used : Proxy(org.openqa.selenium.Proxy) ProxyHostPort(com.googlecode.jmeter.plugins.webdriver.proxy.ProxyHostPort) Test(org.junit.Test)

Aggregations

Proxy (org.openqa.selenium.Proxy)28 Test (org.junit.Test)11 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)6 BrowserMobProxy (net.lightbody.bmp.BrowserMobProxy)4 File (java.io.File)3 BrowserMobProxyServer (net.lightbody.bmp.BrowserMobProxyServer)3 ProxyHostPort (com.googlecode.jmeter.plugins.webdriver.proxy.ProxyHostPort)2 SystemProxy (com.qaprosoft.carina.proxy.SystemProxy)2 UnsupportedBrowserException (ru.sbtqa.tag.pagefactory.exceptions.UnsupportedBrowserException)2 TestSetup (com.coveros.selenified.utilities.TestSetup)1 BrowserVersion (com.gargoylesoftware.htmlunit.BrowserVersion)1 WebClient (com.gargoylesoftware.htmlunit.WebClient)1 Application (com.github.noraui.application.Application)1 FileServer (com.github.timurstrekalov.saga.core.FileServer)1 InstanceFieldPerPropertyConfig (com.github.timurstrekalov.saga.core.cfg.InstanceFieldPerPropertyConfig)1 InstrumentingProxyServer (com.github.timurstrekalov.saga.core.server.InstrumentingProxyServer)1 BrowserMobProxySupplier (com.hribol.automation.core.suppliers.BrowserMobProxySupplier)1 DesiredCapabilitiesSupplier (com.hribol.automation.core.suppliers.DesiredCapabilitiesSupplier)1 SeleniumProxySupplier (com.hribol.automation.core.suppliers.SeleniumProxySupplier)1 NetworkTrafficInterceptor (com.wikia.webdriver.common.core.networktrafficinterceptor.NetworkTrafficInterceptor)1