mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[ftr] update webdriver dependency to 4.0 (#115649)
* [ftr] update webdriver dependency to 4.0 * [ftr] cast options on assign Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
73566ad285
commit
9b3529a2a1
3 changed files with 87 additions and 100 deletions
|
@ -598,7 +598,7 @@
|
|||
"@types/reduce-reducers": "^1.0.0",
|
||||
"@types/redux-actions": "^2.6.1",
|
||||
"@types/seedrandom": ">=2.0.0 <4.0.0",
|
||||
"@types/selenium-webdriver": "^4.0.9",
|
||||
"@types/selenium-webdriver": "^4.0.15",
|
||||
"@types/semver": "^7",
|
||||
"@types/set-value": "^2.0.0",
|
||||
"@types/sinon": "^7.0.13",
|
||||
|
@ -780,7 +780,7 @@
|
|||
"rxjs-marbles": "^5.0.6",
|
||||
"sass-loader": "^10.2.0",
|
||||
"sass-resources-loader": "^2.0.1",
|
||||
"selenium-webdriver": "^4.0.0-alpha.7",
|
||||
"selenium-webdriver": "^4.0.0",
|
||||
"serve-static": "1.14.1",
|
||||
"shelljs": "^0.8.4",
|
||||
"simple-git": "1.116.0",
|
||||
|
|
|
@ -71,6 +71,60 @@ export interface BrowserConfig {
|
|||
acceptInsecureCerts: boolean;
|
||||
}
|
||||
|
||||
function initChromiumOptions(browserType: Browsers, acceptInsecureCerts: boolean) {
|
||||
const options = browserType === Browsers.Chrome ? new chrome.Options() : new edge.Options();
|
||||
|
||||
options.addArguments(
|
||||
// Disables the sandbox for all process types that are normally sandboxed.
|
||||
'no-sandbox',
|
||||
// Launches URL in new browser window.
|
||||
'new-window',
|
||||
// By default, file:// URIs cannot read other file:// URIs. This is an override for developers who need the old behavior for testing.
|
||||
'allow-file-access-from-files',
|
||||
// Use fake device for Media Stream to replace actual camera and microphone.
|
||||
'use-fake-device-for-media-stream',
|
||||
// Bypass the media stream infobar by selecting the default device for media streams (e.g. WebRTC). Works with --use-fake-device-for-media-stream.
|
||||
'use-fake-ui-for-media-stream'
|
||||
);
|
||||
|
||||
if (process.platform === 'linux') {
|
||||
// The /dev/shm partition is too small in certain VM environments, causing
|
||||
// Chrome to fail or crash. Use this flag to work-around this issue
|
||||
// (a temporary directory will always be used to create anonymous shared memory files).
|
||||
options.addArguments('disable-dev-shm-usage');
|
||||
}
|
||||
|
||||
if (headlessBrowser === '1') {
|
||||
// Use --disable-gpu to avoid an error from a missing Mesa library, as per
|
||||
// See: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
|
||||
options.headless();
|
||||
options.addArguments('disable-gpu');
|
||||
}
|
||||
|
||||
if (certValidation === '0') {
|
||||
options.addArguments('ignore-certificate-errors');
|
||||
}
|
||||
|
||||
if (remoteDebug === '1') {
|
||||
// Visit chrome://inspect in chrome to remotely view/debug
|
||||
options.headless();
|
||||
options.addArguments('disable-gpu', 'remote-debugging-port=9222');
|
||||
}
|
||||
|
||||
if (browserBinaryPath) {
|
||||
options.setChromeBinaryPath(browserBinaryPath);
|
||||
}
|
||||
|
||||
const prefs = new logging.Preferences();
|
||||
prefs.setLevel(logging.Type.BROWSER, logging.Level.ALL);
|
||||
options.setUserPreferences(chromiumUserPrefs);
|
||||
options.setLoggingPrefs(prefs);
|
||||
options.set('unexpectedAlertBehaviour', 'accept');
|
||||
options.setAcceptInsecureCerts(acceptInsecureCerts);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
let attemptCounter = 0;
|
||||
let edgePaths: { driverPath: string | undefined; browserPath: string | undefined };
|
||||
async function attemptToCreateCommand(
|
||||
|
@ -86,55 +140,10 @@ async function attemptToCreateCommand(
|
|||
const buildDriverInstance = async () => {
|
||||
switch (browserType) {
|
||||
case 'chrome': {
|
||||
const chromeOptions = new chrome.Options();
|
||||
chromeOptions.addArguments(
|
||||
// Disables the sandbox for all process types that are normally sandboxed.
|
||||
'no-sandbox',
|
||||
// Launches URL in new browser window.
|
||||
'new-window',
|
||||
// By default, file:// URIs cannot read other file:// URIs. This is an override for developers who need the old behavior for testing.
|
||||
'allow-file-access-from-files',
|
||||
// Use fake device for Media Stream to replace actual camera and microphone.
|
||||
'use-fake-device-for-media-stream',
|
||||
// Bypass the media stream infobar by selecting the default device for media streams (e.g. WebRTC). Works with --use-fake-device-for-media-stream.
|
||||
'use-fake-ui-for-media-stream'
|
||||
);
|
||||
|
||||
if (process.platform === 'linux') {
|
||||
// The /dev/shm partition is too small in certain VM environments, causing
|
||||
// Chrome to fail or crash. Use this flag to work-around this issue
|
||||
// (a temporary directory will always be used to create anonymous shared memory files).
|
||||
chromeOptions.addArguments('disable-dev-shm-usage');
|
||||
}
|
||||
|
||||
if (headlessBrowser === '1') {
|
||||
// Use --disable-gpu to avoid an error from a missing Mesa library, as per
|
||||
// See: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
|
||||
chromeOptions.headless();
|
||||
chromeOptions.addArguments('disable-gpu');
|
||||
}
|
||||
|
||||
if (certValidation === '0') {
|
||||
chromeOptions.addArguments('ignore-certificate-errors');
|
||||
}
|
||||
|
||||
if (remoteDebug === '1') {
|
||||
// Visit chrome://inspect in chrome to remotely view/debug
|
||||
chromeOptions.headless();
|
||||
chromeOptions.addArguments('disable-gpu', 'remote-debugging-port=9222');
|
||||
}
|
||||
|
||||
if (browserBinaryPath) {
|
||||
chromeOptions.setChromeBinaryPath(browserBinaryPath);
|
||||
}
|
||||
|
||||
const prefs = new logging.Preferences();
|
||||
prefs.setLevel(logging.Type.BROWSER, logging.Level.ALL);
|
||||
chromeOptions.setUserPreferences(chromiumUserPrefs);
|
||||
chromeOptions.setLoggingPrefs(prefs);
|
||||
chromeOptions.set('unexpectedAlertBehaviour', 'accept');
|
||||
chromeOptions.setAcceptInsecureCerts(config.acceptInsecureCerts);
|
||||
|
||||
const chromeOptions = initChromiumOptions(
|
||||
browserType,
|
||||
config.acceptInsecureCerts
|
||||
) as chrome.Options;
|
||||
let session;
|
||||
if (remoteSessionUrl) {
|
||||
session = await new Builder()
|
||||
|
@ -169,19 +178,10 @@ async function attemptToCreateCommand(
|
|||
|
||||
case 'msedge': {
|
||||
if (edgePaths && edgePaths.browserPath && edgePaths.driverPath) {
|
||||
const edgeOptions = new edge.Options();
|
||||
if (headlessBrowser === '1') {
|
||||
// @ts-ignore internal modules are not typed
|
||||
edgeOptions.headless();
|
||||
}
|
||||
// @ts-ignore internal modules are not typed
|
||||
edgeOptions.setEdgeChromium(true);
|
||||
// @ts-ignore internal modules are not typed
|
||||
edgeOptions.setBinaryPath(edgePaths.browserPath);
|
||||
const options = edgeOptions.get('ms:edgeOptions');
|
||||
// overriding options to include preferences
|
||||
Object.assign(options, { prefs: chromiumUserPrefs });
|
||||
edgeOptions.set('ms:edgeOptions', options);
|
||||
const edgeOptions = initChromiumOptions(
|
||||
browserType,
|
||||
config.acceptInsecureCerts
|
||||
) as edge.Options;
|
||||
const session = await new Builder()
|
||||
.forBrowser('MicrosoftEdge')
|
||||
.setEdgeOptions(edgeOptions)
|
||||
|
|
59
yarn.lock
59
yarn.lock
|
@ -6985,10 +6985,10 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/seedrandom/-/seedrandom-2.4.28.tgz#9ce8fa048c1e8c85cb71d7fe4d704e000226036f"
|
||||
integrity sha512-SMA+fUwULwK7sd/ZJicUztiPs8F1yCPwF3O23Z9uQ32ME5Ha0NmDK9+QTsYE4O2tHXChzXomSWWeIhCnoN1LqA==
|
||||
|
||||
"@types/selenium-webdriver@^4.0.9":
|
||||
version "4.0.9"
|
||||
resolved "https://registry.yarnpkg.com/@types/selenium-webdriver/-/selenium-webdriver-4.0.9.tgz#12621e55b2ef8f6c98bd17fe23fa720c6cba16bd"
|
||||
integrity sha512-HopIwBE7GUXsscmt/J0DhnFXLSmO04AfxT6b8HAprknwka7pqEWquWDMXxCjd+NUHK9MkCe1SDKKsMiNmCItbQ==
|
||||
"@types/selenium-webdriver@^4.0.15":
|
||||
version "4.0.15"
|
||||
resolved "https://registry.yarnpkg.com/@types/selenium-webdriver/-/selenium-webdriver-4.0.15.tgz#03012b84155cf6bbae2f64aa9dccf2a84c78c7c8"
|
||||
integrity sha512-5760PIZkzhPejy3hsKAdCKe5LJygGdxLKOLxmZL9GEUcFlO5OgzM6G2EbdbvOnaw4xvUSa9Uip6Ipwkih12BPA==
|
||||
|
||||
"@types/semver@^7":
|
||||
version "7.3.4"
|
||||
|
@ -18808,10 +18808,10 @@ jsts@^1.6.2:
|
|||
array-includes "^3.1.2"
|
||||
object.assign "^4.1.2"
|
||||
|
||||
jszip@^3.2.2:
|
||||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/jszip/-/jszip-3.3.0.tgz#29d72c21a54990fa885b11fc843db320640d5271"
|
||||
integrity sha512-EJ9k766htB1ZWnsV5ZMDkKLgA+201r/ouFF8R2OigVjVdcm2rurcBrrdXaeqBJbqnUVMko512PYmlncBKE1Huw==
|
||||
jszip@^3.6.0:
|
||||
version "3.7.1"
|
||||
resolved "https://registry.yarnpkg.com/jszip/-/jszip-3.7.1.tgz#bd63401221c15625a1228c556ca8a68da6fda3d9"
|
||||
integrity sha512-ghL0tz1XG9ZEmRMcEN2vt7xabrDdqHHeykgARpmZ0BiIctWxM47Vt63ZO2dnp4QYt/xJVLLy5Zv1l/xRdh2byg==
|
||||
dependencies:
|
||||
lie "~3.3.0"
|
||||
pako "~1.0.2"
|
||||
|
@ -21737,7 +21737,7 @@ os-shim@^0.1.2:
|
|||
resolved "https://registry.yarnpkg.com/os-shim/-/os-shim-0.1.3.tgz#6b62c3791cf7909ea35ed46e17658bb417cb3917"
|
||||
integrity sha1-a2LDeRz3kJ6jXtRuF2WLtBfLORc=
|
||||
|
||||
os-tmpdir@^1.0.0, os-tmpdir@~1.0.1, os-tmpdir@~1.0.2:
|
||||
os-tmpdir@^1.0.0, os-tmpdir@~1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274"
|
||||
integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=
|
||||
|
@ -25397,13 +25397,6 @@ rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.2, rimraf@^2.6.3:
|
|||
dependencies:
|
||||
glob "^7.1.3"
|
||||
|
||||
rimraf@^2.7.1:
|
||||
version "2.7.1"
|
||||
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec"
|
||||
integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==
|
||||
dependencies:
|
||||
glob "^7.1.3"
|
||||
|
||||
rimraf@~2.4.0:
|
||||
version "2.4.5"
|
||||
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.4.5.tgz#ee710ce5d93a8fdb856fb5ea8ff0e2d75934b2da"
|
||||
|
@ -25709,14 +25702,15 @@ select-hose@^2.0.0:
|
|||
resolved "https://registry.yarnpkg.com/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca"
|
||||
integrity sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=
|
||||
|
||||
selenium-webdriver@^4.0.0-alpha.7:
|
||||
version "4.0.0-alpha.7"
|
||||
resolved "https://registry.yarnpkg.com/selenium-webdriver/-/selenium-webdriver-4.0.0-alpha.7.tgz#e3879d8457fd7ad8e4424094b7dc0540d99e6797"
|
||||
integrity sha512-D4qnTsyTr91jT8f7MfN+OwY0IlU5+5FmlO5xlgRUV6hDEV8JyYx2NerdTEqDDkNq7RZDYc4VoPALk8l578RBHw==
|
||||
selenium-webdriver@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/selenium-webdriver/-/selenium-webdriver-4.0.0.tgz#7dc8969facee3be634459e173f557b7e34308e73"
|
||||
integrity sha512-tOlu6FnTjPq2FKpd153pl8o2cB7H40Rvl/ogiD2sapMv4IDjQqpIxbd+swDJe9UDLdszeh5CDis6lgy4e9UG1w==
|
||||
dependencies:
|
||||
jszip "^3.2.2"
|
||||
rimraf "^2.7.1"
|
||||
tmp "0.0.30"
|
||||
jszip "^3.6.0"
|
||||
rimraf "^3.0.2"
|
||||
tmp "^0.2.1"
|
||||
ws ">=7.4.6"
|
||||
|
||||
selfsigned@^1.10.7:
|
||||
version "1.10.8"
|
||||
|
@ -27871,13 +27865,6 @@ title-case@^2.1.1:
|
|||
no-case "^2.2.0"
|
||||
upper-case "^1.0.3"
|
||||
|
||||
tmp@0.0.30:
|
||||
version "0.0.30"
|
||||
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.30.tgz#72419d4a8be7d6ce75148fd8b324e593a711c2ed"
|
||||
integrity sha1-ckGdSovn1s51FI/YsyTlk6cRwu0=
|
||||
dependencies:
|
||||
os-tmpdir "~1.0.1"
|
||||
|
||||
tmp@^0.0.33:
|
||||
version "0.0.33"
|
||||
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"
|
||||
|
@ -27885,7 +27872,7 @@ tmp@^0.0.33:
|
|||
dependencies:
|
||||
os-tmpdir "~1.0.2"
|
||||
|
||||
tmp@~0.2.1:
|
||||
tmp@^0.2.1, tmp@~0.2.1:
|
||||
version "0.2.1"
|
||||
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.1.tgz#8457fc3037dcf4719c251367a1af6500ee1ccf14"
|
||||
integrity sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==
|
||||
|
@ -30289,6 +30276,11 @@ write-pkg@^4.0.0:
|
|||
type-fest "^0.4.1"
|
||||
write-json-file "^3.2.0"
|
||||
|
||||
ws@>=7.4.6, ws@^7.4.6:
|
||||
version "7.5.5"
|
||||
resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.5.tgz#8b4bc4af518cfabd0473ae4f99144287b33eb881"
|
||||
integrity sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w==
|
||||
|
||||
ws@^6.1.2, ws@^6.2.1:
|
||||
version "6.2.2"
|
||||
resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.2.tgz#dd5cdbd57a9979916097652d78f1cc5faea0c32e"
|
||||
|
@ -30301,11 +30293,6 @@ ws@^7.2.3:
|
|||
resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c"
|
||||
integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==
|
||||
|
||||
ws@^7.4.6:
|
||||
version "7.5.5"
|
||||
resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.5.tgz#8b4bc4af518cfabd0473ae4f99144287b33eb881"
|
||||
integrity sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w==
|
||||
|
||||
x-is-function@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/x-is-function/-/x-is-function-1.0.4.tgz#5d294dc3d268cbdd062580e0c5df77a391d1fa1e"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue