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

Side by Side Diff: test/runners/chromiumwd_process.js

Issue 29720661: Issue 6391 - Allow running the browser unit tests with Firefox (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Support using chromium with webdriver. Created March 16, 2018, 8:56 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/runners/chromium_process.js ('k') | test/runners/firefox_process.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 /* eslint-env node */
19
20 "use strict";
21
22 const {Builder} = require("selenium-webdriver");
23 const chrome = require("selenium-webdriver/chrome");
24 require("chromedriver");
25
26 const {executeScript} = require("./webdriver");
27 const {ensureChromium} = require("./chromium_download");
28
29 // Chromium 63.0.3239.x
30 const CHROMIUM_REVISION = 508578;
31 // Chromium 65.0.3325.0 is 530368
32
33 function runScript(chromiumPath, script, scriptName, scriptArgs)
34 {
35 const options = new chrome.Options()
36 .headless()
37 .setChromeBinaryPath(chromiumPath);
38
39 const driver = new Builder()
40 .forBrowser("chrome")
41 .setChromeOptions(options)
42 .build();
43
44 return executeScript(driver, "Chromium (WebDriver)",
45 script, scriptName, scriptArgs);
46 }
47
48 module.exports = function(script, scriptName, ...scriptArgs)
49 {
50 return ensureChromium(CHROMIUM_REVISION).then(chromiumPath =>
51 {
52 return runScript(chromiumPath, script, scriptName, scriptArgs)
53 .then(result =>
54 {
55 return result;
56 }).catch(error =>
57 {
58 throw error;
59 });
60 });
61 };
OLDNEW
« no previous file with comments | « test/runners/chromium_process.js ('k') | test/runners/firefox_process.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld