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

Unified Diff: test/runners/webdriver.js

Issue 29874649: Issue 6822 - Report browser test errors (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: eslint fixes Created Sept. 20, 2018, 10:26 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
Index: test/runners/webdriver.js
===================================================================
--- a/test/runners/webdriver.js
+++ b/test/runners/webdriver.js
@@ -19,26 +19,32 @@
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);
+ return driver.quit().then(() =>
+ {
+ if (result.failures != 0)
+ return Promise.reject(name);
Sebastian Noack 2018/09/21 14:22:21 Nit: You can just use throw here.
hub 2018/09/21 15:39:35 Done.
+ });
+ }, error =>
+ {
+ return driver.quit().then(() => Promise.reject(error));
Sebastian Noack 2018/09/21 14:22:20 Please leave a comment that this code should be re
Sebastian Noack 2018/09/21 14:22:21 Now, we call driver.quit() twice if there are any
hub 2018/09/21 15:39:35 No we don't. We are on the rejection handler for t
hub 2018/09/21 15:39:35 Done.
Sebastian Noack 2018/09/21 15:58:46 You are right. I misread the code, I thought we ar
+ });
}
module.exports.executeScript = executeScript;

Powered by Google App Engine
This is Rietveld