Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: test/browsers/firefox.js

Issue 29866577: Issue 6887 - add Chrome to "npm test" (Closed)
Left Patch Set: Created Aug. 29, 2018, 9:15 a.m.
Right Patch Set: Removed unused this.platform Created Sept. 1, 2018, 3:12 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « test/browsers/chromium.js ('k') | test/firefox.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 webdriver = require("selenium-webdriver"); 22 const webdriver = require("selenium-webdriver");
23 const firefox = require("selenium-webdriver/firefox"); 23 const firefox = require("selenium-webdriver/firefox");
24 const {Command} = require("selenium-webdriver/lib/command"); 24 const {Command} = require("selenium-webdriver/lib/command");
25 const {ensureFirefox} = require("../../adblockpluscore/test/runners/" + 25 const {ensureFirefox} = require("../../adblockpluscore/test/runners/" +
26 "firefox_download"); 26 "firefox_download");
27 27
28 exports.platform = "gecko"; 28 exports.platform = "gecko";
29 29
30 exports.getDriver = function(devenvPathAbsolute) 30 exports.ensureBrowser = function()
31 { 31 {
32 return ensureFirefox(FIREFOX_VERSION).then(firefoxPath => 32 return ensureFirefox(FIREFOX_VERSION);
33 { 33 };
34 let binary = new firefox.Binary(firefoxPath);
35 binary.addArguments("-headless");
36 34
37 let driver = new webdriver.Builder() 35 exports.getDriver = function(browserBinary, devenvPath)
38 .forBrowser("firefox") 36 {
39 .setFirefoxOptions(new firefox.Options().setBinary(binary)) 37 let binary = new firefox.Binary(browserBinary);
40 .build(); 38 binary.addArguments("-headless");
41 39
42 let cmd = new Command("moz-install-web-ext") 40 let driver = new webdriver.Builder()
43 .setParameter("path", devenvPathAbsolute) 41 .forBrowser("firefox")
44 .setParameter("temporary", true); 42 .setFirefoxOptions(new firefox.Options().setBinary(binary))
43 .build();
45 44
46 driver.getExecutor().defineCommand( 45 let cmd = new Command("moz-install-web-ext")
47 cmd.getName(), "POST", 46 .setParameter("path", devenvPath)
48 "/session/:sessionId/moz/addon/install" 47 .setParameter("temporary", true);
49 ); 48
50 driver.schedule(cmd, `installWebExt(${devenvPathAbsolute})`); 49 driver.getExecutor().defineCommand(
51 return driver; 50 cmd.getName(), "POST",
Sebastian Noack 2018/08/29 15:22:12 Nit: I think it reads a little better with a blank
tlucas 2018/09/01 09:38:31 Done.
52 }); 51 "/session/:sessionId/moz/addon/install"
52 );
53 driver.schedule(cmd, `installWebExt(${devenvPath})`);
54
55 return driver;
53 }; 56 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld