diff --git a/tests/e2e/constants/CHROME_DRIVER_CONSTANTS.ts b/tests/e2e/constants/CHROME_DRIVER_CONSTANTS.ts index e55dceacb3f..98ffa32a819 100644 --- a/tests/e2e/constants/CHROME_DRIVER_CONSTANTS.ts +++ b/tests/e2e/constants/CHROME_DRIVER_CONSTANTS.ts @@ -13,6 +13,7 @@ export const CHROME_DRIVER_CONSTANTS: { TS_USE_WEB_DRIVER_FOR_TEST: boolean; TS_SELENIUM_LAUNCH_FULLSCREEN: boolean; TS_SELENIUM_REMOTE_DRIVER_URL: string; + TS_SELENIUM_PROXY_SERVER: string; } = { /** * remote driver URL. @@ -38,5 +39,10 @@ export const CHROME_DRIVER_CONSTANTS: { /** * run browser with an enabled or disabled W3C protocol (on Chrome 76 and upper, it is enabled by default), "true" by default. */ - TS_SELENIUM_W3C_CHROME_OPTION: process.env.TS_SELENIUM_W3C_CHROME_OPTION !== 'false' + TS_SELENIUM_W3C_CHROME_OPTION: process.env.TS_SELENIUM_W3C_CHROME_OPTION !== 'false', + + /** + * run browser with proxy settings + */ + TS_SELENIUM_PROXY_SERVER: process.env.TS_SELENIUM_PROXY_SERVER || '', }; diff --git a/tests/e2e/driver/ChromeDriver.ts b/tests/e2e/driver/ChromeDriver.ts index bdb4e5099f9..bdbd8725307 100644 --- a/tests/e2e/driver/ChromeDriver.ts +++ b/tests/e2e/driver/ChromeDriver.ts @@ -37,10 +37,16 @@ export class ChromeDriver implements IDriver { .addArguments('--disable-web-security') .addArguments('--allow-running-insecure-content') .addArguments('--ignore-certificate-errors'); + // if 'true' run in 'headless' mode if (CHROME_DRIVER_CONSTANTS.TS_SELENIUM_HEADLESS) { options = options.addArguments('headless'); } + + if (CHROME_DRIVER_CONSTANTS.TS_SELENIUM_PROXY_SERVER !== '') { + options = options.addArguments('--proxy-server=' + CHROME_DRIVER_CONSTANTS.TS_SELENIUM_PROXY_SERVER); + } + return options; } diff --git a/tests/e2e/utils/CheReporter.ts b/tests/e2e/utils/CheReporter.ts index 6939e0e3d65..ccbc0b11eef 100644 --- a/tests/e2e/utils/CheReporter.ts +++ b/tests/e2e/utils/CheReporter.ts @@ -62,6 +62,8 @@ class CheReporter extends mocha.reporters.Spec { TS_SELENIUM_LOG_LEVEL: ${REPORTER_CONSTANTS.TS_SELENIUM_LOG_LEVEL} TS_SELENIUM_LAUNCH_FULLSCREEN: ${CHROME_DRIVER_CONSTANTS.TS_SELENIUM_LAUNCH_FULLSCREEN} + ${process.env.TS_SELENIUM_PROXY_SERVER ? 'TS_SELENIUM_PROXY_SERVER: ' + process.env.TS_SELENIUM_PROXY_SERVER : ''} + TS_COMMON_DASHBOARD_WAIT_TIMEOUT: ${TIMEOUT_CONSTANTS.TS_COMMON_DASHBOARD_WAIT_TIMEOUT} TS_SELENIUM_START_WORKSPACE_TIMEOUT: ${TIMEOUT_CONSTANTS.TS_SELENIUM_START_WORKSPACE_TIMEOUT} TS_WAIT_LOADER_PRESENCE_TIMEOUT: ${TIMEOUT_CONSTANTS.TS_WAIT_LOADER_PRESENCE_TIMEOUT}