Код: Выделить всё
plugins {
alias(libs.plugins.com.android.library)
alias(libs.plugins.org.jetbrains.multiplatform)
alias(libs.plugins.org.jetbrains.cocoapods)
alias(libs.plugins.org.jetbrains.serialization)
alias(libs.plugins.org.jetbrains.compose)
alias(libs.plugins.org.jetbrains.compose.compiler)
alias(libs.plugins.io.realm.kotlin)
alias(libs.plugins.maven.publish)
}
kotlin {
androidTarget {
publishLibraryVariants("release", "debug")
@OptIn(ExperimentalKotlinGradlePluginApi::class)
instrumentedTestVariant {
sourceSetTree = KotlinSourceSetTree.test
}
}
iosX64()
iosArm64()
iosSimulatorArm64()
applyDefaultHierarchyTemplate()
jvmToolchain(17)
sourceSets {
commonMain.dependencies {
implementation(compose.runtime)
implementation(compose.material3)
implementation(compose.materialIconsExtended)
implementation(libs.realm)
implementation(libs.decomposeCompose)
implementation(libs.decompose)
implementation(libs.datetime)
implementation(libs.ktor.client.core)
implementation(libs.uuid)
}
androidMain.dependencies {
implementation(libs.activity.compose)
}
commonTest.dependencies {
implementation(kotlin("test"))
@OptIn(ExperimentalComposeLibrary::class)
implementation(compose.uiTest)
}
androidInstrumentedTest.dependencies {
implementation(project.dependencies.platform(libs.compose.bom))
implementation(libs.ui.test.junit4.android)
}
}
}
android {
publishing {
singleVariant("release") {
withSourcesJar()
withJavadocJar()
}
}
namespace = "com.idfinance.logkmpanion"
compileSdk = 34
defaultConfig {
minSdk = 21
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
dependencies {
debugImplementation(libs.ui.test.manifest)
}
}
Код: Выделить всё
@OptIn(ExperimentalTestApi::class)
class RootViewTest {
@Test
fun rootViewPresents() = runComposeUiTest {
setContent {
RootView(
ServiceLocator.getRootComponent(
context = DefaultComponentContext(LifecycleRegistry()),
onClose = {}
)
)
}
onNodeWithTag(RootViewTestTags.ROOT_VIEW).isDisplayed()
}
@Test
fun tabsSwitched() = runComposeUiTest {
setContent {
RootView(
ServiceLocator.getRootComponent(
context = DefaultComponentContext(LifecycleRegistry()),
onClose = {}
)
)
}
onNodeWithText("Network logs").performClick()
onNodeWithTag(NetworkLogsTestTags.ROOT_VIEW).assertExists()
onNodeWithTag(AllLogsTestTags.ROOT_VIEW).assertDoesNotExist()
onNodeWithText("All logs").performClick()
onNodeWithTag(AllLogsTestTags.ROOT_VIEW).assertExists()
onNodeWithTag(NetworkLogsTestTags.ROOT_VIEW).assertDoesNotExist()
}
}
< img alt="введите описание изображения здесь" src="https://i.sstatic.net/rU7csuHk.png" />
версия compose-bom, которую я использую:
Код: Выделить всё
compose-bom = "2024.11.00"
Подробнее здесь: https://stackoverflow.com/questions/791 ... y-and-stic