From 5ba5c6037c3b88b21d46cc551de95d2b05323661 Mon Sep 17 00:00:00 2001 From: andresmr Date: Mon, 29 Apr 2024 10:37:46 +0200 Subject: [PATCH] [ANDROAPP-5701] mock pin response in SyncFlowTest Signed-off-by: andresmr --- .../dhis2/usescases/flow/syncFlow/SyncFlowTest.kt | 13 +++++++++++-- .../dhisUITesting/assets/mocks/systeminfo/ping.txt | 1 + gradle/libs.versions.toml | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 app/src/dhisUITesting/assets/mocks/systeminfo/ping.txt diff --git a/app/src/androidTest/java/org/dhis2/usescases/flow/syncFlow/SyncFlowTest.kt b/app/src/androidTest/java/org/dhis2/usescases/flow/syncFlow/SyncFlowTest.kt index 458845c14fd..7e24f017dcd 100644 --- a/app/src/androidTest/java/org/dhis2/usescases/flow/syncFlow/SyncFlowTest.kt +++ b/app/src/androidTest/java/org/dhis2/usescases/flow/syncFlow/SyncFlowTest.kt @@ -20,13 +20,12 @@ import org.dhis2.usescases.searchTrackEntity.SearchTEActivity import org.dhis2.usescases.searchte.robot.searchTeiRobot import org.dhis2.usescases.teidashboard.robot.eventRobot import org.dhis2.usescases.teidashboard.robot.teiDashboardRobot -import org.junit.Ignore +import org.hisp.dhis.android.core.mockwebserver.ResponseController.GET import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import syncFlowRobot import java.util.UUID -import org.dhis2.usescases.eventsWithoutRegistration.eventCapture.EventCaptureActivity @RunWith(AndroidJUnit4::class) class SyncFlowTest : BaseTest() { @@ -48,12 +47,15 @@ class SyncFlowTest : BaseTest() { override fun setUp() { super.setUp() + setupMockServer() workInfoStatusLiveData = ApplicationProvider.getApplicationContext().mutableWorkInfoStatuses } @Test fun shouldShowErrorWhenTEISyncFails() { + mockWebServerRobot.addResponse(GET, "/api/system/ping", API_PING_RESPONSE_OK) + val teiName = "Lars" val teiLastName = "Overland" @@ -95,6 +97,8 @@ class SyncFlowTest : BaseTest() { @Test fun shouldSuccessfullySyncSavedEvent() { + mockWebServerRobot.addResponse(GET, "/api/system/ping", API_PING_RESPONSE_OK) + prepareMalariaEventIntentAndLaunchActivity(ruleEventWithoutRegistration) eventWithoutRegistrationRobot(composeTestRule) { @@ -118,6 +122,8 @@ class SyncFlowTest : BaseTest() { @Test fun shouldShowErrorWhenSyncEventFails() { + mockWebServerRobot.addResponse(GET, "/api/system/ping", API_PING_RESPONSE_OK) + prepareMalariaEventIntentAndLaunchActivity(ruleEventWithoutRegistration) eventWithoutRegistrationRobot(composeTestRule) { @@ -141,6 +147,8 @@ class SyncFlowTest : BaseTest() { @Test fun shouldSuccessfullySyncSavedDataSet() { + mockWebServerRobot.addResponse(GET, "/api/system/ping", API_PING_RESPONSE_OK) + prepareFacilityDataSetIntentAndLaunchActivity(ruleDataSet) dataSetRobot { @@ -223,5 +231,6 @@ class SyncFlowTest : BaseTest() { companion object { const val LAB_MONITORING_EVENT_DATE = "28/6/2020" + const val API_PING_RESPONSE_OK = "mocks/systeminfo/ping.txt" } } \ No newline at end of file diff --git a/app/src/dhisUITesting/assets/mocks/systeminfo/ping.txt b/app/src/dhisUITesting/assets/mocks/systeminfo/ping.txt new file mode 100644 index 00000000000..ed53c213589 --- /dev/null +++ b/app/src/dhisUITesting/assets/mocks/systeminfo/ping.txt @@ -0,0 +1 @@ +pong \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ba2cdc63643..7b3fd714acf 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,7 +11,7 @@ hilt = '2.47' hiltCompiler = '1.0.0' jacoco = '0.8.10' designSystem = "0.2-20240426.091900-58" -dhis2sdk = "1.10.0-20240410.081505-42" +dhis2sdk = "1.10.0-20240426.151240-44" ruleEngine = "3.0.0-20240119.134348-12" expressionParser = "1.1.0-20240219.115041-14" appcompat = "1.6.1"