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 fc919e5
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import kotlinx.html.p
import kotlinx.html.script
import kotlinx.html.stream.appendHTML
import kotlinx.html.title
import maestro.orchestra.ai.Defect
import okio.Sink
import okio.buffer

Expand Down Expand Up @@ -55,22 +56,20 @@ class HtmlAITestSuiteReporter {
}
}
main(classes = "container mx-auto flex flex-col gap-4") {
p(classes = "text-[#4f4b5c]") { +"10 possible defects found" }
p(classes = "text-[#4f4b5c]") { +"${summary.defectCount} possible defects found" }

summary.screenOutputs.forEach { singleScreenOutput ->
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 = singleScreenOutput.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") {
+"${singleScreenOutput.defects.size} possible defects"
}

div(classes = "flex flex-col gap-4") {
singleScreenOutput.defects.forEach { defect ->
div(classes = "flex flex-col items-start gap-2 rounded-lg bg-[#f8f8f8] p-2") {
p(classes = "text-[#110c22]") {
+defect.reasoning
Expand All @@ -91,4 +90,6 @@ class HtmlAITestSuiteReporter {
}
}

private val SingleFlowAIOutput.defectCount: List<Defect>
get() = screenOutputs.flatMap { it.defects }
}

0 comments on commit fc919e5

Please sign in to comment.