From 25a5c9323f125665906243ec9ce373927e61de18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=E2=89=A1ZRS?= <12814349+LZRS@users.noreply.github.com> Date: Sun, 30 Jul 2023 07:06:41 +0300 Subject: [PATCH] [wip] Fix failing compose tests with AppNotIdleException https://github.com/robolectric/robolectric/issues/7055 --- android/build.gradle | 4 ++-- android/deps.gradle | 22 +++++++++--------- android/engine/build.gradle | 23 ++++++++++++++++--- .../components/CircularProgressBarKtTest.kt | 2 ++ android/quest/build.gradle | 22 ++++++++++++++++-- .../PatientRegisterRowViewConfiguration.kt | 10 ++------ 6 files changed, 57 insertions(+), 26 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 79a6ff30ba0..dc07d7c96d4 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -8,8 +8,8 @@ buildscript { } dependencies { - classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10' - classpath "org.jetbrains.kotlin:kotlin-serialization:1.8.10" + classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.22' + classpath "org.jetbrains.kotlin:kotlin-serialization:1.8.22" classpath 'com.google.dagger:hilt-android-gradle-plugin:2.45' classpath deps.spotless classpath deps.kotlin_coveralls_plugin diff --git a/android/deps.gradle b/android/deps.gradle index 519dc9e4f09..f0b60d3e6c1 100644 --- a/android/deps.gradle +++ b/android/deps.gradle @@ -15,14 +15,14 @@ def versions = [:] versions.activity = '1.2.1' versions.android_gradle_plugin = '7.1.2' versions.appcompat = '1.4.1' -versions.atsl_core = '1.4.1-alpha04' -versions.atsl_expresso = '3.5.0' -versions.atsl_junit = '1.1.3' -versions.atsl_rules = '1.4.0' -versions.atsl_runner = '1.4.0' +versions.atsl_core = '1.5.0' +versions.atsl_expresso = '3.5.1' +versions.atsl_junit = '1.1.5' +versions.atsl_rules = '1.5.0' +versions.atsl_runner = '1.5.2' versions.caffeine = '2.9.0' versions.constraint_layout = '1.1.3' -versions.coroutines = '1.6.4' +versions.coroutines = '1.7.3' versions.core = '1.7.0' versions.cql_engine = '1.3.14-SNAPSHOT' versions.desugar = '1.1.5' @@ -31,13 +31,13 @@ versions.fhir_protos = '0.6.1' versions.guava = '28.2-android' versions.hapi_r4 = '5.3.0' versions.junit5_api = '5.9.3' -versions.kotlin = '1.8.10' +versions.kotlin = '1.8.22' versions.lifecycle = '2.2.0' versions.material = '1.5.0' versions.okhttp_logging_interceptor = '4.0.0' versions.recyclerview = '1.1.0' versions.retrofit = '2.7.2' -versions.robolectric = '4.9-alpha-1' +versions.robolectric = '4.9.2' versions.room = '2.4.2' versions.spotless = '5.11.0' versions.truth = '1.0.1' @@ -48,11 +48,11 @@ versions.jacoco_tool = '0.8.7' versions.ktlint = '0.41.0' versions.joda_time = '2.10.5' versions.timber = '4.7.1' -versions.mockk = '1.12.4' +versions.mockk = '1.13.5' versions.dokka = '1.5.0' -versions.androidx_test = '2.1.0' +versions.androidx_test = '2.2.0' versions.accompanist_swiperefresh = '0.26.4-beta' -versions.compose = '1.3.3' +versions.compose = '1.4.3' ext.versions = versions def deps = [:] diff --git a/android/engine/build.gradle b/android/engine/build.gradle index 56169ab1465..bf1408948a1 100644 --- a/android/engine/build.gradle +++ b/android/engine/build.gradle @@ -48,7 +48,7 @@ android { viewBinding true } composeOptions { - kotlinCompilerExtensionVersion '1.4.2' + kotlinCompilerExtensionVersion '1.4.8' } //CQL @@ -87,6 +87,22 @@ android { includeAndroidResources = true returnDefaultValues = true all { + testLogging { + // set options for log level LIFECYCLE + events "failed" + exceptionFormat "full" + + // set options for log level DEBUG + debug { + events "started", "skipped", "failed" + exceptionFormat "full" + } + + // remove standard output/error logging from --info builds + // by assigning only 'failed' and 'skipped' events + info.events = ["failed", "skipped"] + } + minHeapSize = "4608m" maxHeapSize = "4608m" beforeTest { testDescriptor -> @@ -183,7 +199,7 @@ dependencies { api("androidx.work:work-runtime-ktx:2.8.0") testApi 'androidx.work:work-testing:2.8.0' - def coroutineVersion = '1.6.4' + def coroutineVersion = '1.7.3' api("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutineVersion") api("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutineVersion") api("org.smartregister:contrib-barcode:0.1.0-beta3-preview5-SNAPSHOT"){ @@ -243,6 +259,7 @@ dependencies { testRuntimeOnly deps.junit5_engine testRuntimeOnly deps.junit5_engine_vintage testImplementation deps.robolectric + testImplementation deps.atsl.core testImplementation deps.atsl.ext_junit testImplementation deps.atsl.ext_junit_ktx testImplementation deps.coroutines.test @@ -254,7 +271,7 @@ dependencies { androidTestImplementation deps.atsl.ext_junit androidTestImplementation deps.atsl.espresso testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutineVersion" - androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation deps.atsl.ext_junit androidTestImplementation "androidx.test.espresso:espresso-core:$versions.atsl_expresso" implementation deps.work.runtime testImplementation group: 'org.json', name: 'json', version: '20210307' diff --git a/android/engine/src/test/java/org/smartregister/fhircore/engine/ui/components/CircularProgressBarKtTest.kt b/android/engine/src/test/java/org/smartregister/fhircore/engine/ui/components/CircularProgressBarKtTest.kt index c9eac3310c7..15653939954 100644 --- a/android/engine/src/test/java/org/smartregister/fhircore/engine/ui/components/CircularProgressBarKtTest.kt +++ b/android/engine/src/test/java/org/smartregister/fhircore/engine/ui/components/CircularProgressBarKtTest.kt @@ -30,6 +30,8 @@ internal class CircularProgressBarKtTest : RobolectricTest() { @get:Rule val composeRule = createComposeRule() + // TODO: Fix https://github.com/robolectric/robolectric/issues/7055 + @Test fun testCircularProgressBarWithText() { composeRule.setContent { CircularProgressBar(text = textSyncing) } diff --git a/android/quest/build.gradle b/android/quest/build.gradle index 1d614492b4b..3655de12b9e 100644 --- a/android/quest/build.gradle +++ b/android/quest/build.gradle @@ -109,7 +109,7 @@ android { } composeOptions { - kotlinCompilerExtensionVersion '1.4.2' + kotlinCompilerExtensionVersion '1.4.8' } testOptions { @@ -120,6 +120,23 @@ android { includeAndroidResources = true returnDefaultValues = true all { + + testLogging { + // set options for log level LIFECYCLE + events "failed" + exceptionFormat "full" + + // set options for log level DEBUG + debug { + events "started", "skipped", "failed" + exceptionFormat "full" + } + + // remove standard output/error logging from --info builds + // by assigning only 'failed' and 'skipped' events + info.events = ["failed", "skipped"] + } + beforeTest { testDescriptor -> println "${testDescriptor.className} > ${testDescriptor.name} STARTED" } @@ -201,6 +218,7 @@ dependencies { testRuntimeOnly deps.junit5_engine testRuntimeOnly deps.junit5_engine_vintage testImplementation deps.robolectric + testImplementation deps.atsl.core testImplementation deps.atsl.ext_junit testImplementation deps.atsl.ext_junit_ktx testImplementation deps.coroutines.test @@ -208,7 +226,7 @@ dependencies { debugImplementation deps.fragment_testing releaseImplementation deps.fragment_testing testImplementation deps.mockk - testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4' + testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3' // analytics implementation platform('com.google.firebase:firebase-bom:31.2.0') diff --git a/android/quest/src/main/java/org/smartregister/fhircore/quest/configuration/view/PatientRegisterRowViewConfiguration.kt b/android/quest/src/main/java/org/smartregister/fhircore/quest/configuration/view/PatientRegisterRowViewConfiguration.kt index 1f400484867..7bf16ab1a08 100644 --- a/android/quest/src/main/java/org/smartregister/fhircore/quest/configuration/view/PatientRegisterRowViewConfiguration.kt +++ b/android/quest/src/main/java/org/smartregister/fhircore/quest/configuration/view/PatientRegisterRowViewConfiguration.kt @@ -86,14 +86,8 @@ data class Property( @Stable @Serializable data class DynamicColor(val valueEqual: String, val useColor: String) -enum class FontWeight { +enum class FontWeight(val weight: Int) { LIGHT(300), NORMAL(400), - BOLD(700); - - val weight: Int - - constructor(weight: Int) { - this.weight = weight - } + BOLD(700) }