OLD | NEW |
(Empty) | |
| 1 /* |
| 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 "use strict"; |
| 19 |
| 20 const FIREFOX_VERSION = "57.0"; |
| 21 |
| 22 const path = require("path"); |
| 23 const webdriver = require("selenium-webdriver"); |
| 24 const firefox = require("selenium-webdriver/firefox"); |
| 25 const {Command} = require("selenium-webdriver/lib/command"); |
| 26 const {ensureFirefox} = require("../../adblockpluscore/test/runners/" + |
| 27 "firefox_download"); |
| 28 |
| 29 exports.platform = "gecko"; |
| 30 |
| 31 exports.getDriver = function() |
| 32 { |
| 33 return ensureFirefox(FIREFOX_VERSION).then(firefoxPath => |
| 34 { |
| 35 let binary = new firefox.Binary(firefoxPath); |
| 36 binary.addArguments("-headless"); |
| 37 |
| 38 let driver = new webdriver.Builder() |
| 39 .forBrowser("firefox") |
| 40 .setFirefoxOptions(new firefox.Options().setBinary(binary)) |
| 41 .build(); |
| 42 |
| 43 let devenv = "./devenv.gecko"; |
| 44 let cmd = new Command("moz-install-web-ext") |
| 45 .setParameter("path", path.resolve(devenv)) |
| 46 .setParameter("temporary", true); |
| 47 |
| 48 driver.getExecutor().defineCommand( |
| 49 cmd.getName(), "POST", |
| 50 "/session/:sessionId/moz/addon/install" |
| 51 ); |
| 52 driver.schedule(cmd, `installWebExt(${devenv})`); |
| 53 |
| 54 return driver; |
| 55 }); |
| 56 }; |
OLD | NEW |