Skip to content

Commit

Permalink
fix screenshots taken by assertVisualAI being empty
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Aug 16, 2024
1 parent fc57417 commit 9d929f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package maestro.cli.report

import com.fasterxml.jackson.annotation.JsonInclude
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.core.util.DefaultIndenter
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter
import com.fasterxml.jackson.databind.JsonMappingException
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
Expand Down Expand Up @@ -35,9 +37,9 @@ object TestDebugReporter {

private val logger = LoggerFactory.getLogger(TestDebugReporter::class.java)
private val mapper = jacksonObjectMapper()
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
.setSerializationInclusion(JsonInclude.Include.NON_EMPTY)
.writerWithDefaultPrettyPrinter()
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
.setSerializationInclusion(JsonInclude.Include.NON_EMPTY)
.writerWithDefaultPrettyPrinter()

private var debugOutputPath: Path? = null
private var debugOutputPathAsString: String? = null
Expand Down Expand Up @@ -140,8 +142,8 @@ object TestDebugReporter {
fun getDebugOutputPath(): Path {
if (debugOutputPath != null) return debugOutputPath as Path

val debugRootPath = if(debugOutputPathAsString != null) debugOutputPathAsString!! else System.getProperty("user.home")
val debugOutput = if(flattenDebugOutput) Paths.get(debugRootPath) else buildDefaultDebugOutputPath(debugRootPath)
val debugRootPath = if (debugOutputPathAsString != null) debugOutputPathAsString!! else System.getProperty("user.home")
val debugOutput = if (flattenDebugOutput) Paths.get(debugRootPath) else buildDefaultDebugOutputPath(debugRootPath)

if (!debugOutput.exists()) {
Files.createDirectories(debugOutput)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,11 @@ class Orchestra(

val imageData = Buffer()
maestro.takeScreenshot(imageData, compressed = false)
val imageDataBytes = imageData.readByteArray()

val defects = Prediction.findDefects(
aiClient = ai,
assertion = null,
screen = imageDataBytes,
screen = imageData.readByteArray(),
previousFalsePositives = listOf(), // TODO: take it from WorkspaceConfig (or MaestroConfig?)
)

Expand Down

0 comments on commit 9d929f8

Please sign in to comment.