Skip to content

Commit

Permalink
display possible defect count
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Aug 19, 2024
1 parent c7e3c8f commit 52ffba1
Showing 1 changed file with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,24 @@ class HtmlAITestSuiteReporter {
}
}
main(classes = "container mx-auto flex flex-col gap-4") {
p(classes = "text-[#4f4b5c]") { +"10 possible defects found" }
p(classes = "text-[#4f4b5c]") {
val word = if (summary.defectCount == 1) "defect" else "defects"
+"${summary.defectCount} possible $word found"
}

summary.screenOutputs.forEach { singleScreenOutput ->
summary.screenOutputs.forEach { screenSummary ->
div(classes = "flex items-start gap-4 bg-white") {
p(classes = "text-lg") {
+"${singleScreenOutput.defects.size} possible defects"
img(classes = "w-64 rounded-lg border-2 border-[#4f4b5c]") {
alt = "Screenshot of the defect"
// Use relative path, so when file is moved across machines, it still works
src = screenSummary.screenshotPath.name.toString()
}

singleScreenOutput.defects.forEach { defect ->
img(classes = "w-64 rounded-lg border-2 border-[#4f4b5c]") {
alt = "Screenshot of the defect"
// Use relative path, so when file is moved across machines, it still works
src = singleScreenOutput.screenshotPath.name.toString()
div(classes = "flex flex-col gap-4 grow") {
p(classes = "text-lg") {
val word = if (screenSummary.defects.size == 1) "defect" else "defects"
+"${screenSummary.defects.size} possible $word"
}

div(classes = "flex flex-col gap-4") {
screenSummary.defects.forEachIndexed { i, defect ->
div(classes = "flex flex-col items-start gap-2 rounded-lg bg-[#f8f8f8] p-2") {
p(classes = "text-[#110c22]") {
+defect.reasoning
Expand All @@ -80,6 +82,10 @@ class HtmlAITestSuiteReporter {
+defect.category
}
}

if (i != screenSummary.defects.size - 1) {
div(classes = "h-0.5 rounded-sm bg-[#4f4b5c]")
}
}
}
}
Expand All @@ -91,4 +97,6 @@ class HtmlAITestSuiteReporter {
}
}

private val SingleFlowAIOutput.defectCount: Int
get() = screenOutputs.flatMap { it.defects }.size
}

0 comments on commit 52ffba1

Please sign in to comment.