diff --git a/benchmarks/src/main/java/com/google/samples/apps/nowinandroid/foryou/ForYouActions.kt b/benchmarks/src/main/java/com/google/samples/apps/nowinandroid/foryou/ForYouActions.kt index 96ee040cc..bba1218c1 100644 --- a/benchmarks/src/main/java/com/google/samples/apps/nowinandroid/foryou/ForYouActions.kt +++ b/benchmarks/src/main/java/com/google/samples/apps/nowinandroid/foryou/ForYouActions.kt @@ -27,8 +27,9 @@ fun MacrobenchmarkScope.forYouWaitForContent() { device.wait(Until.gone(By.res("forYou:loadingWheel")), 5_000) // Sometimes, the loading wheel is gone, but the content is not loaded yet // So we'll wait here for authors to be sure - val obj = device.findObject(By.res("forYou:authors")) - obj.wait(untilHasChildren(), 30_000) + val obj = device.findObject(By.res("forYou:topicSelection")) + // Timeout here is quite big, because sometimes data loading takes a long time! + obj.wait(untilHasChildren(), 60_000) } fun MacrobenchmarkScope.forYouScrollFeedDownUp() { diff --git a/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt b/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt index 1420a7e47..8fe21dbab 100644 --- a/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt +++ b/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt @@ -282,7 +282,9 @@ private fun TopicSelection( modifier: Modifier = Modifier ) = trace("TopicSelection") { val lazyGridState = rememberLazyGridState() - TrackScrollJank(scrollableState = lazyGridState, stateName = "forYou:TopicSelection") + val topicSelectionTestTag = "forYou:topicSelection" + + TrackScrollJank(scrollableState = lazyGridState, stateName = topicSelectionTestTag) LazyHorizontalGrid( state = lazyGridState, @@ -302,6 +304,7 @@ private fun TopicSelection( // The maximum of these two bounds is therefore a valid upper bound in all cases. .heightIn(max = max(240.dp, with(LocalDensity.current) { 240.sp.toDp() })) .fillMaxWidth() + .testTag(topicSelectionTestTag) ) { items(onboardingUiState.topics) { SingleTopicButton(