From 0aecd71e0982f5b0719d422a6866ec6b8df22ede Mon Sep 17 00:00:00 2001 From: andresmr Date: Tue, 16 Jul 2024 14:48:35 +0200 Subject: [PATCH 1/3] chore: [ANDROAPP-6326] set target SDK version Signed-off-by: andresmr --- app/build.gradle.kts | 12 +++--------- dhis2-mobile-program-rules/build.gradle.kts | 4 ++-- .../src/main/java/org/dhis2/maps/TeiMarkers.kt | 2 +- gradle/libs.versions.toml | 10 +++------- gradle/wrapper/gradle-wrapper.properties | 2 +- 5 files changed, 10 insertions(+), 20 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index b03420203b..cca87cdd55 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,7 +1,7 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import java.io.ByteArrayOutputStream import java.text.SimpleDateFormat import java.util.Date -import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { id("com.android.application") @@ -64,8 +64,6 @@ android { } } - ndkVersion = libs.versions.ndk.get() - compileSdk = libs.versions.sdk.get().toInt() namespace = "org.dhis2" testNamespace = "org.dhis2.test" @@ -75,6 +73,8 @@ android { defaultConfig { applicationId = "com.dhis2" + compileSdk = libs.versions.sdk.get().toInt() + targetSdk = libs.versions.sdk.get().toInt() minSdk = libs.versions.minSdk.get().toInt() versionCode = libs.versions.vCode.get().toInt() versionName = libs.versions.vName.get() @@ -129,12 +129,6 @@ android { } } - testOptions { - unitTests { - isReturnDefaultValues = true - } - } - buildTypes { getByName("debug") { diff --git a/dhis2-mobile-program-rules/build.gradle.kts b/dhis2-mobile-program-rules/build.gradle.kts index 70744274a4..6eeb1ae0ad 100644 --- a/dhis2-mobile-program-rules/build.gradle.kts +++ b/dhis2-mobile-program-rules/build.gradle.kts @@ -9,10 +9,10 @@ apply(from = "${project.rootDir}/jacoco/jacoco.gradle.kts") android { namespace = "org.dhis2.dhis2_mobile_program_rules" - compileSdk = 34 + compileSdk = libs.versions.sdk.get().toInt() defaultConfig { - minSdk = 21 + minSdk = libs.versions.minSdk.get().toInt() testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles("consumer-rules.pro") diff --git a/dhis2_android_maps/src/main/java/org/dhis2/maps/TeiMarkers.kt b/dhis2_android_maps/src/main/java/org/dhis2/maps/TeiMarkers.kt index 88e715830a..c21fde5116 100644 --- a/dhis2_android_maps/src/main/java/org/dhis2/maps/TeiMarkers.kt +++ b/dhis2_android_maps/src/main/java/org/dhis2/maps/TeiMarkers.kt @@ -21,7 +21,7 @@ object TeiMarkers { Bitmap.Config.ARGB_8888, ) val markerBitmap = - Bitmap.createBitmap(canvasMarker.width, canvasMarker.height, canvasMarker.config) + Bitmap.createBitmap(canvasMarker.width, canvasMarker.height, Bitmap.Config.ARGB_8888) val canvas = Canvas(markerBitmap) drawable.setBounds(0, 0, canvas.width, canvas.height) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 653ae90168..b4832c3581 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,16 +1,14 @@ [versions] -ndk = "21.4.7075529" sdk = "34" minSdk = "21" vCode = "130" -vName = "3.0" -kotlinCompilerExtensionVersion = "1.5.6" -gradle = "8.4.2" +vName = "3.1.0" +gradle = "8.5.1" kotlin = '2.0.0' hilt = '2.47' jacoco = '0.8.10' designSystem = "0.3.0-SNAPSHOT" -dhis2sdk = "1.10.0" +dhis2sdk = "1.11.0-SNAPSHOT" ruleEngine = "3.0.0" expressionParser = "1.1.0" appcompat = "1.6.1" @@ -20,7 +18,6 @@ legacysupport = "1.0.0" multidex = "2.0.1" constraintlayout = "2.1.4" lifecycle = "2.6.1" -lifecycleExtensions = "2.2.0" work = "2.8.1" exif = "1.3.6" corektx = "1.10.1" @@ -148,7 +145,6 @@ dagger-hilt-android-compiler = { group = "com.google.dagger", name = "hilt-andro dagger-hilt-compiler-new = { group = "com.google.dagger", name = "hilt-compiler", version.ref = "hilt" } rx-java = { group = "io.reactivex.rxjava2", name = "rxjava", version.ref = "rxjava" } rx-android = { group = "io.reactivex.rxjava2", name = "rxandroid", version.ref = "rxandroid" } -rx-binding = { group = "com.jakewharton.rxbinding2", name = "rxbinding", version.ref = "rxbindings" } rx-binding-compat = { group = "com.jakewharton.rxbinding2", name = "rxbinding-appcompat-v7", version.ref = "rxbindings" } rx-relay = { group = "com.jakewharton.rxrelay2", name = "rxrelay", version.ref = "rxrelay" } github-pinlock = { group = "com.github.aritraroy", name = "PinLockView", version.ref = "pinlock" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7e7a9963bd..4d150bbc7a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Wed Jun 26 12:02:53 CEST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 3ea368ab741aeb7ea7b1b3718135d64792ad103a Mon Sep 17 00:00:00 2001 From: andresmr Date: Wed, 17 Jul 2024 12:27:20 +0200 Subject: [PATCH 2/3] test: [ANDROAPP-6326] wait until sync successful Signed-off-by: andresmr --- .../org/dhis2/usescases/flow/syncFlow/robot/SyncFlowRobot.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/androidTest/java/org/dhis2/usescases/flow/syncFlow/robot/SyncFlowRobot.kt b/app/src/androidTest/java/org/dhis2/usescases/flow/syncFlow/robot/SyncFlowRobot.kt index ff52409966..47febdf6ea 100644 --- a/app/src/androidTest/java/org/dhis2/usescases/flow/syncFlow/robot/SyncFlowRobot.kt +++ b/app/src/androidTest/java/org/dhis2/usescases/flow/syncFlow/robot/SyncFlowRobot.kt @@ -30,9 +30,11 @@ class SyncFlowRobot(val composeTestRule: ComposeTestRule) : BaseRobot() { composeTestRule.onNodeWithTag(MAIN_BUTTON_TAG, useUnmergedTree = true).performClick() } + @OptIn(ExperimentalTestApi::class) fun checkSyncWasSuccessfully() { val expectedTitle = InstrumentationRegistry.getInstrumentation() .targetContext.getString(R.string.sync_dialog_title_synced) + composeTestRule.waitUntilAtLeastOneExists(hasText(expectedTitle)) composeTestRule.onNodeWithTag(TITLE, useUnmergedTree = true).assert(hasText(expectedTitle, true)) } From a55b8307df27187565182e7a01cd229efc6c8046 Mon Sep 17 00:00:00 2001 From: andresmr Date: Wed, 17 Jul 2024 14:04:41 +0200 Subject: [PATCH 3/3] test: fix shouldCheckDisplayInList Signed-off-by: andresmr --- .../usescases/searchte/robot/SearchTeiRobot.kt | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/app/src/androidTest/java/org/dhis2/usescases/searchte/robot/SearchTeiRobot.kt b/app/src/androidTest/java/org/dhis2/usescases/searchte/robot/SearchTeiRobot.kt index 12889d0f92..ec1590f6e6 100644 --- a/app/src/androidTest/java/org/dhis2/usescases/searchte/robot/SearchTeiRobot.kt +++ b/app/src/androidTest/java/org/dhis2/usescases/searchte/robot/SearchTeiRobot.kt @@ -14,18 +14,16 @@ import androidx.compose.ui.test.performTextInput import androidx.test.espresso.Espresso.onView import androidx.test.espresso.action.ViewActions.click import androidx.test.espresso.assertion.ViewAssertions.matches -import androidx.test.espresso.contrib.RecyclerViewActions.actionOnItem -import androidx.test.espresso.contrib.RecyclerViewActions.scrollTo import androidx.test.espresso.matcher.ViewMatchers.hasDescendant import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withText +import androidx.test.platform.app.InstrumentationRegistry import org.dhis2.R import org.dhis2.common.BaseRobot import org.dhis2.common.matchers.RecyclerviewMatchers import org.dhis2.common.matchers.RecyclerviewMatchers.Companion.hasItem import org.dhis2.common.matchers.RecyclerviewMatchers.Companion.hasNoMoreResultsInProgram import org.dhis2.common.viewactions.openSpinnerPopup -import org.dhis2.usescases.searchTrackEntity.adapters.SearchTEViewHolder import org.dhis2.usescases.searchTrackEntity.listView.SearchResult import org.dhis2.usescases.searchte.entity.DisplayListFieldsUIModel import org.hamcrest.CoreMatchers.allOf @@ -127,15 +125,16 @@ class SearchTeiRobot(val composeTestRule: ComposeTestRule) : BaseRobot() { onView(withId(R.id.spinner_text)).check(matches(withText(program))) } - fun checkFieldsFromDisplayList( displayListFieldsUIModel: DisplayListFieldsUIModel ) { //Given the title is the first attribute val title = "First name: ${displayListFieldsUIModel.name}" val displayedAttributes = createAttributesList(displayListFieldsUIModel) + val showMoreText = InstrumentationRegistry.getInstrumentation() + .targetContext.getString(R.string.show_more) //When we expand all attribute list - composeTestRule.onNodeWithText("Show more", true).performClick() + composeTestRule.onNodeWithText(showMoreText, true, useUnmergedTree = true).performClick() composeTestRule.waitForIdle() //Then The title and all attributes are displayed composeTestRule.onNodeWithText(title).assertIsDisplayed() @@ -165,15 +164,6 @@ class SearchTeiRobot(val composeTestRule: ComposeTestRule) : BaseRobot() { onView(withId(R.id.createButton)).perform(click()) } - fun checkListOfSearchTEIWithAdditionalInfo(title: String, additionalText: String) { - composeTestRule.onNodeWithText(title).assertIsDisplayed() - composeTestRule.onNode( - hasParent(hasTestTag("LIST_CARD_ADDITIONAL_INFO_COLUMN")) - and hasText(additionalText, true), - useUnmergedTree = true, - ).assertIsDisplayed() - } - private fun createAttributesList(displayListFieldsUIModel: DisplayListFieldsUIModel) = listOf( AdditionalInfoItem( key = "Last name",