Skip to content

Commit

Permalink
Merge branch 'refs/heads/release/3.0.1' into release/3.0.0.2
Browse files Browse the repository at this point in the history
# Conflicts:
#	commons/src/main/java/org/dhis2/commons/date/DateUtils.java
#	commons/src/main/java/org/dhis2/commons/orgunitselector/OUTreeFragment.kt
#	form/src/main/java/org/dhis2/form/ui/provider/inputfield/DateProvider.kt
#	gradle/libs.versions.toml
  • Loading branch information
andresmr committed Jul 11, 2024
2 parents 008aeb9 + cd89434 commit c6dc12d
Show file tree
Hide file tree
Showing 125 changed files with 2,415 additions and 1,957 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/continuous-delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ on:
- main
- develop
- release/*
pull_request:
branches:
- main
- develop
- release/*

jobs:
deployment_job:
Expand Down
93 changes: 0 additions & 93 deletions .github/workflows/continuous-integration.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class MockWebServerRobot(private val dhis2MockServer: Dhis2MockServer) {
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"

}
}
3 changes: 0 additions & 3 deletions app/src/androidTest/java/org/dhis2/usescases/BaseTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import org.dhis2.commons.idlingresource.SearchIdlingResourceSingleton
import org.dhis2.commons.prefs.Preference
import org.dhis2.form.ui.idling.FormCountingIdlingResource
import org.dhis2.usescases.eventsWithoutRegistration.EventIdlingResourceSingleton
import org.dhis2.usescases.eventsWithoutRegistration.eventDetails.ui.EventDetailIdlingResourceSingleton
import org.dhis2.usescases.programEventDetail.eventList.EventListIdlingResourceSingleton
import org.dhis2.usescases.teiDashboard.dashboardfragments.teidata.TeiDataIdlingResourceSingleton
import org.junit.After
Expand Down Expand Up @@ -87,7 +86,6 @@ open class BaseTest {
SearchIdlingResourceSingleton.countingIdlingResource,
TeiDataIdlingResourceSingleton.countingIdlingResource,
EventIdlingResourceSingleton.countingIdlingResource,
EventDetailIdlingResourceSingleton.countingIdlingResource,
)
}

Expand All @@ -100,7 +98,6 @@ open class BaseTest {
SearchIdlingResourceSingleton.countingIdlingResource,
TeiDataIdlingResourceSingleton.countingIdlingResource,
EventIdlingResourceSingleton.countingIdlingResource,
EventDetailIdlingResourceSingleton.countingIdlingResource,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class EventRegistrationRobot : BaseRobot() {
}

private fun clickOnNextQR() {
onView(withId(R.id.next)).perform(click())
waitForView(withId(R.id.next)).perform(click())
}

fun clickOnAllQR(listQR: Int) {
Expand Down
11 changes: 0 additions & 11 deletions app/src/androidTest/java/org/dhis2/usescases/event/EventTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ class EventTest : BaseTest() {
val atenatalCare = "lxAQ7Zs9VYR"

prepareProgramAndLaunchActivity(atenatalCare)
disableRecyclerViewAnimations()

programEventsRobot(composeTestRule) {
clickOnAddEvent()
Expand Down Expand Up @@ -175,14 +174,4 @@ class EventTest : BaseTest() {
putExtra(ProgramEventDetailActivity.EXTRA_PROGRAM_UID, programUid)
}.also { eventListRule.launch(it) }
}

private fun disableRecyclerViewAnimations() {
eventListRule.getScenario().onActivity {
it.runOnUiThread {
it.supportFragmentManager.findFragmentByTag("EVENT_LIST").apply {
(this as EventListFragment).binding.recycler.itemAnimator = null
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class SearchFlowTest : BaseTest() {
)
val filterCounter = "1"
val filterTotalCount = "2"
enableComposeForms()
prepareWomanProgrammeIntentAndLaunchActivity(rule)

teiFlowRobot(composeTestRule) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import org.dhis2.usescases.searchte.robot.searchTeiRobot
import org.dhis2.usescases.teidashboard.robot.enrollmentRobot
import org.dhis2.usescases.teidashboard.robot.eventRobot
import org.dhis2.usescases.teidashboard.robot.teiDashboardRobot
import java.text.SimpleDateFormat
import java.util.Calendar

fun teiFlowRobot(
composeTestRule: ComposeTestRule,
teiFlowRobot: TeiFlowRobot.() -> Unit
teiFlowRobot: TeiFlowRobot.() -> Unit,
) {
TeiFlowRobot(composeTestRule).apply {
teiFlowRobot()
Expand All @@ -21,10 +23,10 @@ fun teiFlowRobot(
class TeiFlowRobot(val composeTestRule: ComposeTestRule) : BaseRobot() {

fun registerTEI(
registrationModel: RegisterTEIUIModel
registrationModel: RegisterTEIUIModel,
) {
val registrationDate = registrationModel.firstSpecificDate
val enrollmentDate = registrationModel.enrollmentDate
val incidentDate = getCurrentDate()

searchTeiRobot(composeTestRule) {
openNextSearchParameter("First name")
Expand All @@ -37,12 +39,8 @@ class TeiFlowRobot(val composeTestRule: ComposeTestRule) : BaseRobot() {
clickOnEnroll()
}

enrollmentRobot {
clickOnInputDate("Date of enrollment *")
selectSpecificDate(enrollmentDate.year, enrollmentDate.month, enrollmentDate.day)
clickOnAcceptInDatePicker()
clickOnInputDate("LMP Date *")
clickOnAcceptInDatePicker()
enrollmentRobot(composeTestRule) {
typeOnDateParameterWithLabel("LMP Date *", incidentDate)
clickOnSaveEnrollment()
}
}
Expand All @@ -53,10 +51,9 @@ class TeiFlowRobot(val composeTestRule: ComposeTestRule) : BaseRobot() {
clickOnMenuProgramEnrollments()
}

enrollmentRobot {
enrollmentRobot(composeTestRule) {
clickOnAProgramForEnrollment(composeTestRule, program)
clickOnAcceptInDatePicker()
scrollToBottomProgramForm()
clickOnSaveEnrollment()
}
}
Expand All @@ -67,16 +64,16 @@ class TeiFlowRobot(val composeTestRule: ComposeTestRule) : BaseRobot() {
clickOnMenuProgramEnrollments()
}

enrollmentRobot {
enrollmentRobot(composeTestRule) {
waitToDebounce(1000)
checkActiveAndPastEnrollmentDetails(enrollmentDetails)
}
}

fun checkPastEventsAreClosed(
programPosition: Int
programPosition: Int,
) {
enrollmentRobot {
enrollmentRobot(composeTestRule) {
clickOnEnrolledProgram(programPosition)
}

Expand All @@ -99,16 +96,34 @@ class TeiFlowRobot(val composeTestRule: ComposeTestRule) : BaseRobot() {

fun changeDueDate(
cardTitle: String,
date: String,
) {
teiDashboardRobot(composeTestRule) {
clickOnEventGroupByStageUsingDate(cardTitle)
}

eventRobot(composeTestRule) {
clickOnEventReportDate()
selectSpecificDate(date)
clickOnEventDueDate()
selectSpecificDate(getCurrentDatePickerDate(), getPreviousDate())
acceptUpdateEventDate()
}
}

private fun getCurrentDate(): String {
val sdf = SimpleDateFormat("ddMMYYYY")
val calendar = Calendar.getInstance()
return sdf.format(calendar.time)
}

private fun getPreviousDate(): String {
val sdf = SimpleDateFormat("MMddYYYY")
val calendar = Calendar.getInstance()
calendar.add(Calendar.DAY_OF_MONTH, -1)
return sdf.format(calendar.time)
}

private fun getCurrentDatePickerDate(): String {
val sdf = SimpleDateFormat("MM/dd/YYYY")
val calendar = Calendar.getInstance()
return sdf.format(calendar.time)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.rule.ActivityTestRule
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.commons.date.DateUtils
import org.dhis2.usescases.BaseTest
import org.dhis2.usescases.flow.teiFlow.entity.DateRegistrationUIModel
import org.dhis2.usescases.flow.teiFlow.entity.EnrollmentListUIModel
Expand All @@ -16,7 +17,6 @@ import org.hisp.dhis.android.core.mockwebserver.ResponseController
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import java.text.SimpleDateFormat
import java.util.Date


Expand Down Expand Up @@ -53,6 +53,7 @@ class TeiFlowTest : BaseTest() {
val enrollmentListDetails = createEnrollmentList()
val registerTeiDetails = createRegisterTEI()

enableComposeForms()
setupCredentials()
setDatePicker()
prepareWomanProgrammeIntentAndLaunchActivity(ruleSearch)
Expand All @@ -70,7 +71,7 @@ class TeiFlowTest : BaseTest() {
EnrollmentListUIModel(
ADULT_WOMAN_PROGRAM,
ORG_UNIT,
"30/6/2017",
currentDate,
currentDate
)

Expand All @@ -94,9 +95,9 @@ class TeiFlowTest : BaseTest() {
)

private fun getCurrentDate(): String {
val sdf = SimpleDateFormat(DATE_FORMAT)
val sdf = DateUtils.uiDateFormat()
val dateFormat = sdf.format(Date())
return dateFormat.removePrefix("0")
return dateFormat
}

private fun prepareWomanProgrammeIntentAndLaunchActivity(ruleSearch: ActivityTestRule<SearchTEActivity>) {
Expand All @@ -116,8 +117,5 @@ class TeiFlowTest : BaseTest() {
const val ORG_UNIT = "Ngelehun CHC"
const val NAME = "Marta"
const val LASTNAME = "Stuart"

const val DATE_FORMAT = "dd/M/yyyy"
const val DATE_PICKER_FORMAT = ", d MMMM"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@ class ProgramEventTest : BaseTest() {
clickOnFormFabButton()
clickOnCompleteButton()
}
composeTestRule.waitForIdle()
programEventsRobot(composeTestRule) {
checkEventWasCreatedAndClosed(eventOrgUnit)
checkEventWasCreatedAndClosed()
}
}

@Test
fun shouldOpenExistingEvent() {
val eventDate = "15/3/2020"
val eventDate = "15/03/2020"
val eventOrgUnit = "Ngelehun CHC"

prepareProgramAndLaunchActivity(antenatalCare)
Expand All @@ -80,7 +81,7 @@ class ProgramEventTest : BaseTest() {
@Ignore("Flaky test, will be look om issue ANDROAPP-6030")
@Test
fun shouldCompleteAnEventAndReopenIt() {
val eventDate = "15/3/2020"
val eventDate = "15/03/2020"

prepareProgramAndLaunchActivity(antenatalCare)

Expand All @@ -106,7 +107,7 @@ class ProgramEventTest : BaseTest() {

@Test
fun shouldDeleteEvent() {
val eventDate = "15/3/2020"
val eventDate = "15/03/2020"

prepareProgramAndLaunchActivity(antenatalCare)

Expand All @@ -121,6 +122,7 @@ class ProgramEventTest : BaseTest() {
programEventsRobot(composeTestRule) {
checkEventWasDeleted(eventDate)
}
composeTestRule.waitForIdle()
rule.getScenario().onActivity {
context.applicationContext.deleteDatabase(DB_TO_IMPORT)
}
Expand Down
Loading

0 comments on commit c6dc12d

Please sign in to comment.