| 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 // The Chromium version is a build number, quite obscure. | 20 // The Chromium version is a build number, quite obscure. |
| 21 // Chromium 63.0.3239.x is 508578 | 21 // Chromium 63.0.3239.x is 508578 |
| 22 // Chromium 65.0.3325.0 is 530368 | 22 // Chromium 65.0.3325.0 is 530368 |
| 23 // We currently want Chromiun 63, as we still support it and that's the | 23 // We currently want Chromiun 63, as we still support it and that's the |
| 24 // loweset version that supports WebDriver. | 24 // loweset version that supports WebDriver. |
| 25 const CHROMIUM_REVISION = 508578; | 25 const CHROMIUM_REVISION = 508578; |
| 26 | 26 |
| 27 const path = require("path"); | |
| 28 const webdriver = require("selenium-webdriver"); | 27 const webdriver = require("selenium-webdriver"); |
| 29 const chrome = require("selenium-webdriver/chrome"); | 28 const chrome = require("selenium-webdriver/chrome"); |
| 30 const {ensureChromium} = require("../../adblockpluscore/test/runners/" + | 29 const {ensureChromium} = require("../../adblockpluscore/test/runners/" + |
| 31 "chromium_download"); | 30 "chromium_download"); |
| 32 | 31 |
| 33 exports.platform = "chrome"; | 32 exports.platform = "chrome"; |
| 34 | 33 |
| 35 exports.getDriver = function() | 34 exports.ensureBrowser = function() |
| 36 { | 35 { |
| 37 return ensureChromium(CHROMIUM_REVISION).then(chromiumPath => | 36 return ensureChromium(CHROMIUM_REVISION); |
| 38 { | 37 }; |
| 39 let devenv = path.resolve("./devenv.chrome"); | |
|
Sebastian Noack
2018/08/28 14:44:58
I notice a pattern here. For both browsers we hard
tlucas
2018/08/29 09:16:54
Done.
| |
| 40 | 38 |
| 41 let options = new chrome.Options() | 39 exports.getDriver = function(browserBinary, devenvPath) |
| 42 .setChromeBinaryPath(chromiumPath) | 40 { |
| 43 .addArguments("--no-sandbox") | 41 let options = new chrome.Options() |
| 44 .addArguments(`load-extension=${devenv}`); | 42 .setChromeBinaryPath(browserBinary) |
| 43 .addArguments("--no-sandbox") | |
| 44 .addArguments(`load-extension=${devenvPath}`); | |
| 45 | 45 |
| 46 return new webdriver.Builder() | 46 return new webdriver.Builder() |
| 47 .forBrowser("chrome") | 47 .forBrowser("chrome") |
| 48 .setChromeOptions(options) | 48 .setChromeOptions(options) |
| 49 .build(); | 49 .build(); |
| 50 }); | |
| 51 }; | 50 }; |
| LEFT | RIGHT |