diff --git a/e2e-spock-geb/files/src/test/resources/GebConfig.groovy b/e2e-spock-geb/files/src/test/resources/GebConfig.groovy index 518640f3..2f775af9 100644 --- a/e2e-spock-geb/files/src/test/resources/GebConfig.groovy +++ b/e2e-spock-geb/files/src/test/resources/GebConfig.groovy @@ -4,6 +4,7 @@ import io.appium.java_client.android.AndroidDriver import io.appium.java_client.ios.IOSDriver import org.openqa.selenium.MutableCapabilities import org.openqa.selenium.htmlunit.HtmlUnitDriver +import org.openqa.selenium.Proxy import helpers.* // Load application properties from application.properties file @@ -27,6 +28,14 @@ environments { return webClient } } + def env = System.getenv() + if(env.HTTP_PROXY) { + Proxy proxy = new Proxy(); + URL url = new URL(env.HTTP_PROXY); + proxy.setHttpProxy("${url.getHost()}:${url.getPort()}"); + proxy.setNoProxy(env.NO_PROXY) + driver.setProxySettings(proxy); + } return driver } }