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