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

Unified Diff: test/wrappers/qunit.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
« test/browsers/chromium.js ('K') | « test/firefox.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/wrappers/qunit.js
diff --git a/test/wrappers/qunit.js b/test/wrappers/qunit.js
new file mode 100644
index 0000000000000000000000000000000000000000..b8f14002b7d1ae7a43831de08a44d4ba568b1701
--- /dev/null
+++ b/test/wrappers/qunit.js
@@ -0,0 +1,44 @@
+/*
+ * 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 webdriver = require("selenium-webdriver");
+const {By, until} = webdriver;
+const assert = require("assert");
+
+exports.title = "qunit";
+
+exports.it = function(driver, origin)
+{
+ return driver.navigate().to(origin + "/qunit/index.html").then(() =>
+ // Wait for qunit-results to be present
+ driver.wait(until.elementLocated(By.id("qunit-testresult")))
+ ).then(() =>
+ // Wait for tests to finish
+ driver.wait(() =>
+ driver.findElement(By.id("qunit-testresult"))
+ .getAttribute("innerHTML").then(data =>
+ data.includes("Tests completed")))
+ ).then(() => Promise.all([[true, ".pass"], [false, ".fail"]].map(
+ ([success, sel]) => driver.findElements(
+ By.css(`#qunit-tests ${sel} .test-name`)
+ ).then(elements => Promise.all(elements.map(elem =>
+ elem.getAttribute("textContent").then(data => assert.ok(success, data))
+ )))
+ )));
+};
« test/browsers/chromium.js ('K') | « test/firefox.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld