Skip to content

Commit e02a66a

Browse files
committed
test(ui): measure home geometry after its fragment has resumed
1 parent 5f48053 commit e02a66a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎app/src/androidTest/java/com/system/location/service/UiDesignTest.kt‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ class UiDesignTest {
3535
permissions()
3636
ActivityScenario.launch(MainActivity::class.java).use { scenario ->
3737
fun homeGeometry(): List<Int> {
38+
compose.waitUntil(5_000) {
39+
var ready = false
40+
scenario.onActivity {
41+
val host = it.supportFragmentManager.findFragmentById(R.id.nav_host_fragment_content_main)!!
42+
ready = it.currentDestinationId == R.id.nav_home &&
43+
host.childFragmentManager.primaryNavigationFragment?.lifecycle?.currentState == androidx.lifecycle.Lifecycle.State.RESUMED
44+
}
45+
ready
46+
}
3847
compose.onNodeWithTag("home-search-controls").assertIsDisplayed()
3948
compose.onNodeWithText("开始模拟").assertIsDisplayed()
4049
val search = compose.onNodeWithTag("home-search-controls").fetchSemanticsNode().boundsInRoot

0 commit comments

Comments
 (0)