Skip to content

Commit 4de2744

Browse files
Do not use proxy in selenium webdrivers
1 parent 9b772b0 commit 4de2744

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
export FORWARD_PROXY_URL=http://forward-proxy:9092
1+
export FORWARD_PROXY_HOST=forward-proxy
2+
export FORWARD_PROXY_PORT=9092
23
export OAUTH_PROVIDER_URL=${KEYCLOAK_URL}
34
export OAUTH_PROVIDER_CA_CERT=${KEYCLOAK_CA_CERT}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
export KEYCLOAK_URL=https://keycloak:8443/realms/test
2-
#export OAUTH_PROVIDER_URL=https://keycloak:8443/realms/test
32
export KEYCLOAK_CA_CERT=/config/oauth/keycloak/ca_keycloak_certificate.pem
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
export FORWARD_PROXY_URL=http://forward-proxy:9092
1+
export FORWARD_PROXY_HOST=forward-proxy
2+
export FORWARD_PROXY_PORT=9092
23
export OAUTH_PROVIDER_URL=${KEYCLOAK_URL}
34
export OAUTH_PROVIDER_CA_CERT=${KEYCLOAK_CA_CERT}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
auth_oauth2.issuer = ${OAUTH_PROVIDER_URL}
22
auth_oauth2.https.cacertfile = ${KEYCLOAK_CA_CERT}
3-
auth_oauth2.proxy = ${FORWARD_PROXY_URL}
3+
auth_oauth2.proxy.host = ${FORWARD_PROXY_HOST}
4+
auth_oauth2.proxy.port = ${FORWARD_PROXY_PORT}
45
#auth_oauth2.proxy_username = ${FORWARD_PROXY_USERNAME}
56
#auth_oauth2.proxy_password = ${FORWARD_PROXY_PASSWORD}

selenium/test/utils.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const assert = require('assert')
1212
const runLocal = String(process.env.RUN_LOCAL).toLowerCase() != 'false'
1313
const uaaUrl = process.env.UAA_URL || 'http://localhost:8080'
1414
const baseUrl = randomly_pick_baseurl(process.env.RABBITMQ_URL) || 'http://localhost:15672/'
15-
const proxyUrl = runLocal ? undefined : process.env.FORWARD_PROXY_URL
15+
//const proxyUrl = calculateProxyUrl(baseUrl)
1616
const hostname = process.env.RABBITMQ_HOSTNAME || 'localhost'
1717
const seleniumUrl = process.env.SELENIUM_URL || 'http://selenium:4444'
1818
const screenshotsDir = process.env.SCREENSHOTS_DIR || '/screens'
@@ -25,6 +25,19 @@ function randomly_pick_baseurl(baseUrl) {
2525
function getRandomInt(max) {
2626
return Math.floor(Math.random() * max);
2727
}
28+
/*
29+
function calculateProxyUrl(baseUrl) {
30+
if (baseUrl.includes("localhost")) {
31+
return undefined
32+
}
33+
if (process.env.FORWARD_PROXY_HOST && process.env.FORWARD_PROXY_PORT) {
34+
return 'http://' + process.env.FORWARD_PROXY_HOST + ':' + process.env.FORWARD_PROXY_PORT
35+
}else {
36+
console.log("There are no proxy setup : " + JSON.stringify(process.env))
37+
return undefined
38+
}
39+
}
40+
*/
2841
class CaptureScreenshot {
2942
driver
3043
test
@@ -70,10 +83,14 @@ module.exports = {
7083
builder = builder
7184
.forBrowser('chrome')
7285
.withCapabilities(chromeCapabilities)
86+
/*
7387
if (proxyUrl) {
7488
console.log("Using proxy " + proxyUrl)
7589
builder = builder.setProxy(proxy.manual({https: proxyUrl}))
76-
}
90+
}else {
91+
console.log("Not Using proxy . runLocal: " + runLocal)
92+
}
93+
*/
7794
driver = builder.build()
7895
driver.manage().setTimeouts( { pageLoad: 35000 } )
7996
return driver

0 commit comments

Comments
 (0)