Skip to content

Commit

Permalink
Modify test report to group by tag
Browse files Browse the repository at this point in the history
  • Loading branch information
johngrimes committed Aug 27, 2024
1 parent 8af6717 commit 6ab1dd6
Showing 1 changed file with 58 additions and 21 deletions.
79 changes: 58 additions & 21 deletions test_report/src/Impls.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@
import { onMount } from "svelte";
import implementations from '../public/implementations.json';
import tests from '../public/tests.json';
// Get all the unique tags in the test suite.
const tags = new Set();
tests.forEach(test => {
test.tests.forEach(t => {
t.tags.forEach(tag => tags.add(tag));
});
});
console.log("tests", tests);
console.log("tags", tags);
// Construct a mapping of tag to display name, with the reserved tags first.
const reservedTags = {
shareable: "Profile: Shareable View Definition",
tabular: "Profile: Tabular View Definition",
experimental: "Experimental"
}
const otherTags = Array.from(tags)
.filter(tag => !Object.keys(reservedTags).includes(tag))
.reduce((acc, tag) => {
acc[tag] = tag;
return acc;
}, {});
const sections = { ...reservedTags, ...otherTags }
console.log("sections", sections);
async function load(file){
try {
Expand Down Expand Up @@ -31,7 +55,7 @@
<table class="flex-1">
<thead>
<tr>
<th class="px-4 py-1 border bg-gray-100">Test</th>
<th class="px-4 py-1 border bg-gray-100 text-left">Test</th>
{#each impls as impl}
<th class="px-4 py-1 border bg-gray-100">
<a class="text-blue-800 display-block" href={impl.url}>{impl.name}</a>
Expand All @@ -41,31 +65,44 @@
</thead>

<tbody>
{#each tests as test}
<tr>
<td class="px-4 py-1 border font-bold ">
<a href={"#tests/" + test.file}> {test.title} </a>
</td>
{#each Object.keys(sections) as section}
{#if tags.has(section)}
<tr>
<td class="px-4 py-1 border font-bold bg-gray-50" colspan="100%">
{sections[section]}
</td>
</tr>
{#each test?.tests || [] as t, i}
{#each tests as test}
{#if (test?.tests || []).find(t => t.tags.includes(section))}
<tr>
<td class="px-6 py-1 border ">
<a href={"#tests/" + test.file}> {t.title} </a>
<td class="px-4 py-1 border font-bold " colspan="100%">
<a href={"#tests/" + test.file}> {test.title} </a>
</td>
{#each impls as impl}
{@const res = ((((impl.results || {})[test.file] || {}).tests || [])[i]?.result?.passed)}
<td class="px-4 py-1 border">
{#if res === true}
<span class="font-bold text-green-500">✓</span>
{:else if res === false }
<span class="font-bold text-red-500">⚠</span>
{:else}
<span>-</span>
{/if}
</td>
{/each}
</tr>
{#each test?.tests || [] as t, i}
{#if t.tags.includes(section)}
<tr>
<td class="px-6 py-1 border ">
<a href={"#tests/" + test.file}> {t.title} </a>
</td>
{#each impls as impl}
{@const res = ((((impl.results || {})[test.file] || {}).tests || [])[i]?.result?.passed)}
<td class="px-4 py-1 border">
{#if res === true}
<span class="font-bold text-green-500">✓</span>
{:else if res === false }
<span class="font-bold text-red-500">⚠</span>
{:else}
<span>-</span>
{/if}
</td>
{/each}
</tr>
{/if}
{/each}
{/if}
{/each}
{/if}
{/each}
</tbody>
</table>
Expand Down

0 comments on commit 6ab1dd6

Please sign in to comment.