mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-09-28 07:51:42 +01:00
Enable screenshot testing for all modules.
This commit is contained in:
committed by
Michelle Tang
parent
1ba233f77d
commit
99216e5fd2
@@ -18,7 +18,7 @@ plugins {
|
||||
alias(libs.plugins.ktlint)
|
||||
alias(libs.plugins.compose.compiler)
|
||||
alias(libs.plugins.kotlinx.serialization)
|
||||
alias(testLibs.plugins.compose.screenshot)
|
||||
id("com.android.compose.screenshot")
|
||||
alias(benchmarkLibs.plugins.baselineprofile)
|
||||
id("androidx.navigation.safeargs")
|
||||
id("kotlin-parcelize")
|
||||
|
||||
@@ -22,6 +22,7 @@ dependencies {
|
||||
implementation(libs.kotlin.gradle.plugin)
|
||||
implementation(libs.android.library)
|
||||
implementation(libs.android.application)
|
||||
implementation(testLibs.compose.screenshot.plugin)
|
||||
implementation(libs.ktlint)
|
||||
implementation(project(":tools"))
|
||||
|
||||
|
||||
@@ -72,3 +72,18 @@ dependencies {
|
||||
testImplementation(testLibs.androidx.test.core)
|
||||
testImplementation(testLibs.androidx.test.core.ktx)
|
||||
}
|
||||
|
||||
// Enable screenshot testing for modules that use compose
|
||||
plugins.withId("org.jetbrains.kotlin.plugin.compose") {
|
||||
android {
|
||||
experimentalProperties["android.experimental.enableScreenshotTest"] = true
|
||||
}
|
||||
|
||||
apply(plugin = "com.android.compose.screenshot")
|
||||
|
||||
dependencies {
|
||||
add("screenshotTestImplementation", testLibs.compose.screenshot.validation.api)
|
||||
add("screenshotTestImplementation", libs.androidx.compose.ui.tooling.core)
|
||||
add("screenshotTestImplementation", libs.androidx.compose.ui.tooling.preview)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,3 +78,18 @@ dependencies {
|
||||
testImplementation(testLibs.androidx.test.core)
|
||||
testImplementation(testLibs.androidx.test.core.ktx)
|
||||
}
|
||||
|
||||
// Enable screenshot testing for modules that use compose
|
||||
plugins.withId("org.jetbrains.kotlin.plugin.compose") {
|
||||
android {
|
||||
experimentalProperties["android.experimental.enableScreenshotTest"] = true
|
||||
}
|
||||
|
||||
apply(plugin = "com.android.compose.screenshot")
|
||||
|
||||
dependencies {
|
||||
add("screenshotTestImplementation", testLibs.compose.screenshot.validation.api)
|
||||
add("screenshotTestImplementation", libs.androidx.compose.ui.tooling.core)
|
||||
add("screenshotTestImplementation", libs.androidx.compose.ui.tooling.preview)
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -140,7 +140,11 @@ gradle.projectsEvaluated {
|
||||
|
||||
tasks.named("validateScreenshots") {
|
||||
subprojects.filter { it.name != "Signal-Android" }.forEach { subproject ->
|
||||
subproject.tasks.findByName("validateDebugScreenshotTest")?.let { dependsOn(it) }
|
||||
// All modules get screenshotTests enabled by default, but the validate task fails if there's no tests.
|
||||
// So we just filter out the modules that have no tests ourselves.
|
||||
if (subproject.file("src/screenshotTest").isDirectory) {
|
||||
subproject.tasks.findByName("validateDebugScreenshotTest")?.let { dependsOn(it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ plugins {
|
||||
id("com.squareup.wire")
|
||||
alias(libs.plugins.compose.compiler)
|
||||
alias(libs.plugins.kotlinx.serialization)
|
||||
alias(testLibs.plugins.compose.screenshot)
|
||||
}
|
||||
|
||||
android {
|
||||
@@ -24,8 +23,6 @@ android {
|
||||
isIncludeAndroidResources = true
|
||||
}
|
||||
}
|
||||
|
||||
experimentalProperties["android.experimental.enableScreenshotTest"] = true
|
||||
}
|
||||
|
||||
screenshotTests {
|
||||
@@ -112,9 +109,4 @@ dependencies {
|
||||
androidTestImplementation(testLibs.androidx.test.ext.junit)
|
||||
androidTestImplementation(libs.androidx.compose.ui.test.junit4)
|
||||
debugImplementation(libs.androidx.compose.ui.test.manifest)
|
||||
|
||||
// Compose screenshot testing
|
||||
screenshotTestImplementation(testLibs.compose.screenshot.validation.api)
|
||||
screenshotTestImplementation(libs.androidx.compose.ui.tooling.core)
|
||||
screenshotTestImplementation(libs.androidx.compose.ui.tooling.preview)
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ compose-screenshot = "0.0.1-alpha15"
|
||||
compose-screenshot = { id = "com.android.compose.screenshot", version.ref = "compose-screenshot" }
|
||||
|
||||
[libraries]
|
||||
compose-screenshot-plugin = { module = "com.android.compose.screenshot:com.android.compose.screenshot.gradle.plugin", version.ref = "compose-screenshot" }
|
||||
compose-screenshot-validation-api = { module = "com.android.tools.screenshot:screenshot-validation-api", version.ref = "compose-screenshot" }
|
||||
junit-junit = "junit:junit:4.13.2"
|
||||
androidx-test-core = { module = "androidx.test:core", version.ref = "androidx-test" }
|
||||
|
||||
Reference in New Issue
Block a user