* Gives the Grid node a slot for only the browser under test, so it doesn't run Selenium Manager * for every browser at startup. A Bazel-provided driver and browser are pinned in that slot; on * CI, Selenium Manager would find no installed browser. * @param {!Array } browserNames the brows
(browserNames)
| 657 | * @return {!Array<string>} empty to keep driver detection. |
| 658 | */ |
| 659 | function gridArgs(browserNames) { |
| 660 | // The command line merges repeated --driver-configuration flags into one, so only a single |
| 661 | // browser can have a slot; with several, detection must stay on to give each one a slot. |
| 662 | if (browserNames.length !== 1 || !(browserNames[0] in GRID_BROWSERS)) { |
| 663 | return [] |
| 664 | } |
| 665 | const [browserName] = browserNames |
| 666 | const [driverVar, browserVar, vendorKey] = GRID_BROWSERS[browserName] |
| 667 | const slot = [`display-name=${browserName}`, 'max-sessions=1'] |
| 668 | const stereotype = { browserName } |
| 669 | if (process.env[driverVar] && process.env[browserVar]) { |
| 670 | slot.push(`webdriver-executable=${locate(process.env[driverVar])}`) |
| 671 | stereotype[vendorKey] = { binary: locate(process.env[browserVar]) } |
| 672 | } |
| 673 | return ['--detect-drivers', 'false', '--driver-configuration', ...slot, `stereotype=${JSON.stringify(stereotype)}`] |
| 674 | } |
| 675 | |
| 676 | function locate(fileLike) { |
| 677 | if (fs.existsSync(fileLike)) { |