Skip to content

Commit

Permalink
test: [ANDROAPP-6455] Update login flow (#3791)
Browse files Browse the repository at this point in the history
* update login flow

* removed comment for loginFlow test to run

* test: Ignore SyncFlowTest

Signed-off-by: andresmr <[email protected]>

* test: add WaitForIdle in checkTreeOrgUnitFilter

Signed-off-by: andresmr <[email protected]>

---------

Signed-off-by: andresmr <[email protected]>
Co-authored-by: rohit-wa <[email protected]>
  • Loading branch information
andresmr and rohit-wa authored Sep 5, 2024
1 parent 4ea354c commit 7d58872
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class SyncFlowTest : BaseTest() {
ApplicationProvider.getApplicationContext<AppTest>().mutableWorkInfoStatuses
}

@Ignore("failing by a bug - ANDROAPP-6154")
@Ignore("Flaky test, will be addressed in issue ANDROAPP-6465")
@Test
fun shouldShowErrorWhenTEISyncFails() {
mockWebServerRobot.addResponse(GET, "/api/system/ping", API_PING_RESPONSE_OK)
Expand Down Expand Up @@ -97,7 +97,7 @@ class SyncFlowTest : BaseTest() {
cleanLocalDatabase()
}

@Ignore("Flaky test, will be addressed in issue #ANDROAPP-6155")
@Ignore("Flaky test, will be addressed in issue ANDROAPP-6465")
@Test
fun shouldSuccessfullySyncSavedEvent() {
mockWebServerRobot.addResponse(GET, "/api/system/ping", API_PING_RESPONSE_OK)
Expand All @@ -124,8 +124,8 @@ class SyncFlowTest : BaseTest() {
cleanLocalDatabase()
}

@Ignore("Flaky test, will be addressed in issue ANDROAPP-6465")
@Test
@Ignore("Flaky test, will be addressed in issue #ANDROAPP-6139")
fun shouldShowErrorWhenSyncEventFails() {
mockWebServerRobot.addResponse(GET, "/api/system/ping", API_PING_RESPONSE_OK)

Expand All @@ -151,6 +151,7 @@ class SyncFlowTest : BaseTest() {
cleanLocalDatabase()
}

@Ignore("Flaky test, will be addressed in issue ANDROAPP-6465")
@Test
fun shouldSuccessfullySyncSavedDataSet() {
mockWebServerRobot.addResponse(GET, "/api/system/ping", API_PING_RESPONSE_OK)
Expand Down Expand Up @@ -188,7 +189,7 @@ class SyncFlowTest : BaseTest() {
cleanLocalDatabase()
}

@Ignore("Flaky test, will be addressed in next release")
@Ignore("Flaky test, will be addressed in issue ANDROAPP-6465")
@Test
fun shouldShowErrorWhenSyncDataSetFails() {
prepareFacilityDataSetIntentAndLaunchActivity(ruleDataSet)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ class LoginRobot(val composeTestRule: ComposeTestRule) : BaseRobot() {
onView(withId(R.id.server_url_edit)).perform(clearText())
}

fun selectUsernameField() {
onView(withId(R.id.user_name_edit)).perform(click())
}

fun typeUsername(username: String) {
onView(withId(R.id.user_name_edit)).perform(TypeTextAction(username))
pressImeActionButton()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class LoginTest : BaseTest() {
D2Manager.removeCredentials()
}

@Ignore("Flaky test, will be looked up in ANDROAPP-6455")
@Test
fun loginFlow() {
mockWebServerRobot.addResponse(GET, API_ME_PATH, API_ME_RESPONSE_OK)
Expand Down Expand Up @@ -75,6 +74,7 @@ class LoginTest : BaseTest() {

// Test case - [ANDROAPP-4121](https://dhis2.atlassian.net/browse/ANDROAPP-4121)
mockWebServerRobot.addResponse(GET, API_ME_PATH, API_ME_UNAUTHORIZE, HTTP_UNAUTHORIZE)
selectUsernameField()
typeUsername(USERNAME)
typePassword(PASSWORD)
clickLoginButton()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class OrgUnitSelectorRobot(private val composeTestRule: ComposeTestRule) : BaseR
composeTestRule.onNodeWithTag("ORG_TREE_ITEM_$orgUnitName")
.performScrollTo()
.performClick()
composeTestRule.waitForIdle()
composeTestRule.onNodeWithText("Done").assertIsDisplayed()
composeTestRule.onNodeWithText("Done").performClick()
}
Expand Down

0 comments on commit 7d58872

Please sign in to comment.