Skip to content

Commit

Permalink
tidied up the reports, non critical failures now clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
iantmoore committed Oct 23, 2016
1 parent 3a126cd commit d457973
Show file tree
Hide file tree
Showing 9 changed files with 332 additions and 365 deletions.
13 changes: 13 additions & 0 deletions core/src/main/resources/static/css/substeps.css
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,16 @@ i.jstree-icon.jstree-themeicon.NON_CRITICAL_FAILURE.jstree-themeicon-custom
background-position: center center;
}

label.icon-key
{
font-weight: normal;
padding-left: 5px;
padding-right: 5px;
margin-bottom: 0px;
}

img.key-img {
width: 20px;
height: 20px;
}

16 changes: 16 additions & 0 deletions core/src/main/resources/static/css/usage.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
circle {
fill: #C02D05;
stroke: #59801A;
stroke-width: 32;
}

circle.not-run {
stroke: #f0ad4e;
}

svg {
width: 22px; height: 22px;
transform: rotate(-90deg);
background:#C02D05;
border-radius: 50%;
}
97 changes: 30 additions & 67 deletions core/src/main/resources/static/js/substeps.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,73 +58,7 @@ $(document).ready(function() {

});

// "fnCreatedRow": function( nRow, aData, iDisplayIndex ) {
// /* Append the grade to the default row class name */
// if ( aData[4] > "0" )
// {
// $(nRow).addClass( "error_row");
// }
// return nRow;
// },

// "aoColumns": [
// { "sTitle": "Tag" },
// { "sTitle": "Features" },
// { "sTitle": "Features run" },
// { "sTitle": "Features passed" },
// { "sTitle": "Features failed" },
// { "sTitle": "Features success" }
// ],
// "aoColumnDefs": [
// {
// "fnRender": function ( oObj ) {
// return oObj.aData[5] +' %';
// },
// "aTargets": [ 5 ]
// }]







// $('#scenario-stats-div').html( '<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="scenario-stats-table"></table>' );

// $('#scenario-stats-table').dataTable( {
// "bPaginate": true,
// "bFilter": false,
// "bSort": true,
// "aaSorting": [[ 4, "desc" ]],
// "aaData": scenarioStatsData,

// "fnCreatedRow": function( nRow, aData, iDisplayIndex ) {
// /* Append the grade to the default row class name */
// if ( aData[4] > "0" )
// {
// $(nRow).addClass( "error_row");
// }
// return nRow;
// },

// "aoColumns": [
// { "sTitle": "Tag" },
// { "sTitle": "Scenarios" },
// { "sTitle": "Scenarios run" },
// { "sTitle": "Scenarios passed" },
// { "sTitle": "Scenarios failed" },
// { "sTitle": "Scenarios success" }
// ],
// "aoColumnDefs": [
// {
// "fnRender": function ( oObj ) {
// return oObj.aData[5] +' %';
// },
// "aTargets": [ 5 ]
// }]
// } );





$(document).ready(function() {
Expand All @@ -140,12 +74,41 @@ $(document).ready(function() {
}
});

$("#hide-not-run-chk").bind("click", function(event){
var result = document.evaluate('//li[a/i[contains(@class, "NOT_RUN")]]', document.documentElement, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
for (var i = 0; i < result.snapshotLength; i++) {

if (event.target.checked) {
result.snapshotItem(i).style.display = 'none'
}
else {
result.snapshotItem(i).style.display = 'block'
}
}

});
});

function formatStackElement(item, index){
return "<li>" + item + "</li>"
}


function toggle(id){

elem = document.getElementById(id);
if (elem.style.display == 'none') {
elem.style.display = 'block';

} else {
elem.style.display = 'none';
}
}





$(function () {
$('#feature-tree')
.on('select_node.jstree', function (e, data) {
Expand Down
228 changes: 228 additions & 0 deletions core/src/main/resources/static/js/usage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@

var svgTemplate = Handlebars.compile( '<svg viewBox="0 0 32 32" style="margin-right:4px"> ' +
'<title>{{passPC}}% Pass {{notRunPC}}% Not run {{failPC}}% Fail</title> ' +
'<circle r="16" cx="16" cy="16" stroke-dasharray="{{passPC}} 100"></circle> ' +
'<circle class="not-run" r="16" cx="16" cy="16" stroke-dashoffset="-{{passPC}}" stroke-dasharray="{{notRunPC}} 100" fill-opacity="0.0"></circle> ' +
'</svg>');

var stepImplUsageRowTemplate = Handlebars.compile(' <div class="row-fluid">' +
'<div class="col-md-2">{{{result}}}</div>' +
'<div class="col-md-7">{{line}}</div>' +
'<div class="col-md-3">{{file}}:{{lineNumber}}</div>' +
'</div>');


var stepImplUsageDetailTemplate = Handlebars.compile(' <div class="row-fluid">' +
'<h4>Usages</h4>' +
'</div>' +
'<div class="row-fluid">' +
'<p style="word-break: break-all;">{{method}}</p>' +
'</div>' +
'{{{usageRows}}}');


$(document).ready(function() {

$("#step-impls-usage-tree").jstree({
"core":{
"data":stepImplUsageTreeData,
"progressive_render":true,
"themes" : {
"dots" : true,
"icons" : true
},
"multiple" : false
}
});

$("#substep-usage-tree").jstree({
"core":{
"data":substepDefUsageTreeData,
"progressive_render":true,
"themes" : {
"dots" : true,
"icons" : true
},
"multiple" : false
}
});

$('#uncalled-step-impls-table').DataTable({
paging: false,
searching: false,
"data": uncalledStepImplementations,
"columns": [
{data: 'value', title: "Value"},
{data: 'implementedIn', title: "implemented in"},
{data: 'method', title: "method"},
{data: 'keyword', title: "Keyword"}
],
"dom" : "<'row-fluid'<'col-sm-6'l><'col-sm-6'f>>" +
"<'row-fluid'<'col-sm-12'tr>>" +
"<'row-fluid'<'col-sm-5'i><'col-sm-7'p>>"
});


$('#uncalled-substeps-table').DataTable({
paging: false,
searching: false,
"data": uncalledStepDefs,
"columns": [
{data: 'line', title: "Line"},
{data: 'source', title: "source"},
{data: 'lineNumber', title: "number"}
],
"dom" : "<'row-fluid'<'col-sm-6'l><'col-sm-6'f>>" +
"<'row-fluid'<'col-sm-12'tr>>" +
"<'row-fluid'<'col-sm-5'i><'col-sm-7'p>>"
});


});

$(function () {
$('#substep-usage-tree')
.on('select_node.jstree', function (e, data) {

var liattr = data.node.li_attr["data-substep-def-call"]
if (typeof liattr === "undefined"){
$("#substep-usage-detail").html("");
}
else {

var substepDefDetail = "<p>" + data.node.li_attr["data-substep-def-call"] +"</p>";

$("#substep-usage-detail").html(substepDefDetail);

}

}).jstree();
});

$(function () {
$('#step-impls-usage-tree')
.on('select_node.jstree', function (e, data) {

var liattr = data.node.li_attr["data-stepimpl-method"];

if (typeof liattr === "undefined"){
$("#step-impl-usage-detail").html("");
}
else
{
var nodeIds = data.node.li_attr["data-stepimpl-node-ids"].split(",");

var context = {method: data.node.li_attr["data-stepimpl-method"], usageRows : nodeIds.map(getStepImplUsageDetail).join(" ")};
var detailhtml = stepImplUsageDetailTemplate(context);

$("#step-impl-usage-detail").html(detailhtml);

// get the offset of where we should be?
var topOffsetShouldbe = $("#step-impl-detail-div-container").offset().top;

// get the offset of the affixed div
var affixOffset = $("#step-impl-affix-marker").offset().top;

// so the absolute position position, relative to the parent should be affixOffset - topOffsetShouldbe
var absPosition = affixOffset - topOffsetShouldbe;

if (absPosition < 0){
absPosition = 0;
}

$("#step-impl-usage-detail").css("top", absPosition + 'px');

$("#step-impl-usage-detail").css("width", ($("#step-impl-detail-div-container").width));
}
})
.jstree();
});

$(function () {
$('#step-impls-usage-tree')
.on('ready.jstree', function (e, data) {

$("li[data-stepimpl-method]").each(function(i, li) {

// li/a/i - insert into there
var treeIconPlaceholder = $(li).find("> a > i");


var passPc = parseFloat($(li).attr("data-stepimpl-passpc"));
var failPC = parseFloat($(li).attr("data-stepimpl-failpc"));
var notRunPC = parseFloat($(li).attr("data-stepimpl-notrunpc"));

var context = {passPC: passPc, notRunPC : notRunPC, failPC : failPC};
var html = svgTemplate(context);

$(treeIconPlaceholder).html(html)
});

}).jstree();
});

$(function () {
$('#substep-usage-tree')
.on('ready.jstree', function (e, data) {

$("li[data-substep-def]").each(function(i, li) {

// li/a/i - insert into there
var treeIconPlaceholder = $(li).find("> a > i");


var passPc = parseFloat($(li).attr("data-substepdef-passpc"));
var failPC = parseFloat($(li).attr("data-substepdef-failpc"));
var notRunPC = parseFloat($(li).attr("data-substepdef-notrunpc"));

var context = {passPC: passPc, notRunPC : notRunPC, failPC : failPC};
var html = svgTemplate(context);

$(treeIconPlaceholder).html(html)
});

}).jstree();
});

$('#substep-usage-show-hide').on('click', function () {

toggleShowHide(this);

});

$('#stepimpl-usage-show-hide').on('click', function () {

toggleShowHide(this);

});

function toggleShowHide(elem){
if ($(elem).text() == 'Hide') {
$(elem).text('Show')
}
else {
$(elem).text('Hide');
}
}

function getStepImplUsageDetail(id) {

var detailJSON = detail[id];
var result;
if (detailJSON.result == "PASSED"){
result = '<span class="label label-success">Passed</span>';
}
else if (detailJSON.result == "NOT_RUN"){
result = '<span class="label label-warning">Not run</span>';
}
else if (detailJSON.result == "FAILED"){
result = '<span class="label label-danger">Failed</span>';
}
else if (detailJSON.result == "CHILD_FAILED"){
result = '<span class="label label-info">Child failed</span>';
}

var context = {result:result,line:detailJSON.description,file:detailJSON.filename, lineNumber:detailJSON.lineNum};
return stepImplUsageRowTemplate(context);
}

1 change: 1 addition & 0 deletions core/src/main/scala/org/substeps/report/Model.scala
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ case object State {
result match {
case "CHILD_FAILED" => State(true)
case "FAILED" => State(true)
case "NON_CRITICAL_FAILURE" => State(true)
case _ => State(false)
}

Expand Down
Loading

0 comments on commit d457973

Please sign in to comment.