Helper function to get topics

Change-Id: If336c4b9dac82382daf96284533a277cc58984fa
pull/1518/head
Jonathan Koren 1 year ago
parent eeb171bec3
commit 4e12d797b6

@ -89,6 +89,11 @@ class InterestsListDetailScreenTest {
hiltRule.inject() hiltRule.inject()
} }
/** Convenience function for getting all topics during tests, */
private fun getTopics(): List<Topic> = runBlocking {
topicsRepository.getTopics().first()
}
@Test @Test
fun expandedWidth_initialState_showsTwoPanesWithPlaceholder() { fun expandedWidth_initialState_showsTwoPanesWithPlaceholder() {
composeTestRule.apply { composeTestRule.apply {
@ -138,9 +143,7 @@ class InterestsListDetailScreenTest {
} }
} }
val firstTopic = runBlocking { val firstTopic = getTopics().first()
topicsRepository.getTopics().first().first()
}
onNodeWithText(firstTopic.name).performClick() onNodeWithText(firstTopic.name).performClick()
onNodeWithTag(listPaneTag).assertIsDisplayed() onNodeWithTag(listPaneTag).assertIsDisplayed()
@ -162,9 +165,7 @@ class InterestsListDetailScreenTest {
} }
} }
val firstTopic = runBlocking { val firstTopic = getTopics().first()
topicsRepository.getTopics().first().first()
}
onNodeWithText(firstTopic.name).performClick() onNodeWithText(firstTopic.name).performClick()
onNodeWithTag(listPaneTag).assertIsNotDisplayed() onNodeWithTag(listPaneTag).assertIsNotDisplayed()
@ -192,9 +193,7 @@ class InterestsListDetailScreenTest {
} }
} }
val firstTopic = runBlocking { val firstTopic = getTopics().first()
topicsRepository.getTopics().first().first()
}
onNodeWithText(firstTopic.name).performClick() onNodeWithText(firstTopic.name).performClick()
Espresso.pressBack() Espresso.pressBack()
@ -216,9 +215,7 @@ class InterestsListDetailScreenTest {
} }
} }
val firstTopic = runBlocking { val firstTopic = getTopics().first()
topicsRepository.getTopics().first().first()
}
onNodeWithText(firstTopic.name).performClick() onNodeWithText(firstTopic.name).performClick()
Espresso.pressBack() Espresso.pressBack()

Loading…
Cancel
Save