1717package com.instructure.horizon.ui.features.dashboard.widget.course.list
1818
1919import androidx.compose.ui.test.assertIsDisplayed
20+ import androidx.compose.ui.test.hasText
2021import androidx.compose.ui.test.junit4.createComposeRule
22+ import androidx.compose.ui.test.onChild
23+ import androidx.compose.ui.test.onNodeWithTag
2124import androidx.compose.ui.test.onNodeWithText
2225import androidx.compose.ui.test.performClick
23- import androidx.compose.ui.test.performScrollTo
26+ import androidx.compose.ui.test.performScrollToNode
2427import androidx.navigation.compose.rememberNavController
2528import androidx.test.ext.junit.runners.AndroidJUnit4
2629import com.instructure.horizon.features.dashboard.widget.course.list.DashboardCourseListCourseState
@@ -213,6 +216,9 @@ class DashboardCourseListScreenUiTest {
213216 DashboardCourseListScreen (state, navController)
214217 }
215218
219+ composeTestRule.onNodeWithTag(" collapsableContent" )
220+ .onChild()
221+ .performScrollToNode(hasText(" Show more" ))
216222 composeTestRule.onNodeWithText(" Show more" )
217223 .assertIsDisplayed()
218224 }
@@ -272,7 +278,11 @@ class DashboardCourseListScreenUiTest {
272278 DashboardCourseListScreen (state, navController)
273279 }
274280
281+ composeTestRule.onNodeWithTag(" collapsableContent" )
282+ .onChild()
283+ .performScrollToNode(hasText(" Show more" ))
275284 composeTestRule.onNodeWithText(" Show more" )
285+ .assertIsDisplayed()
276286 .performClick()
277287
278288 assert (showMoreCalled) { " Show more callback should be called when button is clicked" }
@@ -293,12 +303,21 @@ class DashboardCourseListScreenUiTest {
293303 DashboardCourseListScreen (state, navController)
294304 }
295305
306+ composeTestRule.onNodeWithTag(" collapsableContent" )
307+ .onChild()
308+ .performScrollToNode(hasText(" Course 1" ))
296309 composeTestRule.onNodeWithText(" Course 1" )
297310 .assertIsDisplayed()
298311
312+ composeTestRule.onNodeWithTag(" collapsableContent" )
313+ .onChild()
314+ .performScrollToNode(hasText(" Course 2" ))
299315 composeTestRule.onNodeWithText(" Course 2" )
300316 .assertIsDisplayed()
301317
318+ composeTestRule.onNodeWithTag(" collapsableContent" )
319+ .onChild()
320+ .performScrollToNode(hasText(" Course 3" ))
302321 composeTestRule.onNodeWithText(" Course 3" )
303322 .assertIsDisplayed()
304323
@@ -324,11 +343,16 @@ class DashboardCourseListScreenUiTest {
324343 DashboardCourseListScreen (state, navController)
325344 }
326345
346+ composeTestRule.onNodeWithTag(" collapsableContent" )
347+ .onChild()
348+ .performScrollToNode(hasText(" Course 1" ))
327349 composeTestRule.onNodeWithText(" Course 1" )
328350 .assertIsDisplayed()
329351
352+ composeTestRule.onNodeWithTag(" collapsableContent" )
353+ .onChild()
354+ .performScrollToNode(hasText(" Course 6" ))
330355 composeTestRule.onNodeWithText(" Course 6" )
331- .performScrollTo()
332356 .assertIsDisplayed()
333357
334358 composeTestRule.onNodeWithText(" Course 7" )
@@ -353,8 +377,10 @@ class DashboardCourseListScreenUiTest {
353377 composeTestRule.onNodeWithText(" Course 1" )
354378 .assertIsDisplayed()
355379
380+ composeTestRule.onNodeWithTag(" collapsableContent" )
381+ .onChild()
382+ .performScrollToNode(hasText(" Course 5" ))
356383 composeTestRule.onNodeWithText(" Course 5" )
357- .performScrollTo()
358384 .assertIsDisplayed()
359385
360386 composeTestRule.onNodeWithText(" Show more" )
0 commit comments