 Issue 29866577:
  Issue 6887 - add Chrome to "npm test"  (Closed)
    
  
    Issue 29866577:
  Issue 6887 - add Chrome to "npm test"  (Closed) 
  | Index: test/browsers/chromium.js | 
| diff --git a/test/browsers/chromium.js b/test/browsers/chromium.js | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..d3f5337808ab7c2351c94f42f5ad6f7153bce80e | 
| --- /dev/null | 
| +++ b/test/browsers/chromium.js | 
| @@ -0,0 +1,51 @@ | 
| +/* | 
| + * This file is part of Adblock Plus <https://adblockplus.org/>, | 
| + * Copyright (C) 2006-present eyeo GmbH | 
| + * | 
| + * Adblock Plus is free software: you can redistribute it and/or modify | 
| + * it under the terms of the GNU General Public License version 3 as | 
| + * published by the Free Software Foundation. | 
| + * | 
| + * Adblock Plus is distributed in the hope that it will be useful, | 
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 
| + * GNU General Public License for more details. | 
| + * | 
| + * You should have received a copy of the GNU General Public License | 
| + * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 
| + */ | 
| + | 
| +"use strict"; | 
| + | 
| +// The Chromium version is a build number, quite obscure. | 
| +// Chromium 63.0.3239.x is 508578 | 
| +// Chromium 65.0.3325.0 is 530368 | 
| +// We currently want Chromiun 63, as we still support it and that's the | 
| +// loweset version that supports WebDriver. | 
| +const CHROMIUM_REVISION = 508578; | 
| + | 
| +const path = require("path"); | 
| +const webdriver = require("selenium-webdriver"); | 
| +const chrome = require("selenium-webdriver/chrome"); | 
| +const {ensureChromium} = require("../../adblockpluscore/test/runners/" + | 
| + "chromium_download"); | 
| + | 
| +exports.platform = "chrome"; | 
| + | 
| +exports.getDriver = function() | 
| +{ | 
| + return ensureChromium(CHROMIUM_REVISION).then(chromiumPath => | 
| + { | 
| + let devenv = path.resolve("./devenv.chrome"); | 
| 
Sebastian Noack
2018/08/28 14:44:58
I notice a pattern here. For both browsers we hard
 
tlucas
2018/08/29 09:16:54
Done.
 | 
| + | 
| + let options = new chrome.Options() | 
| + .setChromeBinaryPath(chromiumPath) | 
| + .addArguments("--no-sandbox") | 
| + .addArguments(`load-extension=${devenv}`); | 
| + | 
| + return new webdriver.Builder() | 
| + .forBrowser("chrome") | 
| + .setChromeOptions(options) | 
| + .build(); | 
| + }); | 
| +}; |