Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/src/main/java/org/dhis2/usescases/searchTrackEntity/SearchTEActivity.java
#	app/src/main/java/org/dhis2/usescases/searchTrackEntity/ui/SearchTEUi.kt
#	app/src/main/res/values/strings.xml
#	gradle/libs.versions.toml
  • Loading branch information
CarlosMacaneta committed Nov 11, 2024
2 parents 50c9641 + 1a1d799 commit b70d072
Show file tree
Hide file tree
Showing 369 changed files with 12,377 additions and 6,965 deletions.
12 changes: 11 additions & 1 deletion .tx/config
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
[main]
host = https://www.transifex.com
lang_map = fa_AF: prs, uz@Cyrl: uz, uz@Latn: b+uz+Latn, zh_CN: zh-rCN, pt_BR: pt-rBR, es_419: b+es+419
lang_map = fa_AF: prs, uz@Cyrl: uz, uz@Latn: b+uz+Latn, zh_CN: zh-rCN, pt_BR: pt-rBR,
es_419: b+es+419, ar_EG: ar-rEG, sw_TZ: sw-rTZ, hi_IN: hi, en_US: en-rUS, ar_IQ: ar-rIQ,
ko_KR: ko-rKR, zh_HK: zh-rHK, ar_SD: ar-rSD

[o:hisp-uio:p:dhis2-android-capture-app:r:stock-strings-xml]
file_filter = stock-usecase/src/main/res/values-<lang>/strings.xml
source_file = stock-usecase/src/main/res/values/strings.xml
source_lang = en
type = ANDROID
minimum_perc = 0
resource_name = LMIS

[o:hisp-uio:p:dhis2-android-capture-app:r:analytics-strings-xml]
file_filter = dhis_android_analytics/src/main/res/values-<lang>/strings.xml
Expand Down Expand Up @@ -57,3 +60,10 @@ source_file = compose-table/src/main/res/values/strings.xml
source_lang = en
type = ANDROID
minimum_perc = 0

[o:hisp-uio:p:dhis2-android-capture-app:r:tracker-strings-xml]
file_filter = tracker/src/main/res/values-<lang>/strings.xml
source_file = tracker/src/main/res/values/strings.xml
source_lang = en
type = ANDROID
minimum_perc = 0
16 changes: 2 additions & 14 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ plugins {
id("com.android.application")
kotlin("android")
kotlin("kapt")
id("kotlin-parcelize")
id("kotlinx-serialization")
id("dagger.hilt.android.plugin")
alias(libs.plugins.kotlin.compose.compiler)
Expand Down Expand Up @@ -84,13 +85,9 @@ android {
vectorDrawables.useSupportLibrary = true
multiDexEnabled = true

val defMapboxToken =
"pk.eyJ1IjoiZGhpczJhbmRyb2lkIiwiYSI6ImNrcWt1a2hzYzE5Ymsyb254MWtlbGt4Y28ifQ.JrP61q9BFTVEKO4SwRUwDw"
val mapboxAccessToken = System.getenv("MAPBOX_ACCESS_TOKEN") ?: defMapboxToken
val bitriseSentryDSN = System.getenv("SENTRY_DSN") ?: ""

buildConfigField("String", "SDK_VERSION", "\"" + libs.versions.dhis2sdk.get() + "\"")
buildConfigField("String", "MAPBOX_ACCESS_TOKEN", "\"" + mapboxAccessToken + "\"")
buildConfigField("String", "MATOMO_URL", "\"https://usage.analytics.dhis2.org/matomo.php\"")
buildConfigField("long", "VERSION_CODE", "${defaultConfig.versionCode}")
buildConfigField("String", "VERSION_NAME", "\"${defaultConfig.versionName}\"")
Expand Down Expand Up @@ -289,15 +286,6 @@ dependencies {

coreLibraryDesugaring(libs.desugar)

debugImplementation(libs.analytics.flipper)
debugImplementation(libs.analytics.soloader)
debugImplementation(libs.analytics.flipper.network)
debugImplementation(libs.analytics.flipper.leak)
debugImplementation(libs.analytics.leakcanary)

releaseImplementation(libs.analytics.leakcanary.noop)
releaseImplementation(libs.analytics.flipper.noop)

"dhisPlayServicesImplementation"(libs.google.auth)
"dhisPlayServicesImplementation"(libs.google.auth.apiphone)

Expand Down Expand Up @@ -332,4 +320,4 @@ dependencies {
androidTestImplementation(libs.test.compose.ui.test)
androidTestImplementation(libs.test.hamcrest)
androidTestImplementation(libs.dispatcher.dispatchEspresso)
}
}
37 changes: 0 additions & 37 deletions app/src/androidTest/java/org/dhis2/common/filters/FiltersRobot.kt
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
package org.dhis2.common.filters

import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.TypeTextAction
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.contrib.PickerActions
import androidx.test.espresso.contrib.RecyclerViewActions
import androidx.test.espresso.matcher.ViewMatchers.withId
import org.dhis2.R
import org.dhis2.common.BaseRobot
import org.dhis2.common.matchers.DatePickerMatchers.Companion.matchesDate
import org.dhis2.commons.filters.FilterHolder

fun filterRobotCommon(robotBody: FiltersRobot.() -> Unit) {
FiltersRobot().apply {
Expand All @@ -19,43 +14,11 @@ fun filterRobotCommon(robotBody: FiltersRobot.() -> Unit) {
}

class FiltersRobot : BaseRobot() {
fun openFilterAtPosition(position: Int) {
onView(withId(R.id.filterRecyclerLayout)).perform(
RecyclerViewActions.actionOnItemAtPosition<FilterHolder>(position, click())
)
}

fun clickOnFromToDateOption() {
onView(withId(R.id.fromTo)).perform(click())
}

fun clickOnOrgUnitTree() {
onView(withId(R.id.ouTreeButton)).perform(click())
}

fun selectDate(year: Int, monthOfYear: Int, dayOfMonth: Int) {
onView(withId(R.id.datePicker)).perform(
PickerActions.setDate(year, monthOfYear, dayOfMonth)
)
}

fun typeOrgUnit(orgUnitName: String) {
onView(withId(R.id.orgUnitSearchEditText)).perform(TypeTextAction(orgUnitName))
}

fun clickAddOrgUnit() {
onView(withId(R.id.addButton)).perform(click())
}

fun selectNotSyncedState() {
onView(withId(R.id.stateNotSynced)).perform(click())
}

fun acceptDateSelected() {
onView(withId(R.id.acceptBtn)).perform(click())
}

fun checkDate(year: Int, monthOfYear: Int, dayOfMonth: Int) {
onView(withId(R.id.datePicker)).check(matches(matchesDate(year, monthOfYear, dayOfMonth)))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class KeyStoreRobot(private val keystore: AndroidSecureStore) {
}

companion object {
const val KEYSTORE_USERNAME = "username"
const val KEYSTORE_USERNAME = "android"
const val KEYSTORE_PASSWORD = "password"
const val USERNAME = "android"
const val PASSWORD = "Android123"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ class MockWebServerRobot(private val dhis2MockServer: Dhis2MockServer) {
}

companion object {
const val API_OLD_TRACKED_ENTITY_PATH = "/api/trackedEntityInstances/query?.*"
const val API_OLD_TRACKED_ENTITY_RESPONSE =
"mocks/teilist/old_tracked_entity_empty_response.json"
const val API_OLD_EVENTS_PATH = "/api/events?.*"
const val API_OLD_EVENTS_RESPONSE = "mocks/teilist/old_events_empty_response.json"

const val API_TRACKED_ENTITY_ATTRIBUTES_RESERVED_VALUES_PATH =
"/api/trackedEntityAttributes/lZGmxYbs97q/generateAndReserve?.*"
const val API_TRACKED_ENTITY_ATTRIBUTES_RESERVED_VALUES_RESPONSE =
"mocks/teidashboard/tracked_entity_attribute_reserved_values.json"
const val API_TRACKED_ENTITY_PATH = "/api/tracker/trackedEntities?.*"
const val API_TRACKED_ENTITY_EMPTY_RESPONSE =
"mocks/teilist/tracked_entity_empty_response.json"
const val API_EVENTS_PATH = "/api/tracker/events?.*"
const val API_EVENTS_EMPTY_RESPONSE = "mocks/teilist/events_empty_response.json"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.hasTestTag
import androidx.compose.ui.test.junit4.ComposeContentTestRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performImeAction
import androidx.compose.ui.test.performScrollTo
Expand All @@ -13,6 +14,7 @@ import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
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.composetable.ui.INPUT_TEST_FIELD_TEST_TAG
Expand Down Expand Up @@ -51,7 +53,9 @@ class DataSetTableRobot(
}

fun clickOnMenuReOpen() {
onView(withText(R.string.re_open)).perform(click())
with(InstrumentationRegistry.getInstrumentation().targetContext) {
composeTestRule.onNodeWithText(getString(R.string.re_open)).performClick()
}
}

fun typeOnCell(tableId: String, rowIndex: Int, columnIndex: Int) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,123 +46,80 @@ class DataSetTest : BaseTest() {
}
}

@Ignore("Indeterministic it will be addressed in ANDROAPP-6458")
@Test
fun shouldCreateNewDataSet() {
val period = "Aug 2024"
val period = "Jul 2025"
val orgUnit = "Ngelehun CHC"
startDataSetDetailActivity("ZOV1a5R4gqH", "DS EXTRA TEST", ruleDataSetDetail)
startDataSetDetailActivity(
"BfMAe6Itzgt",
"Child Health",
ruleDataSetDetail
)

dataSetDetailRobot {
clickOnAddDataSet()
}
dataSetInitialRobot {
clickOnInputOrgUnit()
orgUnitSelectorRobot(composeTestRule) {
selectTreeOrgUnit(orgUnit)
}
}

orgUnitSelectorRobot(composeTestRule) {
selectTreeOrgUnit(orgUnit)
}

dataSetInitialRobot {
clickOnInputPeriod()
selectPeriod(period)
clickOnActionButton()
}
dataSetTableRobot(composeTestRule) {
typeOnCell("bjDvmb4bfuf", 0, 0)
typeOnCell("dzjKKQq0cSO", 0, 0)
clickOnEditValue()
typeInput("1")
composeTestRule.waitForIdle()
pressBack()
composeTestRule.waitForIdle()
pressBack()
composeTestRule.waitForIdle()
clickOnSaveButton()
waitToDebounce(500)
clickOnNegativeButton()
clickOnNegativeButton()
}
}

@Test
fun shouldOpenAndEditDataset() {
startDataSetDetailActivity("ZOV1a5R4gqH", "DS EXTRA TEST", ruleDataSetDetail)

dataSetRobot {
clickOnDataSetAtPosition(0)
}

dataSetTableRobot(composeTestRule) {
typeOnCell("bjDvmb4bfuf", 0, 0)
typeOnCell("dzjKKQq0cSO", 0, 1)
clickOnEditValue()
typeInput("5")
composeTestRule.waitForIdle()
pressBack()
composeTestRule.waitForIdle()
pressBack()
composeTestRule.waitForIdle()
clickOnSaveButton()
waitToDebounce(500)
clickOnNegativeButton()
}
}

@Test
fun shouldReopenModifyAndCompleteDataset() {
startDataSetDetailActivity("V8MHeZHIrcP", "Facility Assessment", ruleDataSetDetail)

dataSetRobot {
clickOnDataSetAtPosition(0)
}

dataSetTableRobot(composeTestRule) {
openMenuMoreOptions()
clickOnMenuReOpen()
clickOnPositiveButton()
typeOnCell("bjDvmb4bfuf", 0, 0)
clickOnAcceptDate()
clickOnSaveButton()
waitToDebounce(500)
clickOnPositiveButton()
}
dataSetDetailRobot {
checkDataSetIsCompleteAndModified("2019")
}

}

@Test
fun shouldBlockSelectingNewCellIfCurrentHasError() {
startDataSetDetailActivity("ZOV1a5R4gqH", "DS EXTRA TEST", ruleDataSetDetail)
fun shouldSelectNewCellIfCurrentHasNoErrorAndBlockSelectingNewCellIfCurrentHasError() {
startDataSetDetailActivity("BfMAe6Itzgt", "Child Health", ruleDataSetDetail)

dataSetRobot {
clickOnDataSetAtPosition(0)
}

dataSetTableRobot(composeTestRule) {
typeOnCell("bjDvmb4bfuf", 0, 0)
typeOnCell("dzjKKQq0cSO", 0, 0)
clickOnEditValue()
typeInput("5,,")
typeInput("5")
composeTestRule.waitForIdle()
composeTestRule.onNodeWithTag(INPUT_TEST_FIELD_TEST_TAG).performImeAction()
composeTestRule.waitForIdle()
assertCellSelected("bjDvmb4bfuf", 0, 0)
}
}

@Test
fun shouldSelectNewCellIfCurrentHasNoError() {
startDataSetDetailActivity("ZOV1a5R4gqH", "DS EXTRA TEST", ruleDataSetDetail)
assertCellSelected("dzjKKQq0cSO", 0, 1)

dataSetRobot {
clickOnDataSetAtPosition(0)
}

dataSetTableRobot(composeTestRule) {
typeOnCell("bjDvmb4bfuf", 0, 0)
clickOnEditValue()
typeInput("5")
typeInput("5,,")
composeTestRule.waitForIdle()
composeTestRule.onNodeWithTag(INPUT_TEST_FIELD_TEST_TAG).performImeAction()
composeTestRule.waitForIdle()
waitToDebounce(500)
assertCellSelected("bjDvmb4bfuf", 1, 0)
assertCellSelected("dzjKKQq0cSO", 0, 1)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ const val ENROLLMENT_UID = "ENROLLMENT_UID"
const val PROGRAM_STAGE_UID = "PROGRAM_STAGE_UID"

const val PROGRAM_TB_UID = "ur1Edk5Oe2n"
const val PROGRAM_XX_TRACKER_UID = "U5KybNCtA3E"
const val EVENT_DETAILS_UID = "oPCuUeDGaIu"
const val ANTENATAL_CARE_PROGRAM_UID = "lxAQ7Zs9VYR"
const val ANTENATAL_CARE_EVENT_UID = "ohAH6BXIMad"
const val EVENT_TO_SHARE_UID = "y0xoVIzBpnL"
const val TEI_EVENT_TO_DELETE_UID = "foc5zag6gbE"
const val ENROLLMENT_EVENT_DELETE_UID = "SolDyMgW3oc"
Expand All @@ -30,8 +30,8 @@ fun prepareEventDetailsIntentAndLaunchActivity(rule: LazyActivityScenarioRule<Ev
ApplicationProvider.getApplicationContext(),
EventCaptureActivity::class.java,
).apply {
putExtra(PROGRAM_UID, PROGRAM_XX_TRACKER_UID)
putExtra(EVENT_UID, EVENT_DETAILS_UID)
putExtra(PROGRAM_UID, ANTENATAL_CARE_PROGRAM_UID)
putExtra(EVENT_UID, ANTENATAL_CARE_EVENT_UID)
putExtra(Constants.EVENT_MODE, EventMode.CHECK)

}.also { rule.launch(it) }
Expand Down
Loading

0 comments on commit b70d072

Please sign in to comment.