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