From 81b86e9d043cb67d229f7741a1f4b9000cc69b56 Mon Sep 17 00:00:00 2001 From: mlykotom Date: Tue, 6 Dec 2022 11:22:07 +0100 Subject: [PATCH] Fix checking for selected topic Change-Id: If86541613daf44e552df4309243309f80086230a --- .../samples/apps/nowinandroid/foryou/ForYouActions.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 ef037e355..25009223e 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 @@ -45,11 +45,14 @@ fun MacrobenchmarkScope.forYouSelectTopics(recheckTopicsIfChecked: Boolean = fal // Select some topics to show some feed content repeat(3) { index -> - val topic = topics.children[index % topics.childCount] + // Selecting topics that are in the first column + val topic = topics.children[(2 * index) % topics.childCount] + // Find the checkable element to figure out whether it's checked or not + val topicCheckIcon = topic.findObject(By.checkable(true)) when { // Topic wasn't checked, so just do that - !topic.isChecked -> { + !topicCheckIcon.isChecked -> { topic.click() device.waitForIdle() }