Index: test/runners/webdriver.js |
=================================================================== |
--- a/test/runners/webdriver.js |
+++ b/test/runners/webdriver.js |
@@ -19,26 +19,31 @@ |
function executeScript(driver, name, script, scriptName, scriptArgs) |
{ |
let realScript = `let f = ${script} |
let callback = arguments[arguments.length - 1]; |
return Promise.resolve() |
.then(() => f(...arguments)) |
.then(() => callback());`; |
- return driver.executeScript(`window.consoleLogs = []; |
- let oldLog = console.log; |
+ return driver.executeScript(`let oldLog = console.log; |
console.log = msg => { |
- window.consoleLogs.push(msg); |
+ window._consoleLogs.log.push(msg); |
oldLog.call(this, msg); |
};`) |
.then(() => driver.executeAsyncScript(realScript, scriptArgs)) |
- .then(() => driver.executeScript("return window.consoleLogs;")) |
+ .then(() => driver.executeScript("return window._consoleLogs;")) |
.then(result => |
{ |
console.log(`\nBrowser tests in ${name}\n`); |
- result.forEach(item => console.log(item)); |
- }) |
- .then(() => driver.quit()) |
- ; |
+ for (let item of result.log) |
+ console.log(item); |
+ driver.quit(); |
+ if (result.failures != 0) |
+ return Promise.reject(name); |
+ }, error => |
+ { |
+ driver.quit(); |
+ return Promise.reject(error); |
+ }); |
} |
module.exports.executeScript = executeScript; |