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. 29, 2018, 9:15 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..713bc5eaa8c761eb2305e035bd3677ccaa868f5c
--- /dev/null
+++ b/test/all.js
@@ -0,0 +1,78 @@
+/*
+ * 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) =>
Sebastian Noack 2018/08/30 02:02:40 I just noticed, getting the driver and setting up
tlucas 2018/09/01 09:38:31 Correct me if i'm wrong - but couldn't it then hap
Sebastian Noack 2018/09/01 10:42:47 My bad, you are right. However, what we can do, an
tlucas 2018/09/01 11:54:23 Done (almost, nodejs complained about an unexpecte
Sebastian Noack 2018/09/01 12:26:33 Right, you have to use parenthesis if you want to
tlucas 2018/09/01 14:46:44 Done.
+ {
+ exec(`python build.py devenv -t ${module.platform}`,
+ (error, stdout, stderr) =>
+ {
+ if (error)
+ {
+ console.error(stderr);
+ reject(error);
+ }
+ else resolve(stdout);
+ });
+ }).then(() => module.getDriver(path.resolve(`./devenv.${module.platform}`))
+ .then(d =>
Sebastian Noack 2018/08/29 15:22:12 Nit: The indentation seems a little inconsistent.
tlucas 2018/09/01 09:38:31 Should be resolved now.
+ {
+ 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());
+ });
+}
« no previous file with comments | « package.json ('k') | test/browsers/chromium.js » ('j') | test/browsers/firefox.js » ('J')

Powered by Google App Engine
This is Rietveld