Add info tests counter in the Report page
Related-Prod: PRODX-44074
Change-Id: I4a0f5e37d3dc02efa6dfb9bb6eef067ff6116413
diff --git a/testrail_bot/control/templates/control/report.html b/testrail_bot/control/templates/control/report.html
index f82247d..20e968f 100644
--- a/testrail_bot/control/templates/control/report.html
+++ b/testrail_bot/control/templates/control/report.html
@@ -4,6 +4,8 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
+ var failsCounter = 0;
+ var unresCounter = 0;
function getCookie(name) {
let cookieValue = null;
if (document.cookie && document.cookie !== '') {
@@ -27,6 +29,8 @@
dataType: "json",
headers: {'X-CSRFToken': csrftoken},
success: function(data) {
+ total_count();
+ unresolved_count();
tag = document.getElementById("data");
tag.innerHTML = data["data"];
//Send another request in 3 seconds.
@@ -38,26 +42,46 @@
}
});
};
+function total_count(){
+ tag = document.getElementById("total_count");
+ tag.innerHTML = "Total found " + failsCounter + " fails";
+}
+function unresolved_count(){
+ tag = document.getElementById("unresolved_count");
+ tag.innerHTML = "Unresolved " + unresCounter + " fails";
+}
window.onload = function() {send()};</script>
-
-<a href="{% url 'delete_report' report_obj.id %}">
- <button class="btn btn-danger m-1">
- <svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="1em"
- height="1em" viewBox="0,0,256,256">
- <g fill="#ffffff" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><g transform="scale(10.66667,10.66667)">
- <path d="M10,2l-1,1h-4c-0.6,0 -1,0.4 -1,1c0,0.6 0.4,1 1,1h2h10h2c0.6,0 1,-0.4 1,-1c0,-0.6 -0.4,-1 -1,-1h-4l-1,-1zM5,7v13c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2v-13zM9,9c0.6,0 1,0.4 1,1v9c0,0.6 -0.4,1 -1,1c-0.6,0 -1,-0.4 -1,-1v-9c0,-0.6 0.4,-1 1,-1zM15,9c0.6,0 1,0.4 1,1v9c0,0.6 -0.4,1 -1,1c-0.6,0 -1,-0.4 -1,-1v-9c0,-0.6 0.4,-1 1,-1z"></path></g></g>
- </svg>
- Delete
- </button>
-</a>
+<div class="row">
+ <div class="col-md-1 col-sm-3">
+ <a href="{% url 'delete_report' report_obj.id %}" style="margin:1em">
+ <button class="btn btn-danger m-1">
+ <svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="1em"
+ height="1em" viewBox="0,0,256,256">
+ <g fill="#ffffff" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><g transform="scale(10.66667,10.66667)">
+ <path d="M10,2l-1,1h-4c-0.6,0 -1,0.4 -1,1c0,0.6 0.4,1 1,1h2h10h2c0.6,0 1,-0.4 1,-1c0,-0.6 -0.4,-1 -1,-1h-4l-1,-1zM5,7v13c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2v-13zM9,9c0.6,0 1,0.4 1,1v9c0,0.6 -0.4,1 -1,1c-0.6,0 -1,-0.4 -1,-1v-9c0,-0.6 0.4,-1 1,-1zM15,9c0.6,0 1,0.4 1,1v9c0,0.6 -0.4,1 -1,1c-0.6,0 -1,-0.4 -1,-1v-9c0,-0.6 0.4,-1 1,-1z"></path></g></g>
+ </svg>
+ Delete
+ </button>
+ </a>
+ </div>
+ <div id="unresolved_count" class="m-1 col-md-1 col-sm-2 bg-info"
+ style="text-align:center; border:1px solid; border-radius:5px; padding:4px; padding-top: 6px;">
+ </div>
+ <div id="total_count" class="m-1 col-md-1 col-sm-2 bg-light"
+ style="text-align:center; border:1px solid; border-radius:5px; padding:4px; padding-top: 6px;">
+ </div>
+</div>
<pre id="data" class="p-4 border">{{ report | safe }}</pre>
-
-
{% for test_result in test_results|dictsortreversed:"action_needed" %}
-
+<script>
+failsCounter++;
+if ("{{test_result.action_needed}}" == "True"){
+ unresCounter++;
+ }
+</script>
<div class="card m-3
{% if not test_result.action_needed %}
border-success
@@ -68,6 +92,7 @@
{% endif %}
" >
<a style="text-decoration: none; color:inherit" href="#{{ test_result.result_id }}" id="{{ test_result.result_id }}">{{ test_result.result_id }}</a>
+ <a style="text-align: right; color:powderblue;">№{{ forloop.counter }}</a>
</div>
<div class="card-body">
<pre style="overflow: auto;white-space: pre-wrap;">{{ test_result.text | safe }}</pre>