Exemplo n.º 1
0
  @Ignore({ANDROID, CHROME, HTMLUNIT, IE, IPHONE, OPERA, OPERA_MOBILE, PHANTOMJS, SAFARI})
  @NeedsLocalEnvironment
  @Test
  public void requiredProxyCapabilityShouldHavePriority() {
    ProxyServer desiredProxyServer = new ProxyServer();
    registerProxyTeardown(desiredProxyServer);

    Proxy desiredProxy = desiredProxyServer.asProxy();
    Proxy requiredProxy = proxyServer.asProxy();

    DesiredCapabilities desiredCaps = new DesiredCapabilities();
    desiredCaps.setCapability(PROXY, desiredProxy);
    DesiredCapabilities requiredCaps = new DesiredCapabilities();
    requiredCaps.setCapability(PROXY, requiredProxy);

    WebDriver driver =
        new WebDriverBuilder()
            .setDesiredCapabilities(desiredCaps)
            .setRequiredCapabilities(requiredCaps)
            .get();
    registerDriverTeardown(driver);

    driver.get(pages.simpleTestPage);

    assertFalse(
        "Desired proxy should not have been called.",
        desiredProxyServer.hasBeenCalled("simpleTest.html"));
    assertTrue(
        "Required proxy should have been called.", proxyServer.hasBeenCalled("simpleTest.html"));
  }
Exemplo n.º 2
0
  @Ignore({ANDROID, CHROME, HTMLUNIT, IE, IPHONE, OPERA, OPERA_MOBILE, PHANTOMJS, SAFARI})
  @NeedsLocalEnvironment
  @Test
  public void canConfigureProxyWithRequiredCapability() {
    Proxy proxyToUse = proxyServer.asProxy();
    DesiredCapabilities requiredCaps = new DesiredCapabilities();
    requiredCaps.setCapability(PROXY, proxyToUse);

    WebDriver driver = new WebDriverBuilder().setRequiredCapabilities(requiredCaps).get();
    registerDriverTeardown(driver);

    driver.get(pages.simpleTestPage);
    assertTrue("Proxy should have been called", proxyServer.hasBeenCalled("simpleTest.html"));
  }
Exemplo n.º 3
0
  @Ignore(
      value = {ANDROID, IPHONE, OPERA_MOBILE, PHANTOMJS, SAFARI},
      reason = "Android/Iphone/PhantomJS - not tested," + "Opera mobile/Safari - not implemented")
  @NeedsLocalEnvironment
  @Test
  public void canConfigureManualHttpProxy() {
    Proxy proxyToUse = proxyServer.asProxy();
    DesiredCapabilities caps = new DesiredCapabilities();
    caps.setCapability(PROXY, proxyToUse);

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

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