Index: test/wrappers/qunit.js |
diff --git a/test/wrappers/qunit.js b/test/wrappers/qunit.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5ccb76db7ae9e90e26d4d1814699ef0219437437 |
--- /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/>. |
+ */ |
+ |
+/* eslint-env mocha */ |
Sebastian Noack
2018/09/01 10:42:47
Since there are now multiple files requiring a moc
tlucas
2018/09/01 11:54:24
Done.
|
+ |
+"use strict"; |
+ |
+const webdriver = require("selenium-webdriver"); |
+const {By, until} = webdriver; |
Sebastian Noack
2018/09/01 10:42:47
Nit: Unused imports? I don't see webdriver, By and
tlucas
2018/09/01 11:54:24
You are right about "webdriver",however "By" and "
|
+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)) |
+ ))) |
+ ))); |
+}); |