Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 /* | |
Sebastian Noack
2018/08/27 19:56:15
See my comments for chrome.js, almost all of them
tlucas
2018/08/28 08:18:14
Done.
| |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | |
3 * Copyright (C) 2006-present eyeo GmbH | |
4 * | |
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 | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * Adblock Plus is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
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/>. | |
16 */ | |
17 | |
18 /* eslint-env mocha */ | |
19 | |
20 "use strict"; | |
21 | |
22 const FIREFOX_VERSION = "57.0"; | |
23 | |
24 const path = require("path"); | |
25 const webdriver = require("selenium-webdriver"); | |
26 const firefox = require("selenium-webdriver/firefox"); | |
27 const {Command} = require("selenium-webdriver/lib/command"); | |
28 const {ensureFirefox} = require("../../adblockpluscore/test/runners/" + | |
29 "firefox_download"); | |
30 | |
31 exports.platform = "gecko"; | |
32 | |
33 exports.getDriver = function() | |
34 { | |
35 let driver; | |
36 return ensureFirefox(FIREFOX_VERSION).then(firefoxPath => | |
37 { | |
38 let binary = new firefox.Binary(firefoxPath); | |
39 binary.addArguments("-headless"); | |
40 | |
41 driver = new webdriver.Builder() | |
42 .forBrowser("firefox") | |
43 .setFirefoxOptions(new firefox.Options().setBinary(binary)) | |
44 .build(); | |
45 | |
46 let devenv = "./devenv.gecko"; | |
47 let cmd = new Command("moz-install-web-ext") | |
48 .setParameter("path", path.resolve(devenv)) | |
49 .setParameter("temporary", true); | |
50 | |
51 driver.getExecutor().defineCommand( | |
52 cmd.getName(), "POST", | |
53 "/session/:sessionId/moz/addon/install" | |
54 ); | |
55 driver.schedule(cmd, `installWebExt(${devenv})`); | |
56 }).then(() => driver); | |
57 }; | |
OLD | NEW |