Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 "use strict"; | 18 "use strict"; |
19 | 19 |
20 const webdriver = require("selenium-webdriver"); | 20 const webdriver = require("selenium-webdriver"); |
21 const chrome = require("selenium-webdriver/chrome"); | 21 const chrome = require("selenium-webdriver/chrome"); |
22 const {ensureChromium} = require("../../adblockpluscore/test/runners/" + | 22 const {ensureChromium} = require("../../adblockpluscore/test/runners/" + |
23 "chromium_download"); | 23 "chromium_download"); |
24 | |
25 // We need to require the chromedriver, | |
26 // otherwise on Windows the chromedriver path is not added to process.env.PATH. | |
24 require("chromedriver"); | 27 require("chromedriver"); |
Sebastian Noack
2018/09/26 21:38:57
I'd add a comment that this is necessary on Window
geo
2018/09/26 22:20:28
Done.
| |
25 | 28 |
26 exports.platform = "chrome"; | 29 exports.platform = "chrome"; |
27 exports.ensureBrowser = ensureChromium; | 30 exports.ensureBrowser = ensureChromium; |
28 | 31 |
29 // The Chromium version is a build number, quite obscure. | 32 // The Chromium version is a build number, quite obscure. |
30 // Chromium 63.0.3239.x is 508578 | 33 // Chromium 63.0.3239.x is 508578 |
31 // Chromium 65.0.3325.0 is 530368 | 34 // Chromium 65.0.3325.0 is 530368 |
32 // We currently want Chromiun 63, as we still support it and that's the | 35 // We currently want Chromiun 63, as we still support it and that's the |
33 // loweset version that supports WebDriver. | 36 // loweset version that supports WebDriver. |
34 exports.oldestCompatibleVersion = 508578; | 37 exports.oldestCompatibleVersion = 508578; |
35 | 38 |
36 exports.getDriver = function(browserBinary, devenvPath) | 39 exports.getDriver = function(browserBinary, devenvPath) |
37 { | 40 { |
38 let options = new chrome.Options() | 41 let options = new chrome.Options() |
39 .setChromeBinaryPath(browserBinary) | 42 .setChromeBinaryPath(browserBinary) |
40 .addArguments("--no-sandbox") | 43 .addArguments("--no-sandbox") |
41 .addArguments(`load-extension=${devenvPath}`); | 44 .addArguments(`load-extension=${devenvPath}`); |
42 | 45 |
43 return new webdriver.Builder() | 46 return new webdriver.Builder() |
44 .forBrowser("chrome") | 47 .forBrowser("chrome") |
45 .setChromeOptions(options) | 48 .setChromeOptions(options) |
46 .build(); | 49 .build(); |
47 }; | 50 }; |
LEFT | RIGHT |