Skip to content

Commit

Permalink
fix: [ANDROAPP-6315] fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
xavimolloy committed Jul 12, 2024
1 parent 400b850 commit 0cc8d86
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class SyncFlowTest : BaseTest() {
openNextSearchParameter("Last name")
typeOnNextSearchTextParameter(teiLastName)
clickOnSearch()
clickOnTEI(teiName, teiLastName)
clickOnTEI(teiName, composeTestRule)
}

teiDashboardRobot(composeTestRule) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ class ProgramEventsRobot(val composeTestRule: ComposeContentTestRule) : BaseRobo
@OptIn(ExperimentalTestApi::class)
fun checkEventIsComplete(eventDate: String) {
composeTestRule.waitUntilAtLeastOneExists(hasText("Event completed", true), 2000)
composeTestRule.onNodeWithText(eventDate).assertIsDisplayed()
composeTestRule.onNodeWithText("Event completed").assertIsDisplayed()
composeTestRule.onNodeWithText(eventDate,true).assertIsDisplayed()
composeTestRule.onNodeWithText("Event completed",true).assertIsDisplayed()
}

fun checkEventWasDeleted(eventDate: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ class SearchTETest : BaseTest() {
openNextSearchParameter("Last name")
typeOnNextSearchTextParameter(teiLastName)
clickOnSearch()
clickOnTEI(teiName, teiLastName)
clickOnTEI(teiName, composeTestRule)
}

teiDashboardRobot(composeTestRule) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,10 @@ fun searchTeiRobot(

class SearchTeiRobot(val composeTestRule: ComposeTestRule) : BaseRobot() {

fun clickOnTEI(teiName: String, teiLastName: String) {
waitForView(
allOf(
withId(R.id.scrollView),
hasDescendant(withText(teiName)),
hasDescendant(withText(teiLastName))
)
).perform(
scrollTo<SearchTEViewHolder>(
allOf(
hasDescendant(withText(teiName)),
hasDescendant(withText(teiLastName))
)
),
actionOnItem<SearchTEViewHolder>(
allOf(
hasDescendant(withText(teiName)),
hasDescendant(withText(teiLastName))
), click()
)
)
fun clickOnTEI(teiName: String, composeTestRule: ComposeTestRule) {
composeTestRule.waitForIdle()
composeTestRule.onNodeWithText("First name: $teiName", true).performClick()
composeTestRule.waitForIdle()
}

fun checkTEIsDelete(teiName: String, teiLastName: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class TeiDashboardTestNoComposable : BaseTest() {
prepareChildProgrammeIntentAndLaunchActivity(ruleSearch)

searchTeiRobot(composeTestRule) {
clickOnTEI(teiName, teiLastName)
clickOnTEI(teiName, composeTestRule)
}

teiDashboardRobot(composeTestRule) {
Expand All @@ -54,7 +54,7 @@ class TeiDashboardTestNoComposable : BaseTest() {
openNextSearchParameter("Last name")
typeOnNextSearchTextParameter(relationshipLastName)
clickOnSearch()
clickOnTEI(relationshipName, relationshipLastName)
clickOnTEI(relationshipName, composeTestRule)
}

relationshipRobot {
Expand All @@ -77,7 +77,7 @@ class TeiDashboardTestNoComposable : BaseTest() {
openNextSearchParameter("Last name")
typeOnNextSearchTextParameter(teiLastName)
clickOnSearch()
clickOnTEI(teiName, teiLastName)
clickOnTEI(teiName, composeTestRule)
}

teiDashboardRobot(composeTestRule) {
Expand Down Expand Up @@ -106,7 +106,7 @@ class TeiDashboardTestNoComposable : BaseTest() {
openNextSearchParameter("Last name")
typeOnNextSearchTextParameter(teiLastName)
clickOnSearch()
clickOnTEI(teiName, teiLastName)
clickOnTEI(teiName, composeTestRule)
}

teiDashboardRobot(composeTestRule) {
Expand Down

0 comments on commit 0cc8d86

Please sign in to comment.