Skip to content

Commit

Permalink
Add TS_SELENIUM_PROXY_SERVER param to run ChromeDriver with proxy ser…
Browse files Browse the repository at this point in the history
…ver (eclipse-che#23060)

* Add TS_SELENIUM_PROXY_SERVER param to run ChromeDriver with proxy server

Signed-off-by: Dmytro Nochevnov <[email protected]>

* Display TS_SELENIUM_PROXY_SERVER value in the test logs

Signed-off-by: Dmytro Nochevnov <[email protected]>

---------

Signed-off-by: Dmytro Nochevnov <[email protected]>
  • Loading branch information
dmytro-ndp authored and musienko-maxim committed Jul 31, 2024
1 parent e855af5 commit 20e5265
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/e2e/constants/CHROME_DRIVER_CONSTANTS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 || '',
};
6 changes: 6 additions & 0 deletions tests/e2e/driver/ChromeDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 2 additions & 0 deletions tests/e2e/utils/CheReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit 20e5265

Please sign in to comment.