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 Sept. 1, 2018, 2:46 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/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..f0f7cfcae882fb7b111ab172ed54a6b1a7b72669
--- /dev/null
+++ b/test/wrappers/qunit.js
@@ -0,0 +1,41 @@
+/*
+ * 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 {By, until} = require("selenium-webdriver");
+const assert = require("assert");
+
+it("qunit", function()
+{
+ return this.driver.navigate().to(this.origin + "/qunit/index.html").then(() =>
+ // Wait for qunit-results to be present
+ this.driver.wait(until.elementLocated(By.id("qunit-testresult")))
+ ).then(() =>
+ // Wait for tests to finish
+ this.driver.wait(() =>
+ this.driver.findElement(By.id("qunit-testresult"))
+ .getAttribute("innerHTML").then(data =>
+ data.includes("Tests completed")))
+ ).then(() => Promise.all([[true, ".pass"], [false, ".fail"]].map(
+ ([success, sel]) => this.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))
+ )))
+ )));
+});
« no previous file with comments | « test/firefox.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld