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

Unified Diff: test/browser/chrome.js

Issue 29866577: Issue 6887 - add Chrome to "npm test" (Closed)
Patch Set: Created Aug. 27, 2018, 3:09 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/browser/chrome.js
diff --git a/test/browser/chrome.js b/test/browser/chrome.js
new file mode 100644
index 0000000000000000000000000000000000000000..116cea913a83eb58d918d0f93260f78b81879224
--- /dev/null
+++ b/test/browser/chrome.js
@@ -0,0 +1,50 @@
+/*
Sebastian Noack 2018/08/27 19:56:15 For the directory name "browsers" (plural) seems m
tlucas 2018/08/28 08:18:13 Done.
+ * 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/>.
+ */
+
+/* eslint-env mocha */
Sebastian Noack 2018/08/27 19:56:15 Is this necessary? I don't see any describe()/it/e
tlucas 2018/08/28 08:18:13 Done.
+
+"use strict";
+
+const CHROMIUM_REVISION = 508578;
Sebastian Noack 2018/08/27 19:56:15 We might want to add a comment which Chrome versio
tlucas 2018/08/28 08:18:13 Copied the comment from adblockpluscore/test/runne
+
+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()
+{
+ let driver;
+
+ return ensureChromium(CHROMIUM_REVISION).then(chromiumPath =>
Sebastian Noack 2018/08/27 19:56:15 Are we going to download a Google Chrome or Chromi
tlucas 2018/08/28 08:18:14 Done.
+ {
+ let devenv = path.resolve("./devenv.chrome");
Sebastian Noack 2018/08/27 19:56:15 Is path.resolve() necessary here?
tlucas 2018/08/28 08:18:14 Yes, "load-extension" (below) requires an absolute
+
+ let options = new chrome.Options()
+ .setChromeBinaryPath(chromiumPath)
+ .addArguments("--no-sandbox")
+ .addArguments(`load-extension=${devenv}`);
+
+ driver = new webdriver.Builder()
Sebastian Noack 2018/08/27 19:56:15 If you just return driver here, that would make th
tlucas 2018/08/28 08:18:14 Done.
+ .forBrowser("chrome")
+ .setChromeOptions(options)
+ .build();
+ }).then(() => driver);
+};

Powered by Google App Engine
This is Rietveld