NTP-70420 | Sohan | Macro-benchmarking fix (#16571)

This commit is contained in:
Sohan Reddy Atukula
2025-06-13 15:35:33 +05:30
committed by GitHub
parent 9887575156
commit 7304affbe3
3 changed files with 36 additions and 3 deletions

View File

@@ -29,6 +29,8 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import com.navi.base.utils.orZero
import com.navi.uitron.model.UiTronResponse
@@ -45,7 +47,6 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun PopupRenderer(
popupState: PopupState,
@@ -96,7 +97,10 @@ fun PopupContainer(isVisible: Boolean, content: @Composable BoxScope.() -> Unit)
exit = fadeOut(tween(durationMillis = 600)),
) {
Box(
Modifier.fillMaxSize().background(scrimColor).clickable(enabled = false, onClick = {}),
Modifier.fillMaxSize()
.background(scrimColor)
.clickable(enabled = false, onClick = {})
.semantics { contentDescription = "popup_container" },
contentAlignment = Alignment.Center,
) {
content()
@@ -104,7 +108,6 @@ fun PopupContainer(isVisible: Boolean, content: @Composable BoxScope.() -> Unit)
}
}
@OptIn(ExperimentalFoundationApi::class)
@Composable
private fun PopupPager(
popupList: List<PopupData>,

View File

@@ -26,6 +26,8 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import com.navi.base.utils.orElse
import com.navi.base.utils.orZero
@@ -110,6 +112,7 @@ fun ScratchCardOverlayRenderer(
}
}
.background(Color.Black.copy(alpha = 0.9f))
.semantics { contentDescription = "scratch_card_container" }
) {
ScratchCardRendererV2(
modifier = Modifier.graphicsLayer { translationY = currentCardTranslateYState },

View File

@@ -15,9 +15,36 @@ import androidx.test.uiautomator.Until
import java.util.concurrent.TimeUnit
fun MacrobenchmarkScope.waitForHomePage() {
// Handle NUX popup if present
val nux =
device.wait(Until.findObject(By.desc("nux_left_cross_icon")), TimeUnit.SECONDS.toMillis(10))
nux?.let { device.pressBack() }
// Handle any home screen popup if present
val popupContainer =
device.wait(Until.findObject(By.desc("popup_container")), TimeUnit.SECONDS.toMillis(5))
if (popupContainer != null) {
val closeAllButton = device.findObject(By.desc("close_all_popups"))
if (closeAllButton != null) {
closeAllButton.click()
} else {
// If close all button is not found, just press back
device.pressBack()
}
}
// Handle scratch card if present
val scratchCard =
device.wait(
Until.findObject(By.desc("scratch_card_container")),
TimeUnit.SECONDS.toMillis(5),
)
if (scratchCard != null) {
// back to close scratch card
device.pressBack()
}
// Wait for home page to be visible
device.wait(Until.hasObject(By.clazz(HOME_PAGE_CLASS_NAME)), TimeUnit.SECONDS.toMillis(10))
}