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: Removed unused this.platform Created Sept. 1, 2018, 3:12 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
« no previous file with comments | « test/.eslintrc.json ('k') | test/browsers/chromium.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/all.js
diff --git a/test/all.js b/test/all.js
new file mode 100644
index 0000000000000000000000000000000000000000..a5a9d9ba3636f24b2ab3f3b343c4e821ed92292d
--- /dev/null
+++ b/test/all.js
@@ -0,0 +1,81 @@
+/*
+ * 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";
+
+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);
+
+ before(function()
+ {
+ return Promise.all([
+ module.ensureBrowser(),
+ new Promise((resolve, reject) =>
+ {
+ exec(`python build.py devenv -t ${module.platform}`,
+ (error, stdout, stderr) =>
+ {
+ if (error)
+ {
+ console.error(stderr);
+ reject(error);
+ }
+ else resolve(stdout);
+ });
+ })
+ ]).then(([browserBinary]) =>
+ {
+ this.driver = module.getDriver(
+ browserBinary,
+ path.resolve(`./devenv.${module.platform}`)
+ );
+ return this.driver.wait(() =>
+ this.driver.getAllWindowHandles().then(handles => handles[1])
+ );
+ }).then(handle =>
+ this.driver.switchTo().window(handle)
+ ).then(() =>
+ this.driver.executeScript("return location.origin;")
+ ).then(origin =>
+ {
+ this.origin = origin;
+ });
+ });
+
+ for (let file of glob.sync("./test/wrappers/*.js"))
+ {
+ // Reload the module(s) for every browser
+ let modulePath = path.resolve(file);
+ delete require.cache[require.resolve(modulePath)];
+ require(modulePath);
+ }
+
+ after(function()
+ {
+ this.driver.quit();
+ });
+ });
+}
« no previous file with comments | « test/.eslintrc.json ('k') | test/browsers/chromium.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld