TP-74933 | Dismiss NUX while running macrobenchmark tests (#11905)
This commit is contained in:
2
.github/workflows/macrobenchmark.yml
vendored
2
.github/workflows/macrobenchmark.yml
vendored
@@ -58,7 +58,7 @@ jobs:
|
||||
--type instrumentation \
|
||||
--app ${{ github.workspace }}/android/app/build/outputs/apk_from_bundle/qaRelease/app-qa-release-universal.apk \
|
||||
--test ${{ github.workspace }}/android/benchmark/build/outputs/apk/qa/benchmark/benchmark-qa-benchmark.apk \
|
||||
--test-targets "class com.naviapp.benchmark.baselineprofile.HomePageScrollBaselineProfile, class com.naviapp.benchmark.startup.StartupBenchmark#startupPrecompiledWithBaselineProfile, class com.naviapp.benchmark.home.HomePageScrollBenchmark#scrollHomeCompilationBaselineProfile" \
|
||||
--test-targets "class com.naviapp.benchmark.baselineprofile.NaviBaselineProfile, class com.naviapp.benchmark.startup.StartupBenchmark#startupPrecompiledWithBaselineProfile, class com.naviapp.benchmark.home.HomePageScrollBenchmark#scrollHomeCompilationBaselineProfile" \
|
||||
--device model=akita,version=34,locale=en,orientation=portrait \
|
||||
--directories-to-pull /sdcard/Download \
|
||||
--results-bucket navi-android-super-app-benchmark-results-qa \
|
||||
|
||||
@@ -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())
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user