OLD | NEW |
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 firefox = require("selenium-webdriver/firefox"); | 21 const firefox = require("selenium-webdriver/firefox"); |
22 const {Command} = require("selenium-webdriver/lib/command"); | 22 const {Command} = require("selenium-webdriver/lib/command"); |
23 const {ensureFirefox} = require("../../adblockpluscore/test/runners/" + | 23 const {ensureFirefox} = require("../../adblockpluscore/test/runners/" + |
24 "firefox_download"); | 24 "firefox_download"); |
25 | 25 |
| 26 // We need to require the geckodriver, |
| 27 // otherwise on Windows the geckodriver path is not added to process.env.PATH. |
| 28 require("geckodriver"); |
| 29 |
26 exports.platform = "gecko"; | 30 exports.platform = "gecko"; |
27 exports.oldestCompatibleVersion = "57.0"; | 31 exports.oldestCompatibleVersion = "57.0"; |
28 exports.ensureBrowser = ensureFirefox; | 32 exports.ensureBrowser = ensureFirefox; |
29 | 33 |
30 exports.getDriver = function(browserBinary, devenvPath) | 34 exports.getDriver = function(browserBinary, devenvPath) |
31 { | 35 { |
32 let options = new firefox.Options(); | 36 let options = new firefox.Options(); |
33 options.setBinary(browserBinary); | 37 options.setBinary(browserBinary); |
34 options.headless(); | 38 options.headless(); |
35 | 39 |
36 let driver = new webdriver.Builder() | 40 let driver = new webdriver.Builder() |
37 .forBrowser("firefox") | 41 .forBrowser("firefox") |
38 .setFirefoxOptions(options) | 42 .setFirefoxOptions(options) |
39 .build(); | 43 .build(); |
40 | 44 |
41 let cmd = new Command("moz-install-web-ext") | 45 let cmd = new Command("moz-install-web-ext") |
42 .setParameter("path", devenvPath) | 46 .setParameter("path", devenvPath) |
43 .setParameter("temporary", true); | 47 .setParameter("temporary", true); |
44 | 48 |
45 driver.getExecutor().defineCommand( | 49 driver.getExecutor().defineCommand( |
46 cmd.getName(), "POST", | 50 cmd.getName(), "POST", |
47 "/session/:sessionId/moz/addon/install" | 51 "/session/:sessionId/moz/addon/install" |
48 ); | 52 ); |
49 driver.schedule(cmd, `installWebExt(${devenvPath})`); | 53 driver.schedule(cmd, `installWebExt(${devenvPath})`); |
50 | 54 |
51 return driver; | 55 return driver; |
52 }; | 56 }; |
OLD | NEW |