Skip to content

Commit

Permalink
(#2824) - Get console from running saucelabs failures
Browse files Browse the repository at this point in the history
  • Loading branch information
daleharvey committed Jan 9, 2016
1 parent b94f4b8 commit b933b98
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/integration/test.basics.js
Expand Up @@ -3,6 +3,7 @@
var adapters = ['http', 'local'];

adapters.forEach(function (adapter) {

describe('test.basics.js-' + adapter, function () {

var dbs = {};
Expand Down
27 changes: 27 additions & 0 deletions tests/integration/webrunner.js
Expand Up @@ -75,7 +75,32 @@ function startTests() {

function onReady() {
modifyGlobals();

var runner = mocha.run();

// Capture logs for selenium output
var logs = [];

(function(){

var oldLog = console.log;
console.log = function() {
var args = Array.prototype.slice.call(arguments);
args.unshift('log');
logs.push(args);
oldLog.apply(console, arguments);
};

var oldError = console.error;
console.error = function() {
var args = Array.prototype.slice.call(arguments);
args.unshift('error');
logs.push(args);
oldError.apply(console, arguments);
};

})();

window.results = {
browser: navigator.userAgent,
lastPassed: '',
Expand All @@ -90,6 +115,7 @@ function startTests() {
});

runner.on('fail', function (e) {
window.results.logs = logs;
window.results.failed++;
window.results.failures.push({
title: e.title,
Expand All @@ -99,6 +125,7 @@ function startTests() {
});

runner.on('end', function () {
window.results.logs = logs;
window.results.completed = true;
window.results.passed++;
});
Expand Down

0 comments on commit b933b98

Please sign in to comment.