Make the selenium test log the content of the /assert report to the console

pull/1/head
Caleb James DeLisle 8 years ago
parent 6c5e8d3118
commit 512c1b12f4

@ -19,12 +19,15 @@ if (process.env.SAUCE_USERNAME !== undefined) {
driver.get('http://localhost:3000/assert/'); driver.get('http://localhost:3000/assert/');
var report = driver.wait(WebDriver.until.elementLocated(WebDriver.By.className("report")), 5000); var report = driver.wait(WebDriver.until.elementLocated(WebDriver.By.className("report")), 5000);
report.getAttribute("class").then(function (cls) { report.getAttribute("class").then(function (cls) {
driver.quit(); report.getText().then(function (text) {
if (!cls) { console.log("\n-----\n" + text + "\n-----");
throw new Error("cls is null"); driver.quit();
} else if (cls.indexOf("failure") !== -1) { if (!cls) {
throw new Error("cls contains the word failure"); throw new Error("cls is null");
} else if (cls.indexOf("success") === -1) { } else if (cls.indexOf("failure") !== -1) {
throw new Error("cls does not contain the word success"); throw new Error("cls contains the word failure");
} } else if (cls.indexOf("success") === -1) {
throw new Error("cls does not contain the word success");
}
});
}); });

Loading…
Cancel
Save