Skip to content

Commit

Permalink
As an enhancement to the distributed testing efforts, the receipt/rep…
Browse files Browse the repository at this point in the history
…ort which is being automatically collected by Reel server is now human-readably dumped at the bottom of the test page for complete transparency. As as consequence the result link now points to the bottom of the page rather than the raw JSON report stored on the server.
  • Loading branch information
pisi committed Oct 29, 2011
1 parent 4e7807b commit f62ae07
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
4 changes: 2 additions & 2 deletions test/index.html
Expand Up @@ -44,8 +44,8 @@ <h2 id="qunit-banner"></h2>
<div id="call">
<h2>Wow, you've just found an error. Cool :) And thanks!</h2>
<p>
It's been automatically <a id="result_link" href="#" title="View the report - beware, it's raw">reported and collected</a> in our database. Don't worry, it's all <u>anonymous</u>.
If you want to help us further, please run this test on as many devices as you can.
It's been automatically <a id="result_link" href="#receipt" title="View the report">reported and collected</a> in our database. Don't worry, it's all <u>anonymous</u>.
If you want to help us all further, please run this test on as many devices as you can.
</p>
<p>
<strong>Thank you for taking part in distributed testing of Reel! Together we are powerful.</strong>
Expand Down
19 changes: 18 additions & 1 deletion test/tests.js
Expand Up @@ -68,9 +68,26 @@
agent: $('#qunit-userAgent').html()
}

$('#result_link').attr('href', server+'/view/reel/testrun/result/'+timestamp);
$('<a/>', { name: 'receipt' }).appendTo('#qunit-testresult');
formatted(report, 'Carbon copy of the receipt, which has been sent out to central Reel test server. Thank you!').appendTo( $('<ul/>').appendTo('#qunit-testresult') );
$.post(server+'/collect/reel/testrun/results', report);

function formatted( bit, label ){
var $result= $('<li/>')
if( typeof bit == 'object' ){
if( typeof bit.length != 'number' || bit.length > 0 ){ // Object/Array
$result.text( label+':' );
var $list= $('<ul/>').appendTo( $result )
$.each( bit, function( label, value ){
$list.append( formatted(value, label) );
} );
}
}else{ // Value
$result.html( label+': '+bit );
}
return $result
}

function dump($collection){
var collection = [];
$collection.each(function(){
Expand Down

0 comments on commit f62ae07

Please sign in to comment.