Add core:ui:compose:testing
module with ComposeTest and build plugin fix for non working release build type tests
This commit is contained in:
parent
709b55f2d1
commit
16504bc54d
5 changed files with 47 additions and 0 deletions
|
@ -6,6 +6,13 @@ android {
|
|||
configureSharedComposeConfig(libs)
|
||||
}
|
||||
|
||||
androidComponents {
|
||||
beforeVariants(selector().withBuildType("release")) { variantBuilder ->
|
||||
variantBuilder.enableUnitTest = false
|
||||
variantBuilder.enableAndroidTest = false
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
configureSharedComposeDependencies(libs)
|
||||
}
|
||||
|
|
3
core/ui/compose/testing/README.md
Normal file
3
core/ui/compose/testing/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
## Core - UI - Compose - Testing
|
||||
|
||||
Uses [`:core:ui:compose:theme`](../theme/README.md)
|
14
core/ui/compose/testing/build.gradle.kts
Normal file
14
core/ui/compose/testing/build.gradle.kts
Normal file
|
@ -0,0 +1,14 @@
|
|||
plugins {
|
||||
id(ThunderbirdPlugins.Library.androidCompose)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "app.k9mail.core.ui.compose.testing"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(projects.core.ui.compose.theme)
|
||||
implementation(libs.androidx.compose.material)
|
||||
|
||||
implementation(libs.bundles.shared.jvm.test.compose)
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package app.k9mail.core.ui.compose.testing
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.ui.test.junit4.ComposeContentTestRule
|
||||
import androidx.compose.ui.test.junit4.createComposeRule
|
||||
import org.junit.Rule
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
open class ComposeTest {
|
||||
|
||||
@get:Rule
|
||||
val composeTestRule = createComposeRule()
|
||||
|
||||
fun getString(@StringRes resourceId: Int): String = RuntimeEnvironment.getApplication().getString(resourceId)
|
||||
|
||||
fun runComposeTest(testContent: ComposeContentTestRule.() -> Unit): Unit = with(composeTestRule) {
|
||||
testContent()
|
||||
}
|
||||
}
|
|
@ -49,6 +49,7 @@ include(
|
|||
":core:ui:compose:common",
|
||||
":core:ui:compose:designsystem",
|
||||
":core:ui:compose:theme",
|
||||
":core:ui:compose:testing",
|
||||
)
|
||||
|
||||
include(
|
||||
|
|
Loading…
Reference in a new issue