Created
April 8, 2011 10:01
-
-
Save janmejay/909586 to your computer and use it in GitHub Desktop.
Renders "Failed Tests" list on "Go" "failed build history page" by aggregating data across different jobs and pipeline instances. [Usage: can be installed using Greasemonkey in Firefox OR as a browser extension on Chromium/GoogleChrome]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Better FBH | |
// @namespace Go | |
// @description FBH failed tests aggregator | |
// @include */go/pipelines/*/tests | |
// ==/UserScript== | |
FailedBuildHistory = function() { | |
function add_data_pane(self, holder) { | |
self.body = document.createElement('div'); | |
var line = document.createElement('h3'); | |
line.innerHTML = "Total failing tests: " + self.total_tests; | |
holder.insertBefore(self.body, holder.childNodes[0]); | |
holder.insertBefore(line, self.body); | |
} | |
function load_test_names(self) { | |
self.tests = {}; | |
self.total_tests = 0; | |
var tests = document.getElementsByClassName('test_name'); | |
for(var i = 0; i < tests.length; i++) { | |
var test = tests[i]; | |
var name = test.getElementsByClassName('name')[0].innerHTML; | |
var job_link = test.getElementsByTagName('a')[0]; | |
if (! self.tests[name]) { | |
self.tests[name] = job_link.href; | |
self.total_tests++; | |
} | |
} | |
} | |
function render(self) { | |
var html = "<ul class='list_aggregation' style='width: 400px; margin: 0 0 30px 0;'>"; | |
for(var test in self.tests) { | |
html += "<li style='float:none;'><a href='" + self.tests[test] + "'>" + test + "</a></li>"; | |
} | |
html += "</ul>"; | |
self.body.innerHTML = html; | |
} | |
function init(holder) { | |
load_test_names(this); | |
add_data_pane(this, holder); | |
render(this); | |
}; | |
return init; | |
}(); | |
try { | |
var holder = document.getElementsByClassName('rail')[0]; | |
new FailedBuildHistory(holder); | |
} catch (e) { | |
alert("FBH interpreter failed: " + e); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment