Skip to content

Commit

Permalink
Fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth Agarwal committed Jun 14, 2024
1 parent 32d259d commit 26e0ed5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package org.dhis2.usescases.teidashboard.dialogs.scheduling

import androidx.compose.ui.test.ExperimentalTestApi
import androidx.compose.ui.test.hasTestTag
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.compose.ui.test.onAllNodesWithTag
import androidx.compose.ui.test.onFirst
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
Expand Down Expand Up @@ -110,6 +114,7 @@ class SchedulingDialogUiTest {
composeTestRule.onNodeWithText("Done").assertExists()
}

@OptIn(ExperimentalTestApi::class)
@Test
fun selectProgramStage() {
val programStages = listOf(
Expand All @@ -126,7 +131,8 @@ class SchedulingDialogUiTest {
}
}

composeTestRule.onNodeWithText("Program stage").performClick()
composeTestRule.onAllNodesWithTag("INPUT_DROPDOWN").onFirst().performClick()
composeTestRule.waitUntilExactlyOneExists(hasTestTag("INPUT_DROPDOWN_MENU_ITEM_1"))
composeTestRule.onNodeWithTag("INPUT_DROPDOWN_MENU_ITEM_1").performClick()

verify(viewModel).updateStage(programStages[1])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,13 @@ class CellTableTest {
composeTestRule.waitForIdle()
clickOnAccept()
composeTestRule.waitForIdle()
Espresso.pressBack()
assertCellSelected(firstId, 1, 0)
clickOnCell(firstId, 1, 0)
assertInputComponentInfo(
expectedMainLabel = "Text 2",
expectedSecondaryLabels =
fakeModel.find { it.id == firstId }?.tableHeaderModel?.rows
?.joinToString(separator = ",") { it.cells[0 % it.cells.size].value } ?: ""
?.joinToString(separator = ",") { it.cells[0].value } ?: ""
)
}
}
Expand Down

0 comments on commit 26e0ed5

Please sign in to comment.