-
-
Save anonymous/e4f4488951efbdfe3431eeabbe980d80 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//error_reporting(0); // use hard coded error handling instead - it will report major errors anyway | |
######################################################### /* Get Environment Directories */ ######################################################### | |
if ($handle = opendir('C:\xampp\htdocs\reports')) | |
{ | |
while (false !== ($file = readdir($handle))) | |
{ | |
if ($file != "." && $file != "..") | |
{ | |
$folderStructure[][][][][][] = $file; // two D environment - $folderStructure[x][y] - all environments stored in X! | |
} | |
} | |
// echo "<br>" . $folderStructure[0][0][0][0]; | |
// echo "<br>" . $folderStructure[1][0][0][0]; | |
} | |
######################################################### /* Get Feature Directories */ ######################################################### | |
//get reports and add them to day[][this] | |
for ($e = 0; $e < count($folderStructure); $e++) | |
{ | |
if ($handle = opendir("C:\\xampp\\htdocs\\reports\\". $folderStructure[$e][0][0][0][0][0] . "\\")) | |
{ | |
while (false !== ($file = readdir($handle))) | |
{ | |
if ($file != "." && $file != "..") | |
{ | |
$folderStructure[$e][][][][][] = $file; | |
} | |
} | |
} | |
} | |
// echo "<br>" . $folderStructure[1][1][0][0]; | |
// echo "<br>" . $folderStructure[1][2][0][0]; | |
// echo "<br>" . $folderStructure[0][2][0][0]; | |
######################################################### /* Get Day Directories */ ######################################################### | |
for ($e = 0; $e < 4; $e++) | |
{ | |
for ($f = 1; $f < count($folderStructure[$e]); $f++) | |
{ | |
//get days and add them to day[this][] | |
if ($handle = opendir("C:\\xampp\\htdocs\\reports\\" . $folderStructure[$e][0][0][0][0][0] . "\\". $folderStructure[$e][$f][0][0][0][0] . "\\")) | |
{ | |
while (false !== ($file = readdir($handle))) | |
{ | |
if ($file != "." && $file != "..") | |
{ | |
$folderStructure[$e][$f][][][][0] = $file; // two D day - $day[x][y] - all days stored in X! | |
} | |
} | |
} | |
} | |
} | |
// echo "<br>" . $folderStructure[0][1][1][0]; | |
// echo "<br>" . $folderStructure[0][1][2][0]; | |
// echo "<br>" . $folderStructure[0][2][1][0]; | |
######################################################### /* Get Report Directories */ ######################################################### | |
for ($e = 0; $e < count($folderStructure); $e++) | |
{ | |
for ($f = 1; $f < count($folderStructure[$e]); $f++) | |
{ | |
for ($d = 1; $d < count($folderStructure[$e][$f]); $d++) | |
{ | |
if ($handle = opendir("C:\\xampp\\htdocs\\reports\\" . $folderStructure[$e][0][0][0][0][0] . "\\". $folderStructure[$e][$f][0][0][0][0] . "\\". $folderStructure[$e][$f][$d][0][0][0] . "\\")) | |
{ | |
while (false !== ($file = readdir($handle))) | |
{ | |
if ($file != "." && $file != "..") | |
{ | |
$folderStructure[$e][$f][$d][][][] = $file; | |
} | |
} | |
} | |
} | |
} | |
} | |
// echo "<br>" . $folderStructure[0][0][0][0][0][0]; | |
// echo "<br>" . $folderStructure[0][1][0][0][0][0]; | |
// echo "<br>" . $folderStructure[1][1][0][0][0][0]; | |
// echo "<br>" . $folderStructure[0][1][1][0][0][0]; | |
// echo "<br>" . $folderStructure[1][0][0][0][0][0]; | |
// echo "<br>" . $folderStructure[1][1][0][0][0][0]; | |
// echo "<br>" . $folderStructure[1][2][0][0][0][0]; | |
// echo "<br>" . $folderStructure[1][1][1][0][0][0]; | |
// echo count($folderStructure[0][0]); | |
// print_r($folderStructure); | |
######################################################### /* Get JSON Files */ ######################################################### | |
for ($e = 0; $e < 5; $e++) | |
{ | |
for ($f = 1; $f < count($folderStructure[$e]); $f++) | |
{ | |
for ($d = 1; $d < count($folderStructure[$e][$f]); $d++) | |
{ | |
for ($t = 1; $t < count($folderStructure[$e][$f][$d]); $t++) | |
{ | |
if ($handle = opendir("C:\\xampp\\htdocs\\reports\\" . $folderStructure[$e][0][0][0][0][0] . "\\". $folderStructure[$e][$f][0][0][0][0] . "\\". $folderStructure[$e][$f][$d][0][0][0]. "\\". $folderStructure[$e][$f][$d][$t][0][0]. "\\")) | |
{ | |
while (false !== ($file = readdir($handle))) | |
{ | |
if ($file != "." && $file != ".." && substr($file, strrpos($file, '.') + 1) == 'json') | |
{ | |
// echo "<br>This is the list stuff: " . $file . "<br>"; | |
$folderStructure[$e][$f][$d][$t][][] = '../reports/'. $folderStructure[$e][0][0][0][0][0].'/'.$folderStructure[$e][$f][0][0][0][0].'/'.$folderStructure[$e][$f][$d][0][0][0].'/'.$folderStructure[$e][$f][$d][$t][0][0].'/'.$file; | |
} | |
} | |
closedir($handle); | |
} | |
} | |
} | |
} | |
} | |
//echo $folderStructure[0][1][1][1][1]; | |
######################################################### /* Get HTML Files */ ######################################################### | |
for ($e = 0; $e < 5; $e++) | |
{ | |
for ($f = 1; $f < count($folderStructure[$e]); $f++) | |
{ | |
for ($d = 1; $d < count($folderStructure[$e][$f]); $d++) | |
{ | |
for ($t = 1; $t < count($folderStructure[$e][$f][$d]); $t++) | |
{ | |
for ($j = 1; $j < count($folderStructure[$e][$f][$d][$t]); $j++) | |
{ | |
if ($handle = opendir("C:\\xampp\\htdocs\\reports\\" . $folderStructure[$e][0][0][0][0][0] . "\\". $folderStructure[$e][$f][0][0][0][0] . "\\". $folderStructure[$e][$f][$d][0][0][0]. "\\". $folderStructure[$e][$f][$d][$t][0][0]. "\\")) | |
{ | |
while (false !== ($file = readdir($handle))) | |
{ | |
if ($file != "." && $file != ".." && substr($file, strrpos($file, '.') + 1) == 'html') | |
{ | |
// echo "<br>This is the list stuff: " . $file . "<br>"; | |
$folderStructure[$e][$f][$d][$t][$j][$j] = '../reports/'. $folderStructure[$e][0][0][0][0][0].'/'.$folderStructure[$e][$f][0][0][0][0].'/'.$folderStructure[$e][$f][$d][0][0][0].'/'.$folderStructure[$e][$f][$d][$t][0][0].'/'.$file; | |
} | |
} | |
closedir($handle); | |
} | |
} | |
} | |
} | |
} | |
} | |
######################################################### /* Get JSON Info */ ######################################################### | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//error_reporting(0); | |
echo " | |
<script> | |
function getColor(value) | |
{ | |
//value from 0 to 1 | |
var hue=((1-value)*120).toString(10); | |
return [\"hsl(\",hue,\",100%,85%)\"].join(\"\"); | |
} | |
function getColorForPassBar(value) | |
{ | |
//value from 0 to 1 | |
var hue=((1-value)*120).toString(10); | |
return [\"hsl(\",hue,\",100%,40%)\"].join(\"\"); | |
} | |
</script> | |
"; | |
for($d = 1; $d < count($folderStructure[$ee][$ff]); $d++) | |
{ | |
echo " | |
<script> | |
"; | |
echo "var total$ee$ff$d = 0;"; | |
echo "var fail$ee$ff$d = 0;"; | |
for ($t = 1; $t < count($folderStructure[$ee][$ff][$d]); $t++) | |
{ | |
echo " | |
var json = $.getJSON(\"". $folderStructure[$ee][$ff][$d][$t][1][0] ."\", function(data) | |
{ | |
var items = []; | |
function recursive(data) | |
{ | |
$.each(data, function (key, value) | |
{ | |
if (value instanceof Object) | |
{ | |
recursive(value); | |
} | |
else | |
{ | |
items.push(value); | |
} | |
}); | |
} | |
recursive(data); | |
var suites = items[2]; | |
var tests = items[3]; | |
var passes = items[4]; | |
var ending = items[8]; | |
//document.getElementById(\"tests\").innerHTML += tests; | |
//document.getElementById(\"report1.1\").innerHTML += \"Report for Test @ \" + ending.slice(11,16); | |
var failed = items[6]; | |
var percentagePassed = items[11]; | |
var duration = items[9]/1000; // in seconds | |
var showTotalTestsRan = document.getElementById(\"testsRanResult:".$folderStructure[$ee][0][0][0][0][0].$folderStructure[$ee][$ff][0][0][0][0].$folderStructure[$ee][$ff][$d][0][0][0].'@'.$folderStructure[$ee][$ff][$d][$t][0][0]."\"); | |
showTotalTestsRan.innerHTML = \"Total Tests Ran: \" + tests; | |
var showDuration = document.getElementById(\"durationResult:".$folderStructure[$ee][0][0][0][0][0].$folderStructure[$ee][$ff][0][0][0][0].$folderStructure[$ee][$ff][$d][0][0][0].'@'.$folderStructure[$ee][$ff][$d][$t][0][0]."\"); | |
showDuration.innerHTML = \"Duration: \" + duration + \"s\"; | |
var showPassPercentage = document.getElementById(\"percentResults:".$folderStructure[$ee][0][0][0][0][0].$folderStructure[$ee][$ff][0][0][0][0].$folderStructure[$ee][$ff][$d][0][0][0].'@'.$folderStructure[$ee][$ff][$d][$t][0][0]."\"); | |
showPassPercentage.innerHTML = percentagePassed + \"%\" + \" Passed\"; | |
//var showReportsWhichHaveFailed = document.getElementById(\"filterFailedTests".$ee.$ff.$d."\"); | |
//showReportsWhichHaveFailed.innerHTML = \"Show Failed Reports\"; | |
if (failed > 0) | |
{ | |
var showNumberOfTestsFailed = document.getElementById(\"result:".$folderStructure[$ee][0][0][0][0][0].$folderStructure[$ee][$ff][0][0][0][0].$folderStructure[$ee][$ff][$d][0][0][0].'@'.$folderStructure[$ee][$ff][$d][$t][0][0]."\"); | |
showNumberOfTestsFailed.innerHTML = \"Tests Failed: \" + failed; | |
} | |
total$ee$ff$d += tests; | |
fail$ee$ff$d += failed; | |
var final$ee$ff$d = 100; | |
final$ee$ff$d = 100 - ((fail$ee$ff$d/total$ee$ff$d)*100); | |
var passRate = document.getElementById(\"passRate".$folderStructure[$ee][0][0][0][0][0].$folderStructure[$ee][$ff][0][0][0][0].$folderStructure[$ee][$ff][$d][0][0][0]."\"); | |
passRate.innerHTML = final$ee$ff$d.toFixed(2) + \"% Pass Rate\"; | |
var passRateDisplayedUsingProgressBar = document.getElementById(\"progress-bar".$folderStructure[$ee][0][0][0][0][0].$folderStructure[$ee][$ff][0][0][0][0].$folderStructure[$ee][$ff][$d][0][0][0]."\"); | |
passRateDisplayedUsingProgressBar.setAttribute('aria-valuenow', parseInt(final$ee$ff$d)); | |
$(\".progress-bar\").each(function() | |
{ | |
var each_bar_width = $(this).attr('aria-valuenow'); | |
$(this).width(each_bar_width + '%'); | |
}); | |
var value = 1-(percentagePassed/100); | |
var passBarValue = 1 - (final$ee$ff$d/100); | |
var d = document.getElementById(\"reportHolder".$folderStructure[$ee][0][0][0][0][0].$folderStructure[$ee][$ff][0][0][0][0].$folderStructure[$ee][$ff][$d][0][0][0].$folderStructure[$ee][$ff][$d][$t][0][0]."\"); | |
d.style.backgroundColor=getColor(value); | |
passRateDisplayedUsingProgressBar.style.background = getColorForPassBar(passBarValue); | |
var failedReportFilter= document.getElementById(\"filterFailedTests".$ee.$ff.$d."\"); | |
$(failedReportFilter).click(function() | |
{ | |
if (failed <= 0) | |
{ | |
d.style.display = 'none'; | |
} | |
else if($(this).text() == 'Show Failed Reports') | |
{ | |
d.style.display = 'flex'; | |
} | |
}); | |
$(document).ready(function() | |
{ | |
$(\"#reportsFilterDropdown".$ee.$ff.$d."\").change(function() | |
{ | |
$(\"#reportsFilterDropdown".$ee.$ff.$d." option:selected\").each(function() | |
{ | |
if ($(this, \"option:selected\").text() == 'Only Failed') | |
{ | |
d.style.display = 'flex'; | |
if (failed <= 0) | |
{ | |
d.style.display = 'none'; | |
} | |
} | |
else if ($(this, \"option:selected\").text() == 'Only Passed') | |
{ | |
d.style.display = 'flex'; | |
if (failed != 0) | |
{ | |
d.style.display = 'none'; | |
} | |
} | |
else | |
{ | |
d.style.display = 'flex'; | |
} | |
}); | |
}); | |
}); | |
"; | |
echo " }); | |
"; } | |
echo " </script> | |
"; } | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//error_reporting(0); // throws notices for undefined offsets and we don't need to see them as we're already aware | |
require("/php/get_days.php"); | |
?> | |
<!DOCTYPE html> | |
<html lang=en> | |
<head> | |
<meta name=viewport content="width=device-width, initial-scale=1"> | |
<title>DASHBOARD</title> | |
<!--<script src=https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js></script>--> | |
<!--<script src=http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js></script>--> | |
<script src="/js/jquery-3.1.0.min.js"></script> | |
<link rel=stylesheet type=text/css href=\css\mochawesome.css> | |
<link rel=icon href=/helper/favicon.ico> | |
</head> | |
<body> | |
<div class="navbar navbar-inverse navbar-fixed-top" role=navigation> | |
<div class=container> | |
<div class=report-info-cnt> | |
<h1 class=report-title>DOCS Dev QA Automation Dashboard</h1> | |
</div> | |
</div> | |
</div> | |
<div id=featureDetails class=details> | |
<section class=suite-wrap> | |
<?php | |
for ($ee = 0; $ee < 4; $ee++) | |
{ | |
if (!empty($folderStructure[$ee][0][0][0][0][0])) | |
{ | |
echo " <div class=\"suite has-tests\" style=\"margin-bottom: 20px;\"> | |
<h1 style=\"margin-bottom: 0px;\">". $folderStructure[$ee][0][0][0][0][0] ."</h1> | |
"; } | |
for ($ff = 1; $ff < count($folderStructure[$ee]); $ff++) | |
{ | |
echo " <div class=\"suite has-tests\"> | |
<div class=\"indexFeatureContainer\"> | |
<h3 id=\"featureName\">". $folderStructure[$ee][$ff][0][0][0][0] ."</h3> | |
<h3 id=\"featureDetailsToggleButton". $folderStructure[$ee][$ff][0][0][0][0] . $folderStructure[$ee][0][0][0][0][0]."\" style=\"flex-grow: 1; text-align: right; margin-right: 15px;\">Show Feature Details</h3> | |
</div> | |
<div id=\"dayContainer".$folderStructure[$ee][0][0][0][0][0].$folderStructure[$ee][$ff][0][0][0][0]."\" class=\"suite has-tests\" style=\"display: none;\"> | |
<div class=\"details\" style=\"padding-top: 0px; padding-bottom: 0px; margin-bottom: 15px;\"> | |
"; require("/php/new_folder_missing.php"); | |
echo " </div> | |
"; require("/php/getJSONInfo.php"); | |
echo " </div> | |
</div> | |
"; } | |
echo " </div> | |
"; } | |
?> | |
</section> | |
</div> | |
<script> | |
<?php | |
for ($ee = 0; $ee < 4; $ee++) | |
{ | |
for ($ff = 1; $ff < count($folderStructure[$ee]); $ff++) | |
{ | |
echo " $(document).ready(function() | |
{ | |
$(\"#featureDetailsToggleButton".$folderStructure[$ee][$ff][0][0][0][0].$folderStructure[$ee][0][0][0][0][0]."\").click(function() | |
{ | |
$(\"#dayContainer".$folderStructure[$ee][0][0][0][0][0].$folderStructure[$ee][$ff][0][0][0][0]."\").slideToggle(500); | |
if ($(this).text() == 'Show Feature Details') | |
{ | |
$(this).text('Hide Feature Details'); | |
} | |
else | |
{ | |
$(this).text('Show Feature Details'); | |
} | |
}); | |
}); | |
"; } | |
} | |
?> | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
for ($d = 1; $d < count($folderStructure[$ee][$ff]); $d++) | |
{ | |
if (empty($folderStructure[$ee][$ff][$d][0][0][0])) | |
{ | |
echo " | |
<section class=\"suite-wrap\"> | |
<div class=\"suite has-suites\"> | |
<div class=\"holder\"> | |
<h1>Error: Folder Missing</h1> | |
</div> | |
</<div> | |
</section> | |
"; | |
} | |
else | |
{ | |
echo " | |
<section class=\"suite-wrap\"> | |
<div class=\"suite has-suites\"> | |
<style> | |
h1 | |
{ | |
padding-left: 15px; | |
flex-grow: 1; | |
} | |
h2 | |
{ | |
flex-grow: 1; | |
text-align: right; | |
padding-right: 15px; | |
} | |
h5 | |
{ | |
flex-grow: 1; | |
padding-left: 15px; | |
width: 240px; | |
} | |
#passedBar".$folderStructure[$ee][0][0][0][0][0].$folderStructure[$ee][$ff][0][0][0][0].$folderStructure[$ee][$ff][$d][0][0][0]." | |
{ | |
flex-grow: 4; | |
padding-top: 15px; | |
width: 200px; | |
} | |
#reportsFilterDropdown".$ee.$ff.$d." | |
{ | |
margin: 31px 15px; | |
height: 25px; | |
flex-grow: 3; | |
text-align: center; | |
} | |
</style> | |
<div class=\"holder\"> | |
<h1>Day : " . $folderStructure[$ee][$ff][$d][0][0][0] . "</h1> | |
<div id=\"passedBar".$folderStructure[$ee][0][0][0][0][0].$folderStructure[$ee][$ff][0][0][0][0].$folderStructure[$ee][$ff][$d][0][0][0]."\"> | |
<div class=\"barWrapper\"> | |
<span class=\"progressText\"><B id=\"passRate".$folderStructure[$ee][0][0][0][0][0].$folderStructure[$ee][$ff][0][0][0][0].$folderStructure[$ee][$ff][$d][0][0][0]."\"></B></span> | |
<div class=\"progress\"> | |
<div id=\"progress-bar".$folderStructure[$ee][0][0][0][0][0].$folderStructure[$ee][$ff][0][0][0][0].$folderStructure[$ee][$ff][$d][0][0][0]."\" class=\"progress-bar\" role=\"progressbar\" aria-valuenow=\"\" aria-valuemin=\"0\" aria-valuemax=\"100\" > | |
<span class=\"popOver\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"85%\"> </span> | |
</div> | |
</div> | |
<div class=\"col-md-2 col-lg-2\"></div> | |
</div> | |
</div> | |
<!-- <h2 id=\"filterFailedTests".$ee.$ff.$d."\"class=\"failedReportsFilter\"></h2> --> | |
<select id=\"reportsFilterDropdown".$ee.$ff.$d."\"> | |
<option>All Reports</option> | |
<option>Only Passed</option> | |
<option>Only Failed</option> | |
</select> | |
</div> | |
<section class=\"suite-wrap\"> | |
<div id=\"folderForDay".$folderStructure[$ee][$ff][$d][0][0][0]."\" class=\"suite has-tests dayHolder\">"; | |
for ($t = 1; $t < count($folderStructure[$ee][$ff][$d]); $t++) | |
{ | |
echo "<div id=\"reportHolder".$folderStructure[$ee][0][0][0][0][0].$folderStructure[$ee][$ff][0][0][0][0].$folderStructure[$ee][$ff][$d][0][0][0].$folderStructure[$ee][$ff][$d][$t][0][0]."\" class=\"holder\"> | |
<h5 class=\"report\"><a id=\"report".$ee.$t."\" href=\"" . $folderStructure[$ee][$ff][$d][$t][1][1] . "\">" . $folderStructure[$ee][$ff][$d][$t][0][0] . "</a></h5> | |
<h5 id=\"testsRanResult:".$folderStructure[$ee][0][0][0][0][0].$folderStructure[$ee][$ff][0][0][0][0].$folderStructure[$ee][$ff][$d][0][0][0].'@'.$folderStructure[$ee][$ff][$d][$t][0][0]."\"class=\"testsRan\"></h5> | |
<h5 id=\"percentResults:".$folderStructure[$ee][0][0][0][0][0].$folderStructure[$ee][$ff][0][0][0][0].$folderStructure[$ee][$ff][$d][0][0][0].'@'.$folderStructure[$ee][$ff][$d][$t][0][0]."\" class=\"percentPassed\"></h5> | |
<h5 id=\"result:".$folderStructure[$ee][0][0][0][0][0].$folderStructure[$ee][$ff][0][0][0][0].$folderStructure[$ee][$ff][$d][0][0][0].'@'.$folderStructure[$ee][$ff][$d][$t][0][0]."\" class=\"reportResults\"></h5> | |
<h5 id=\"durationResult:".$folderStructure[$ee][0][0][0][0][0].$folderStructure[$ee][$ff][0][0][0][0].$folderStructure[$ee][$ff][$d][0][0][0].'@'.$folderStructure[$ee][$ff][$d][$t][0][0]."\"class=\"duration\"></h5> | |
</div>"; | |
} | |
echo " | |
</div> | |
</section> | |
</div> | |
</section> | |
"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment