Skip to content

Commit

Permalink
Update NavigationTest.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonMarquis authored Jul 27, 2023
1 parent bf5fdb4 commit 0a1f333
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ import androidx.compose.ui.test.junit4.AndroidComposeTestRule
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.compose.ui.test.onAllNodesWithText
import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performScrollToNode
import androidx.test.espresso.Espresso
import androidx.test.espresso.NoActivityResumedException
import com.google.samples.apps.nowinandroid.MainActivity
Expand Down Expand Up @@ -262,10 +264,13 @@ class NavigationTest {

@Test
fun navigationBar_multipleBackStackInterests() = runTest {
val topics = datasource.getTopics(ids = null)
composeTestRule.apply {
onNodeWithText(interests).performClick()
onNodeWithText(topics.random().name).performClick()

// Select a random topic
val topic = datasource.getTopics().random().name
onNodeWithTag("interests:topics").performScrollToNode(hasText(topic))
onNodeWithText(topic).performClick()

// Switch tab
onNodeWithText(forYou).performClick()
Expand All @@ -274,7 +279,7 @@ class NavigationTest {
onNodeWithText(interests).performClick()

// Verify we're not in the list of interests
onNodeWithText(topics.random().name).assertDoesNotExist()
onNodeWithTag("interests:topics").assertDoesNotExist()
}
}
}

0 comments on commit 0a1f333

Please sign in to comment.