TP-74933 | Dismiss NUX while running macrobenchmark tests (#11905)

This commit is contained in:
nikhil kumar
2024-07-25 21:24:15 +05:30
committed by GitHub
parent c1f1a39f4f
commit 2ce38abbf4
4 changed files with 25 additions and 6 deletions

View File

@@ -7,6 +7,9 @@
package com.naviapp.benchmark.home
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.benchmark.macro.BaselineProfileMode.Require
import androidx.benchmark.macro.CompilationMode
import androidx.benchmark.macro.FrameTimingMetric
import androidx.benchmark.macro.StartupMode
@@ -25,9 +28,14 @@ import org.junit.runner.RunWith
class HomePageScrollBenchmark {
@get:Rule val benchmarkRule = MacrobenchmarkRule()
@Test fun scrollHomeCompilationNone() = scrollHomePage(CompilationMode.None())
@RequiresApi(Build.VERSION_CODES.N)
@Test
fun scrollHomeCompilationNone() = scrollHomePage(CompilationMode.None())
@Test fun scrollHomeCompilationBaselineProfile() = scrollHomePage(CompilationMode.Partial())
@RequiresApi(Build.VERSION_CODES.N)
@Test
fun scrollHomeCompilationBaselineProfile() =
scrollHomePage(CompilationMode.Partial(baselineProfileMode = Require))
@Test fun scrollHomeCompilationFull() = scrollHomePage(CompilationMode.Full())

View File

@@ -7,6 +7,8 @@
package com.naviapp.benchmark.startup
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.benchmark.macro.BaselineProfileMode.Require
import androidx.benchmark.macro.CompilationMode
import androidx.benchmark.macro.StartupMode
@@ -25,8 +27,11 @@ import org.junit.runner.RunWith
class StartupBenchmark {
@get:Rule val benchmarkRule = MacrobenchmarkRule()
@Test fun startupWithoutPreCompilation() = startup(CompilationMode.None())
@RequiresApi(Build.VERSION_CODES.N)
@Test
fun startupWithoutPreCompilation() = startup(CompilationMode.None())
@RequiresApi(Build.VERSION_CODES.N)
@Test
fun startupPrecompiledWithBaselineProfile() =
startup(CompilationMode.Partial(baselineProfileMode = Require))

View File

@@ -16,17 +16,23 @@ import java.util.concurrent.TimeUnit
fun MacrobenchmarkScope.waitForHomePage() {
val okButton = By.text("OK")
val dialog = device.wait(Until.findObject(okButton), TimeUnit.SECONDS.toMillis(20))
val dialog = device.wait(Until.findObject(okButton), TimeUnit.SECONDS.toMillis(5))
dialog?.let {
it.click()
device.wait(Until.gone(okButton), TimeUnit.SECONDS.toMillis(5))
}
// Sometime location popup coming two times so adding one more check
val dialog2 = device.wait(Until.findObject(okButton), TimeUnit.SECONDS.toMillis(20))
val dialog2 = device.wait(Until.findObject(okButton), TimeUnit.SECONDS.toMillis(5))
dialog2?.let {
it.click()
device.wait(Until.gone(okButton), TimeUnit.SECONDS.toMillis(5))
}
val nux =
device.wait(
Until.findObject(By.text("Make your first payment")),
TimeUnit.SECONDS.toMillis(10)
)
nux?.let { device.pressBack() }
device.wait(Until.hasObject(By.clazz(HOME_PAGE_CLASS_NAME)), TimeUnit.SECONDS.toMillis(10))
}