This commit is contained in:
Rafal Wisniewski
2026-04-08 13:31:38 +02:00
parent 767d54e8f6
commit 3847e311a5
11 changed files with 308 additions and 85 deletions

View File

@@ -39,6 +39,7 @@ dependencies {
implementation(libs.androidx.espresso.core)
implementation(libs.androidx.uiautomator)
implementation(libs.androidx.benchmark.macro.junit4)
implementation(libs.androidx.ui.test.junit4)
}
androidComponents {

View File

@@ -3,6 +3,7 @@ package cc.n0th1ng.baselineprofile
import android.R.attr.contentDescription
import androidx.benchmark.macro.MacrobenchmarkScope
import androidx.benchmark.macro.junit4.BaselineProfileRule
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import androidx.test.platform.app.InstrumentationRegistry
@@ -16,7 +17,6 @@ import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
@LargeTest
class BaselineProfileGenerator {
@get:Rule
val rule = BaselineProfileRule()
@@ -29,12 +29,8 @@ class BaselineProfileGenerator {
pressHome()
startActivityAndWait()
// Give Compose time to render
Thread.sleep(500)
val listNav = device.wait(Until.findObject(By.desc("listExpenseScreen")), 10000)
listNav?.click() ?: throw RuntimeException("listExpenseScreen not found or not clickable")
device.waitForIdle()
device.wait(Until.hasObject(By.desc("list screen")), 10_000)
}
}
}
}