Skip to content

Commit

Permalink
Merge branch 'develop' into release/3.1.0-RC
Browse files Browse the repository at this point in the history
  • Loading branch information
andresmr authored Nov 19, 2024
2 parents 66b4e52 + 1a1d799 commit fb48526
Show file tree
Hide file tree
Showing 45 changed files with 293 additions and 464 deletions.
5 changes: 4 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
9 changes: 0 additions & 9 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -283,15 +283,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
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 @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ class EventRegistrationRobot(val composeTestRule: ComposeTestRule) : BaseRobot()
}
}

fun checkEventDataEntryIsOpened(completion: Int, email: String, composeTestRule: ComposeTestRule) {
fun checkEventDataEntryIsOpened(completion: Int, orgUnit: String) {
onView(withId(R.id.completion)).check(matches(hasCompletedPercentage(completion)))
composeTestRule.onNodeWithText(email).performScrollTo()
composeTestRule.onNodeWithText(email).assertIsDisplayed()
composeTestRule.onNodeWithText(orgUnit).performScrollTo().assertIsDisplayed()
}

fun clickOnShare() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ class EventTest : BaseTest() {

@Test
fun shouldShowEventDetailsWhenClickOnDetailsInsideSpecificEvent() {
val completion = 92
val email = "[email protected]"
val completion = 100
val orgUnit = "Ngelehun CHC"

prepareEventDetailsIntentAndLaunchActivity(rule)

eventRegistrationRobot(composeTestRule) {
checkEventDataEntryIsOpened(completion, email, composeTestRule)
checkEventDataEntryIsOpened(completion, orgUnit)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import androidx.compose.ui.text.intl.Locale
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.rule.ActivityTestRule
import org.dhis2.R
import org.dhis2.common.mockwebserver.MockWebServerRobot.Companion.API_OLD_TRACKED_ENTITY_PATH
import org.dhis2.common.mockwebserver.MockWebServerRobot.Companion.API_OLD_TRACKED_ENTITY_RESPONSE
import org.dhis2.common.mockwebserver.MockWebServerRobot.Companion.API_TRACKED_ENTITY_EMPTY_RESPONSE
import org.dhis2.common.mockwebserver.MockWebServerRobot.Companion.API_TRACKED_ENTITY_PATH
import org.dhis2.usescases.BaseTest
import org.dhis2.usescases.flow.teiFlow.entity.DateRegistrationUIModel
import org.dhis2.usescases.flow.teiFlow.entity.RegisterTEIUIModel
Expand Down Expand Up @@ -43,8 +43,8 @@ class SearchFlowTest : BaseTest() {
fun shouldCreateTEIAndFilterByEnrollment() {
mockWebServerRobot.addResponse(
ResponseController.GET,
API_OLD_TRACKED_ENTITY_PATH,
API_OLD_TRACKED_ENTITY_RESPONSE,
API_TRACKED_ENTITY_PATH,
API_TRACKED_ENTITY_EMPTY_RESPONSE,
)

setDatePicker()
Expand Down
Loading

0 comments on commit fb48526

Please sign in to comment.