From f02e19d7c515e35aa01dd1b47a8a79d88c204939 Mon Sep 17 00:00:00 2001 From: Diego Molina Date: Thu, 20 Apr 2023 11:50:44 +0200 Subject: [PATCH] [javascript] Adding SELENIUM_MANAGER_BASE_PATH env var to use Selenium Manager for tests --- .bazelrc | 1 + .../node/selenium-webdriver/common/seleniumManager.js | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.bazelrc b/.bazelrc index 1ad7c4d46d8df..e8d479c5e4844 100644 --- a/.bazelrc +++ b/.bazelrc @@ -54,6 +54,7 @@ build --test_env=LOCALAPPDATA build --test_env=MOZ_HEADLESS build --test_env=PATH # Remove once browser pinning works build --test_env=SELENIUM_BROWSER +build --test_env=SELENIUM_MANAGER_BASE_PATH build --test_env=TRAVIS build --test_env=PYTHON_VERSION diff --git a/javascript/node/selenium-webdriver/common/seleniumManager.js b/javascript/node/selenium-webdriver/common/seleniumManager.js index 8a034e41dbb83..9db638474c4da 100644 --- a/javascript/node/selenium-webdriver/common/seleniumManager.js +++ b/javascript/node/selenium-webdriver/common/seleniumManager.js @@ -47,7 +47,15 @@ function getBinary() { const file = directory === 'windows' ? 'selenium-manager.exe' : 'selenium-manager' - const filePath = path.join(__dirname, '..', '/bin', directory, file) + let seleniumManagerBasePath + if (process.env.SELENIUM_MANAGER_BASE_PATH) { + seleniumManagerBasePath = process.env.SELENIUM_MANAGER_BASE_PATH + } else { + seleniumManagerBasePath = path.join(__dirname, '..', '/bin') + } + console.log(seleniumManagerBasePath) + + const filePath = path.join(seleniumManagerBasePath, directory, file) if (!fs.existsSync(filePath)) { throw new Error(`Unable to obtain Selenium Manager`)