Skip to content

Commit

Permalink
#241 this will enable better parallel runner support
Browse files Browse the repository at this point in the history
  • Loading branch information
lefthandedgoat committed Mar 12, 2016
1 parent 13f9ae2 commit 22e0a1c
Show file tree
Hide file tree
Showing 4 changed files with 324 additions and 41 deletions.
273 changes: 273 additions & 0 deletions docs/files/reporttemplatep.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>canopy test results</title>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/js/bootstrap.min.js"></script>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/css/bootstrap-combined.min.css"rel="stylesheet">
<style>
.masthead ul, .masthead li
{
margin-bottom: 0px;
}

hr
{
margin: 0px 0px 20px 0px;
}
.table.results
{
margin-bottom: 0px;
}

.table.results td
{
border-left: 0px solid #dddddd;
}

.black {
margin-left: 5px;
color: black;
}

.well.mini {
min-height: 0px;
margin-bottom: 0px;
padding: 2px;
position: relative;
top: -3px;
}

.well.mini.clear {
background-color: inherit;
border: none;
-webkit-box-shadow: inherit;
-moz-box-shadow: inherit;
box-shadow: inherit;
top: 0px;
}

.test, .context {
padding: 2px 0 6px 0;
}
</style>
</head>
<body>
<div class="container">
<div class="masthead">
<ul class="nav nav-pills">
<li><a>
<label class="checkbox">
<input id="passedInput" checked="checked" value="" type="checkbox">
<span id="passed">0</span>&nbspPassed
</label>
</a></li>
<li><a>
<label class="checkbox">
<input id="failedInput" checked="checked" value="" type="checkbox">
<span id="failed">0</span>&nbspFailed
</label>
</a></li>
<li><a>
<label class="checkbox">
<input id="todoInput" checked="checked" value="" type="checkbox">
<span id="todo">0</span>&nbspTodo
</label>
</a></li>
<li><a>
<label class="checkbox">
<input id="skippedInput" checked="checked" value="" type="checkbox">
<span id="skipped">0</span>&nbspSkipped
</label>
</a></li>
<li class="pull-right" id="start"><a>
<label>Start:<span class="black"></span>
</label>
</a></li>
<li class="pull-right" id="total"><a>
<label>Total:<span class="black"></span>
</label>
</a></li>
<li class="pull-right hidden" id="environment"><a>
<label>Environment:<span class="black"></span>
</label>
</a></li>
</ul>
</div>
<hr>
<table class="table table-bordered table-condensed" id="contexts">
<tbody>
</tbody>
</table>
</div>
<script type="text/javascript">
var beginContextResults = function (context) {
var ctx = $("#contexts").find('tr[data-context="' + context + '"]');
ctx.after('<tr class="result" data-owning-context="' + context + '"><td><table class="table results"><tbody></tbody></table></td></tr>');
ctx.click(function () {
if ($(this).next().is(":visible")) {
$(this).next().hide();
} else {
$(this).next().show();
}
});
};

var addContext = function (context) {
$("#contexts").last('tr').append('<tr data-context="' + context + '"><td><div class="context"><span class="mini well clear">Context: ' + context + '</span><span class="pull-right mini well hidden context-time">0m 0s</span></div></td></tr>');
beginContextResults(context);
};

var recalculateTotals = function () {
$("#passed").text($(".results .success").length);
$("#failed").text($(".results .error").length);
$("#todo").text($(".results .warning").length);
$("#skipped").text($(".results .info").length);
};

var getContext = function (context) { return $('#contexts tr[data-context="' + context + '"]'); };

var getTest = function (ctx, testName) { return ctx.next('tr').find('table').find('[data-name="' + testName + '"]'); };

var getTestRow = function (ctx, testName) { return getTest(ctx, testName).closest("tr"); };

var addToContext = function (context, testName) {
var ctx = getContext(context);
ctx.next('tr').find('table').append('<tr><td><div class="test" data-name="' + testName + '"><span class="mini well clear">' + testName + '</span><span class="pull-right mini well hidden test-time"></span></div></td></tr>');
};

var updateTestInContext = function (context, testName, passFailSkip, image) {
var ctx = getContext(context);
var testRow = getTestRow(ctx, testName);

if (passFailSkip === "Pass") {
testRow.addClass('success');
if (ctx.hasClass("error") === false) {
ctx.removeClass("warning").removeClass("info").addClass("success");
}
}
if (passFailSkip === "Fail") {
testRow.addClass('error');
ctx.removeClass("success").removeClass("warning").removeClass("info").addClass("error");
}
if (passFailSkip === "Todo") {
testRow.addClass('warning');
if (ctx.hasClass("error") === false && ctx.hasClass("info") === false && ctx.hasClass("success") === false){
ctx.addClass("warning");
}
}
if (passFailSkip === "Skip") {
testRow.addClass('info');
if (ctx.hasClass("error") === false && ctx.hasClass("warning") === false && ctx.hasClass("success") === false){
ctx.addClass("info");
}
}

if(image !== "") {
testRow.find('td').last().append('<div><img alt="" src="data:image/jpeg;base64,' + image + '" /></div>')
}

recalculateTotals();
};

var addUrlToTest = function (context, testName, url) {
var ctx = getContext(context);
getTestRow(ctx, testName).after('<div class="url"><pre>' + url + '</pre></div>');
};

var addStackToTest = function (context, testName, stack) {
var ctx = getContext(context);
getTestRow(ctx, testName).after('<div class="stack"><pre>' + stack + '</pre></div>');
};

var addTimeToTest = function (context, testName, time) {
var ctx = getContext(context);
getTest(ctx, testName).find('.test-time').removeClass('hidden').text(time);
};

var addTimeToContext = function (context, time) {
var ctx = getContext(context);
ctx.find('.context-time').removeClass('hidden').text(time);
};

var setTotalTime = function (time) {
$("#total .black").text(time);
};

var setStartTime = function (time) {
$("#start .black").text(time);
};

var setEnvironment = function (environment) {
$("#environment").removeClass('hidden').find(".black").text(environment);
};

var addMessageToTest = function (context, message) {
var ctx = getContext(context);
if(ctx.next('tr').find('table').last('tr').find('.test').last().siblings('pre').length === 0) {
ctx.next('tr').find('table').last('tr').find('.test').last().after('<pre><ol class="message"><li>' + message + '</li></ol></pre>');
} else {
ctx.next('tr').find('table').last('tr').find('.test').last().siblings('pre').find('ol').append('<li>' + message + '</li>');
}
};

var addMessageToTestByName = function (context, testName, message) {
var ctx = getContext(context);
var test = getTest(ctx, testName);
if(test.siblings('pre').length === 0) {
test.after('<pre><ol class="message"><li>' + message + '</li></ol></pre>');
} else {
test.siblings('pre').find('ol').append('<li>' + message + '</li>');
}
};

var collapseContextsExcept = function (context) {
var ctxs = $('#contexts tr.result[data-owning-context !="' + context + '"]');
ctxs.each(function () {
$(this).hide();
});
};

$(document).ready(function() {
var showHide = function(next) {
if (next.is(":visible")) {
next.hide();
} else {
next.show();
}
};

//wire up to existing contexts on the page
var ctx = $('#contexts tr[data-context]').each(function(i, c) {
var $c = $(c);
if ($c.is('.error, .warning')) showHide($c.next()); //if there is an error show it.
$c.click(function () {
var next = $(this).next();
showHide(next);
});
});

var toggleRowClass = function(el, klass) {
var show = $(el).is(":checked")
$('tr.result .' + klass).toggle(show);
}

$("#passedInput").change(function () {
toggleRowClass(this, 'success');
});

$("#failedInput").change(function () {
toggleRowClass(this, 'error');
});

$("#todoInput").change(function () {
toggleRowClass(this, 'warning');
});

$("#skippedInput").change(function () {
toggleRowClass(this, 'info');
});
});
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion src/canopy/canopy.fs
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ let coverage (url : 'a) =
let p = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"canopy\")
let f = sprintf "Coverage_%s" (DateTime.Now.ToString("MMM-d_HH-mm-ss-fff"))
let ss = screenshot p f
reporter.coverage nonMutableInnerUrl ss
reporter.coverage nonMutableInnerUrl ss nonMutableInnerUrl

let addFinder finder =
let currentFinders = configuredFinders
Expand Down
Loading

0 comments on commit 22e0a1c

Please sign in to comment.