Fix selecting topics

Change-Id: I958ad68ead1dffce0916dd5d6b7bff275b201fc7
pull/545/head
mlykotom 2 years ago
parent 6b48b355cc
commit 3d524d95cc

@ -44,11 +44,20 @@ fun MacrobenchmarkScope.forYouSelectTopics(recheckTopicsIfChecked: Boolean = fal
topics.setGestureMargins(horizontalMargin, 0, horizontalMargin, 0)
// Select some topics to show some feed content
repeat(3) { index ->
var index = 0
var visited = 0
while (visited < 3) {
// Selecting some topics, which will populate items in the feed.
val topic = topics.children[index % topics.childCount]
// Find the checkable element to figure out whether it's checked or not
val topicCheckIcon = topic.findObject(By.checkable(true))
// Topic icon may not be visible if it's out of the screen boundaries
// If that's the case, let's try another index
if (topicCheckIcon == null) {
index++
continue
}
when {
// Topic wasn't checked, so just do that
@ -69,6 +78,9 @@ fun MacrobenchmarkScope.forYouSelectTopics(recheckTopicsIfChecked: Boolean = fal
// Topic is checked, but we don't recheck it
}
}
index++
visited++
}
}

Loading…
Cancel
Save