Skip to content

Commit

Permalink
Externalize snapshot output dir (cashapp#1110)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrodbx authored Sep 28, 2023
1 parent 1e2c936 commit f456b8b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ class PaparazziPlugin : Plugin<Project> {
test.systemProperties["paparazzi.project.dir"] = projectDirectory.toString()
test.systemProperties["paparazzi.build.dir"] = buildDirectory.get().toString()
test.systemProperties["paparazzi.report.dir"] = reportOutputDir.get().toString()
test.systemProperties["paparazzi.snapshot.dir"] = snapshotOutputDir.toString()
test.systemProperties["paparazzi.artifacts.cache.dir"] = gradleUserHomeDir.path
test.systemProperties["kotlinx.coroutines.main.delay"] = true
test.systemProperties.putAll(project.properties.filterKeys { it.startsWith("app.cash.paparazzi") })
Expand Down
4 changes: 4 additions & 0 deletions paparazzi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ tasks.withType(Test).configureEach {
"paparazzi.report.dir",
project.extensions.getByType(ReportingExtension).baseDirectory.dir("paparazzi").get().toString()
)
systemProperty(
"paparazzi.snapshot.dir",
project.layout.projectDirectory.dir("src/test/snapshots").toString()
)
systemProperty(
"paparazzi.artifacts.cache.dir",
project.gradle.gradleUserHomeDir.path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import javax.imageio.ImageIO
class HtmlReportWriter @JvmOverloads constructor(
private val runName: String = defaultRunName(),
private val rootDirectory: File = File(System.getProperty("paparazzi.report.dir")),
snapshotRootDirectory: File = File("src/test/snapshots")
snapshotRootDirectory: File = File(System.getProperty("paparazzi.snapshot.dir"))
) : SnapshotHandler {
private val runsDirectory: File = File(rootDirectory, "runs")
private val imagesDirectory: File = File(rootDirectory, "images")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import javax.imageio.ImageIO

class SnapshotVerifier @JvmOverloads constructor(
private val maxPercentDifference: Double,
rootDirectory: File = File("src/test/snapshots")
rootDirectory: File = File(System.getProperty("paparazzi.snapshot.dir"))
) : SnapshotHandler {
private val imagesDirectory: File = File(rootDirectory, "images")
private val videosDirectory: File = File(rootDirectory, "videos")
Expand Down

0 comments on commit f456b8b

Please sign in to comment.