OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <style> | 2 <style> |
3 html { | 3 html { |
4 height: 100%; | 4 height: 100%; |
5 } | 5 } |
6 body { | 6 body { |
7 margin: 0; | 7 margin: 0; |
8 font-family: Helvetica, sans-serif; | 8 font-family: Helvetica, sans-serif; |
9 font-size: 11pt; | 9 font-size: 11pt; |
10 display: -webkit-flex; | 10 display: -webkit-flex; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 { | 73 { |
74 globalState().results = input; | 74 globalState().results = input; |
75 } | 75 } |
76 </script> | 76 </script> |
77 <script src="archived_results.json"></script> | 77 <script src="archived_results.json"></script> |
78 <script> | 78 <script> |
79 function processGlobalStateFor(testObject) | 79 function processGlobalStateFor(testObject) |
80 { | 80 { |
81 var table = document.getElementById('results-table'); | 81 var table = document.getElementById('results-table'); |
82 var row = table.insertRow(-1); | 82 var row = table.insertRow(-1); |
| 83 var checkboxcell = row.insertCell(-1); |
| 84 var checkbox = document.createElement("input"); |
| 85 checkbox.setAttribute('type','checkbox'); |
| 86 checkboxcell.appendChild(checkbox); |
83 var cell = row.insertCell(-1); | 87 var cell = row.insertCell(-1); |
84 cell.innerHTML = testObject.name; | 88 cell.innerHTML = testObject.name; |
85 for (var result in testObject.archived_results) { | 89 for (var result in testObject.archived_results) { |
86 var res = testObject.archived_results[result]; | 90 var res = testObject.archived_results[result]; |
87 var cell = row.insertCell(-1); | 91 var cell = row.insertCell(-1); |
88 if( res == 'PASS') | 92 if( res == 'PASS') |
89 cell.className = 'test-pass'; | 93 cell.className = 'test-pass'; |
90 else if( res == 'SKIP') | 94 else if( res == 'SKIP') |
91 cell.className = 'test-skip'; | 95 cell.className = 'test-skip'; |
92 else | 96 else |
(...skipping 14 matching lines...) Expand all Loading... |
107 for (var key in tree) { | 111 for (var key in tree) { |
108 var newPrefix = prefix ? (prefix + '/' + key) : key; | 112 var newPrefix = prefix ? (prefix + '/' + key) : key; |
109 if ('archived_results' in tree[key]) { | 113 if ('archived_results' in tree[key]) { |
110 var testObject = tree[key]; | 114 var testObject = tree[key]; |
111 testObject.name = newPrefix; | 115 testObject.name = newPrefix; |
112 handler(testObject); | 116 handler(testObject); |
113 } else | 117 } else |
114 forEachTest(handler, tree[key], newPrefix); | 118 forEachTest(handler, tree[key], newPrefix); |
115 } | 119 } |
116 } | 120 } |
| 121 function getTests() |
| 122 { |
| 123 var table = document.getElementById('results-table'); |
| 124 var testCount = table.rows.length; |
| 125 //FIXME : CONVERT TO JSON |
| 126 var tests_list = ''; |
| 127 for(var i = 1; i < testCount; i++) { |
| 128 var selected = table.rows[i].cells[0].getElementsByTagName("input")[0]; |
| 129 if(selected.checked) { |
| 130 var test = table.rows[i].cells[1].innerHTML; |
| 131 tests_list += test + ' ' ; |
| 132 } |
| 133 } |
| 134 return tests_list; |
| 135 } |
| 136 function rerun() |
| 137 { |
| 138 var log = document.getElementById('log'); |
| 139 log.innerHTML = 'Re running tests again'; |
| 140 var testList = getTests() |
| 141 if (testList == '') |
| 142 alert('Please select atlest one Test'); |
| 143 else { |
| 144 xmlhttp = new XMLHttpRequest(); |
| 145 var url ='http://localhost:9630/'; |
| 146 xmlhttp.open('POST', url, true); |
| 147 xmlhttp.onerror = function() { |
| 148 alert('Server offline'); |
| 149 } |
| 150 xmlhttp.setRequestHeader("Content-type", "application/json"); |
| 151 xmlhttp.onreadystatechange = function() { |
| 152 if(xmlhttp.readyState > 0) |
| 153 document.body.innerHTML = xmlhttp.responseText; |
| 154 } |
| 155 xmlhttp.send(String(getTests())); |
| 156 } |
| 157 } |
| 158 function checkalltests() |
| 159 { |
| 160 var value = document.getElementById("check_all").checked; |
| 161 var table = document.getElementById("results-table"); |
| 162 var length = table.rows.length; |
| 163 for (var i = 1; i < length; i++) { |
| 164 var checkbox = table.rows[i].cells[0].getElementsByTagName("input")[0]; |
| 165 checkbox.checked = value; |
| 166 } |
| 167 |
| 168 } |
| 169 |
117 function generatePage() | 170 function generatePage() |
118 { | 171 { |
119 var count = globalState().results.result_links.length; | 172 var count = globalState().results.result_links.length; |
120 var tableHeader= '<div><table id= results-table><thead><tr>' + | 173 var tableHeader= '<div><table id=results-table><thead><tr>' + |
| 174 '<th>' + '<input type="checkbox" name="checkall" id="check_all" onclick=
"checkalltests()"></input>' + ' Rerun' + '</th>' + |
| 175 |
121 '<th>Failing Tests ( Latest → Oldest )</th>'; | 176 '<th>Failing Tests ( Latest → Oldest )</th>'; |
122 for( var i = 0; i < count; i++) | 177 for( var i = 0; i < count; i++) |
123 tableHeader += '<th>'+ (i+1) +'</th>'; | 178 tableHeader += '<th>'+ (i+1) +'</th>'; |
124 tableHeader += '</thead>'; | 179 tableHeader += '</thead>'; |
125 document.body.innerHTML += tableHeader; | 180 document.body.innerHTML += tableHeader; |
126 document.body.innerHTML += '</table></div>'; | 181 document.body.innerHTML += '</table></div>'; |
127 | 182 |
128 forEachTest(processGlobalStateFor); | 183 forEachTest(processGlobalStateFor); |
129 } | 184 } |
130 </script> | 185 </script> |
131 <!-- To run the tests --> | 186 <!-- To run the tests --> |
132 <script src="resources/archived-results-dashboard-test.js"></script> | 187 <script src="resources/archived-results-dashboard-test.js"></script> |
133 <body onload="generatePage()"><h1>Dashboard</h1></body> | 188 <body onload="generatePage()"> |
| 189 <h1>Dashboard</h1> |
| 190 <p id=log></p> |
| 191 <p><button onclick="rerun()">Re Run Tests</button></p> |
| 192 </body> |
134 </html> | 193 </html> |
OLD | NEW |