Skip to content

Commit

Permalink
Delete unneeded output
Browse files Browse the repository at this point in the history
  • Loading branch information
takahirom committed Dec 10, 2023
1 parent 5464a50 commit c670d1a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,24 @@ class RoborazziTaskTest {
fun roborazziOptionTask() {
boxedEnvironment {
ROBORAZZI_DEBUG = true
val prefix = "$DEFAULT_ROBORAZZI_OUTPUT_DIR_PATH/${this::class.qualifiedName}.roborazziOptionTask"
val expectedOutput =
File("$DEFAULT_ROBORAZZI_OUTPUT_DIR_PATH/${this::class.qualifiedName}.roborazziOptionTask.png")
File("$prefix.png")
val expectedCompareOutput = File("${prefix}_compare.png")
expectedOutput.delete()
setupRoborazziSystemProperty(
compare = true
)

onView(ViewMatchers.isRoot())
.captureRoboImage(
roborazziOptions = RoborazziOptions(
taskType = RoborazziTaskType.Verify
try {
onView(ViewMatchers.isRoot())
.captureRoboImage(
roborazziOptions = RoborazziOptions(
taskType = RoborazziTaskType.Verify
)
)
)

assert(
expectedOutput
.exists()
) {
"File not found: ${expectedOutput.absolutePath} \n"
} finally {
expectedCompareOutput.delete()
}
}
}
Expand Down Expand Up @@ -86,6 +85,7 @@ class RoborazziTaskTest {
) {
"File not found: ${expectedOutput.absolutePath} \n"
}
expectedCompareOutput.delete()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ fun boxedEnvironment(block: () -> Unit) {
originalProperties.forEach { System.clearProperty(it.first.toString()) }
val context = provideRoborazziContext()
RoborazziContext = RoborazziContextImpl()
block()
RoborazziContext = context
originalProperties.forEach { System.setProperty(it.first.toString(), it.second.toString()) }
try {
block()
} finally {
RoborazziContext = context
originalProperties.forEach { System.setProperty(it.first.toString(), it.second.toString()) }
}
}

fun setupRoborazziSystemProperty(
Expand Down

0 comments on commit c670d1a

Please sign in to comment.