Better formated test result output

This commit is contained in:
Ozzieisaacs 2018-12-28 13:46:53 +01:00
parent d0fd1a4601
commit 7255c26568
2 changed files with 124 additions and 2165 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +1,47 @@
output_list = Array(); output_list = Array();
/* Level - 0: Summary; 1: Failed; 2: All; 3: Skipped */ /* Level - 0: Summary; 1: Failed; 2: All; 3: Skipped 4: Error*/
function showCase(level) { function showCase(level) {
table_rows = document.getElementsByTagName("tr"); table_rows = document.getElementsByTagName("tr");
for (var i = 0; i < table_rows.length; i++) { for (var i = 0; i < table_rows.length; i++) {
row = table_rows[i]; row = table_rows[i];
id = row.id; id = row.id;
// Show failed if all or failed or summary problems selected
if (id.substr(0,2) == 'ft') { if (id.substr(0,2) == 'ft') {
if (level < 1 || level == 3) { if (level == 2|| level == 1 || level == 5 ) {
row.classList.add('hiddenRow');
}
else {
row.classList.remove('hiddenRow'); row.classList.remove('hiddenRow');
} }
else {
row.classList.add('hiddenRow');
} }
}
// Show passed if all selected
if (id.substr(0,2) == 'pt') { if (id.substr(0,2) == 'pt') {
if (level > 1 && level != 3) { if (level == 2 ) {
row.classList.remove('hiddenRow'); row.classList.remove('hiddenRow');
} }
else { else {
row.classList.add('hiddenRow'); row.classList.add('hiddenRow');
} }
} }
// Show skipped if all or skipped or summary problems selected
if (id.substr(0,2) == 'st') { if (id.substr(0,2) == 'st') {
if (level >=2) { if (level ==2 || level ==3 || level == 5) {
row.classList.remove('hiddenRow');
}
else {
row.classList.add('hiddenRow');
}
}
// Show error if all or error or summary problems selected
if (id.substr(0,2) == 'et') {
if (level ==4 || level == 2 || level == 5 ) {
row.classList.remove('hiddenRow'); row.classList.remove('hiddenRow');
} }
else { else {
row.classList.add('hiddenRow'); row.classList.add('hiddenRow');
} }
} }
} }
} }
@ -51,6 +62,10 @@ function showClassDetail(class_id, count) {
testcase_id = 's' + testcase_postfix_id; testcase_id = 's' + testcase_postfix_id;
testcase = document.getElementById(testcase_id); testcase = document.getElementById(testcase_id);
} }
if (!testcase) {
testcase_id = 'e' + testcase_postfix_id;
testcase = document.getElementById(testcase_id);
}
testcases_list[i] = testcase; testcases_list[i] = testcase;
if (testcase.classList.contains('hiddenRow')) { if (testcase.classList.contains('hiddenRow')) {
all_hidden = false; all_hidden = false;
@ -89,22 +104,9 @@ function html_escape(s) {
return s; return s;
} }
/* obsoleted by detail in <div> // rgb(38, 154, 188)#31b0d5
function showOutput(id, name) {
var w = window.open("", //url
name,
"resizable,scrollbars,status,width=800,height=450");
d = w.document;
d.write("<pre>");
d.write(html_escape(output_list[id]));
d.write("\n");
d.write("<a href='javascript:window.close()'>close</a>\n");
d.write("</pre>\n");
d.close();
}
*/
function drawCircle(pass, fail, error, skip){ function drawCircle(pass, fail, error, skip){
var color = ["#5cb85c","#d9534f","#c00","#f0ad4e"]; var color = ["#5cb85c","#d9534f","#31b0d5","#f0ad4e"];
var data = [pass,fail,error,skip]; var data = [pass,fail,error,skip];
var text_arr = ["pass", "fail", "error","skip"]; var text_arr = ["pass", "fail", "error","skip"];
@ -136,21 +138,21 @@ function drawCircle(pass, fail, error, skip){
function show_img(obj) { function show_img(obj) {
var obj1 = obj.nextElementSibling var obj1 = obj.nextElementSibling
obj1.style.display='block' obj1.style.display='block'
var index = 0;//每张图片的下标, var index = 0;
var len = obj1.getElementsByTagName('img').length; var len = obj1.getElementsByTagName('img').length;
var imgyuan = obj1.getElementsByClassName('imgyuan')[0] var imgyuan = obj1.getElementsByClassName('imgyuan')[0]
//var start=setInterval(autoPlay,500); //var start=setInterval(autoPlay,500);
obj1.onmouseover=function(){//当鼠标光标停在图片上,则停止轮播 obj1.onmouseover=function(){
clearInterval(start); clearInterval(start);
} }
obj1.onmouseout=function(){//当鼠标光标停在图片上,则开始轮播 obj1.onmouseout=function(){
start=setInterval(autoPlay,1000); start=setInterval(autoPlay,1000);
} }
for (var i = 0; i < len; i++) { for (var i = 0; i < len; i++) {
var font = document.createElement('font') var font = document.createElement('font')
imgyuan.appendChild(font) imgyuan.appendChild(font)
} }
var lis = obj1.getElementsByTagName('font');//得到所有圆圈 var lis = obj1.getElementsByTagName('font');
changeImg(0) changeImg(0)
var funny = function (i) { var funny = function (i) {
lis[i].onmouseover = function () { lis[i].onmouseover = function () {
@ -165,12 +167,12 @@ function show_img(obj) {
function autoPlay(){ function autoPlay(){
if(index>len-1){ if(index>len-1){
index=0; index=0;
clearInterval(start); //运行一轮后停止 clearInterval(start);
} }
changeImg(index++); changeImg(index++);
} }
imgyuan.style.width= 25*len +"px"; imgyuan.style.width= 25*len +"px";
//对应圆圈和图片同步
function changeImg(index) { function changeImg(index) {
var list = obj1.getElementsByTagName('img'); var list = obj1.getElementsByTagName('img');
var list1 = obj1.getElementsByTagName('font'); var list1 = obj1.getElementsByTagName('font');