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

Unified Diff: test/wrappers/qunit.js

Issue 29890620: Noissue - Simplified qunit test wrapper (Closed)
Patch Set: Created Sept. 24, 2018, 6:50 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/wrappers/qunit.js
===================================================================
--- a/test/wrappers/qunit.js
+++ b/test/wrappers/qunit.js
@@ -23,19 +23,13 @@
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(elem =>
Sebastian Noack 2018/09/24 18:56:05 .wait(until.elementLocated(...)) returns a promise
+ this.driver.wait(until.elementTextContains(elem, "Tests completed"))
Sebastian Noack 2018/09/24 18:56:05 There is a pre-defined condition to wait for an el
).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))
- )))
- )));
+ this.driver.findElement(By.css("#qunit-tests .fail .test-name")).then(
+ elem => elem.getAttribute("textContent").then(name => assert.fail(name)),
Sebastian Noack 2018/09/24 18:56:05 Mocha only reports the first failure, it doesn't r
+ () => null
+ )
+ )
});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld