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

Unified Diff: test/all.js

Issue 29866577: Issue 6887 - add Chrome to "npm test" (Closed)
Patch Set: Created Aug. 28, 2018, 8:17 a.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/all.js
diff --git a/test/all.js b/test/all.js
new file mode 100644
index 0000000000000000000000000000000000000000..708cec41a7fe2073900e2b4778fa292a356e34c1
--- /dev/null
+++ b/test/all.js
@@ -0,0 +1,80 @@
+/*
+ * 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 */
+
+"use strict";
+
+const glob = require("glob");
+const path = require("path");
+const {exec} = require("child_process");
+
+for (let browser of glob.sync("./test/browsers/*.js"))
+{
+ let module = require(path.resolve(browser));
+
+ describe(module.platform, function()
+ {
+ this.timeout(0);
+
+ let driver;
+ let origin;
+
+ before(() =>
+ new Promise((resolve, reject) =>
+ {
+ exec(`python build.py devenv -t ${module.platform}`,
+ (error, stdout, stderr) =>
+ {
+ if (error)
+ {
+ console.error(error);
+ reject(stderr);
Sebastian Noack 2018/08/28 14:44:58 It seems you got it the wrong way around. You want
tlucas 2018/08/29 09:16:53 Done.
+ }
+ else resolve(stdout);
+ });
+ }
+ ).then(() =>
Sebastian Noack 2018/08/28 14:44:58 Nit: The indention is off here. Closing parenthesi
tlucas 2018/08/29 09:16:53 re indented here and above (at "new Promise")
+ module.getDriver().then(d =>
+ {
+ driver = d;
+ return driver.wait(() =>
+ driver.getAllWindowHandles().then(handles => handles[1])
+ );
+ }).then(handle =>
+ driver.switchTo().window(handle)
+ ).then(() =>
+ driver.executeScript("return location.origin;")
+ ).then(o =>
+ {
+ origin = o;
+ })
+ ));
+
+ for (let file of glob.sync("./test/wrappers/*.js"))
+ {
+ let testModule = require(path.resolve(file));
+
+ it(testModule.title, () =>
+ {
+ return testModule.it(driver, origin);
+ });
+ }
+
+ after(() => driver.quit());
+ });
+}

Powered by Google App Engine
This is Rietveld