NTP-70420 | Sohan | Macro-benchmarking fix (#16571)
This commit is contained in:
committed by
GitHub
parent
9887575156
commit
7304affbe3
@@ -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))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user