From 0018144827c9f1bfe83918044537ed091a18f71c Mon Sep 17 00:00:00 2001 From: mlykotom Date: Tue, 6 Dec 2022 11:21:05 +0100 Subject: [PATCH] LoadingWheel testTag for every loading wheel Change-Id: I7728e1717925abdfb607e93f3d48226910d42c0d --- .../google/samples/apps/nowinandroid/foryou/ForYouActions.kt | 2 +- .../nowinandroid/core/designsystem/component/LoadingWheel.kt | 2 ++ .../samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt | 3 +-- 3 files changed, 4 insertions(+), 3 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 8d66efc9c..ef037e355 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 @@ -24,7 +24,7 @@ import com.google.samples.apps.nowinandroid.flingElementDownUp fun MacrobenchmarkScope.forYouWaitForContent() { // Wait until content is loaded by checking if topics are loaded - device.wait(Until.gone(By.res("forYou:loadingWheel")), 5_000) + device.wait(Until.gone(By.res("loadingWheel")), 5_000) // Sometimes, the loading wheel is gone, but the content is not loaded yet // So we'll wait here for topics to be sure val obj = device.findObject(By.res("forYou:topicSelection")) diff --git a/core/designsystem/src/main/java/com/google/samples/apps/nowinandroid/core/designsystem/component/LoadingWheel.kt b/core/designsystem/src/main/java/com/google/samples/apps/nowinandroid/core/designsystem/component/LoadingWheel.kt index c32637b69..836558021 100644 --- a/core/designsystem/src/main/java/com/google/samples/apps/nowinandroid/core/designsystem/component/LoadingWheel.kt +++ b/core/designsystem/src/main/java/com/google/samples/apps/nowinandroid/core/designsystem/component/LoadingWheel.kt @@ -43,6 +43,7 @@ import androidx.compose.ui.graphics.StrokeCap import androidx.compose.ui.graphics.drawscope.rotate import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.platform.LocalInspectionMode +import androidx.compose.ui.platform.testTag import androidx.compose.ui.semantics.contentDescription import androidx.compose.ui.semantics.semantics import androidx.compose.ui.unit.dp @@ -109,6 +110,7 @@ fun NiaLoadingWheel( .padding(8.dp) .graphicsLayer { rotationZ = rotationAnim } .semantics { contentDescription = contentDesc } + .testTag("loadingWheel"), ) { repeat(NUM_OF_LINES) { index -> rotate(degrees = index * 30f) { 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 8fe21dbab..caf3dad0f 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 @@ -204,8 +204,7 @@ internal fun ForYouScreen( ) { NiaOverlayLoadingWheel( modifier = Modifier - .align(Alignment.Center) - .testTag("forYou:loadingWheel"), + .align(Alignment.Center), contentDesc = loadingContentDescription ) }