Skip to content

Commit

Permalink
fixes #56 SimpleGen: Deep filter leaf nodes by status
Browse files Browse the repository at this point in the history
  • Loading branch information
anshooarora committed Jan 26, 2025
1 parent 3fde6b5 commit d698757
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<#if build.isBDD()>
<#assign
title1 = 'Features', title2 = 'Scenarios', title3 = 'Steps', tagStatsLevel = 1
title1 = 'Features', title2 = 'Scenarios', title3 = 'Steps', statLevel = 1
>
<#elseif build.testRunner == 'testng'>
<#if build.runStats?size gte 3>
<#assign
title1 = 'Suites', title2 = 'Classes', title3 = 'Methods', tagStatsLevel = 2
title1 = 'Suites', title2 = 'Classes', title3 = 'Methods', statLevel = 2
>
<#else>
<#assign
title1 = 'Classes', title2 = 'Methods', tagStatsLevel = 1
title1 = 'Classes', title2 = 'Methods', statLevel = 1
>
</#if>
<#elseif build.testRunner == 'junit' || build.testRunner == 'junit-jupiter'>
<#assign
title1 = 'Classes', title2 = 'Methods', tagStatsLevel = 1
title1 = 'Classes', title2 = 'Methods', statLevel = 1
>
<#else>
<#assign
title1 = 'Tests', title2 = 'Methods', title3 = 'Events', tagStatsLevel = 1
title1 = 'Tests', title2 = 'Methods', title3 = 'Events', statLevel = 1
>
</#if>
<#if build.runStats?? && build.runStats?has_content && (tagStatsLevel gte build.runStats?size) && build.runStats?size gte 1>
<#assign tagStatsLevel = build.runStats?size - 1>
<#if build.runStats?? && build.runStats?has_content && (statLevel gte build.runStats?size) && build.runStats?size gte 1>
<#assign statLevel = build.runStats?size - 1>
</#if>

<!DOCTYPE html>
Expand Down Expand Up @@ -191,7 +191,7 @@
</thead>
<tbody>
<#list build.tagStats as tag>
<#if tag.depth == tagStatsLevel>
<#if tag.depth == statLevel>
<tr>
<td><a href="#" class="secondary tag">${tag.name}</a></td>
<td>${tag.total}</td>
Expand All @@ -212,17 +212,15 @@
</div>

<div class="container-fluid">
<div class="border-bottom py-3 mb-5">
<div class="py-3 mb-5">
<div class="container d-flex justify-content-between">
<div id="status-filter" aria-label="Filter tests with status">
<button type="button" id="passed" class="btn btn-outline-success btn-sm">Passed</button>
<button type="button" id="skipped" class="btn btn-outline-warning btn-sm">Skipped</button>
<button type="button" id="failed" class="btn btn-outline-danger btn-sm">Failed</button>
<button id="clear-filters" class="btn btn-outline-secondary btn-sm">
<i class="bi bi-x-lg me-1"></i>Clear all filters</button>
</div>
<div>
<button type="button" id="summary-toggle" class="btn btn-outline-primary btn-sm">Toggle Summary Section</button>
<div class="input-group">
<input type="text" id="q" class="form-control border" placeholder="Search..." aria-label="Search...">
<button class="btn border btn-sm text-success status-filter" id="passed" type="button">Passed</button>
<button class="btn border btn-sm text-warning status-filter" id="skipped" type="button">Skipped</button>
<button class="btn border btn-sm text-danger status-filter" id="failed" type="button">Failed</button>
<button id="clear-filters" class="btn border btn-sm"><i class="bi bi-x-lg me-1"></i>Clear all filters</button>
<button type="button" id="summary-toggle" class="btn border btn-sm"><i class="bi bi-toggle-on me-1"></i> Toggle Summary Section</button>
</div>
</div>
</div>
Expand All @@ -231,7 +229,7 @@
<div class="container">
<div class="row">
<div class="col-4">
<h6 class="mb-3 testname ${test.result?lower_case}">${test.name}</h6>
<h6 class="mb-3 testname fs-6 ${test.result?lower_case}">${test.name}</h6>
<div class="small">
<span class="badge badge-outline"><i class="bi bi-hourglass me-1"></i> ${test.durationPretty}</span>
<span class="badge text-bg-info"><i class="bi bi-clock me-1"></i>
Expand All @@ -250,7 +248,7 @@
</div>
<div class="col-8">
<#list test.children as child>
<div class="card mb-1 result ${child.result?lower_case}">
<div class="card mb-2 result ${child.result?lower_case}">
<div class="card-body">
<div class="d-flex justify-content-between">
<div>
Expand All @@ -259,7 +257,7 @@
<#else>
<i class="bi bi-exclamation-octagon-fill text-danger"></i>
</#if>
<span class="ms-2">${child.name}</span>
<span class="fs-6 ms-2">${child.name}</span>
</div>
<div>
<#if child.tags?has_content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ pre {
background-color: #f8f9fa;
white-space: pre-wrap;
margin-bottom: 0;
max-height: 15rem;
height: 15rem;
word-break: break-all;
padding: 1rem;
resize: vertical;
}
.form-control {
font-size: inherit;
}
input.form-control {
-webkit-text-fill-color: #696969 !important;
}

/* container */
Expand Down Expand Up @@ -53,6 +60,9 @@ th {
.smaller {
font-size: 10px;
}
.fs-6 {
font-size: 0.95rem;
}

/* navbar */
.navbar-brand {
Expand Down Expand Up @@ -140,14 +150,24 @@ th {
.embed img {
max-width: 100%;
}
p.desc {
margin-top: .15rem;
margin-left: 1.5rem;
color: var(--bs-secondary);
}

/* dark theme */
body[data-bs-theme="dark"] {
--failed-border-color: rgba(210, 130, 130, .5);
}
body[data-bs-theme="dark"],
body[data-bs-theme="dark"] .card,
body[data-bs-theme="dark"] .form-control,
body[data-bs-theme="dark"] .table>:not(caption)>*>* {
background-color: rgb(19, 25, 34);
}
body[data-bs-theme="dark"] .card,
body[data-bs-theme="dark"] .card:not(.failed),
body[data-bs-theme="dark"] .border,
body[data-bs-theme="dark"] .border-bottom,
body[data-bs-theme="dark"] .badge.badge-outline:not(.badge-outline-primary),
body[data-bs-theme="dark"] .rounded-pill,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ depth3Chart();

// init::statusFilters
const statusFilters = [];
document.querySelectorAll('#status-filter > button').forEach((e) => {
document.querySelectorAll('.status-filter').forEach((e) => {
statusFilters.push(e);
});

Expand Down Expand Up @@ -162,7 +162,7 @@ const filterTests = (_status) => {
}

// filter all tests based on their status
document.querySelectorAll('#status-filter > button').forEach((e) => {
document.querySelectorAll('.status-filter').forEach((e) => {
e.addEventListener('click', el => {
// remove any other buttons with .active class
statusFilters.forEach(x => el.target.id != x.id && x.classList.remove('active'));
Expand Down Expand Up @@ -248,6 +248,9 @@ const resetState = () => {

// on key down events (shortcuts)
window.onkeydown = evt => {
if (evt.target.tagName.toLowerCase() === 'input') {
return;
}
if (evt.metaKey) {
return;
}
Expand Down Expand Up @@ -324,7 +327,8 @@ document.querySelector('body').addEventListener('click', el => {

// toggle summary section
document.querySelector('#summary-toggle').addEventListener('click', el => {
el.target.classList.toggle('active');
el.target.children[0].classList.toggle('bi-toggle-on');
el.target.children[0].classList.toggle('bi-toggle-off');
const summary = document.querySelector('#summary');
summary.classList.toggle('d-none');
})

0 comments on commit d698757

Please sign in to comment.