diff --git a/maestro-cli/src/main/java/maestro/cli/report/HtmlAITestSuiteReporter.kt b/maestro-cli/src/main/java/maestro/cli/report/HtmlAITestSuiteReporter.kt index f582e2c8a9..5232c5ea88 100644 --- a/maestro-cli/src/main/java/maestro/cli/report/HtmlAITestSuiteReporter.kt +++ b/maestro-cli/src/main/java/maestro/cli/report/HtmlAITestSuiteReporter.kt @@ -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 @@ -80,6 +82,10 @@ class HtmlAITestSuiteReporter { +defect.category } } + + if (i != screenSummary.defects.size - 1) { + div(classes = "h-0.5 rounded-sm bg-[#4f4b5c]") + } } } } @@ -91,4 +97,6 @@ class HtmlAITestSuiteReporter { } } + private val SingleFlowAIOutput.defectCount: Int + get() = screenOutputs.flatMap { it.defects }.size }