Skip to content

Commit b72d0fe

Browse files
committed
Fix settings dialog dismissed test on non-portrait phones
Change-Id: I15ed475915fdef198029db2713b6f619da374cc7
1 parent 9b6695d commit b72d0fe

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

app/src/androidTest/java/com/google/samples/apps/nowinandroid/ui/NavigationTest.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ package com.google.samples.apps.nowinandroid.ui
1919
import androidx.compose.ui.test.assertCountEquals
2020
import androidx.compose.ui.test.assertIsOn
2121
import androidx.compose.ui.test.assertIsSelected
22+
import androidx.compose.ui.test.hasAnyAncestor
23+
import androidx.compose.ui.test.hasTestTag
24+
import androidx.compose.ui.test.hasText
2225
import androidx.compose.ui.test.junit4.createAndroidComposeRule
2326
import androidx.compose.ui.test.onAllNodesWithText
24-
import androidx.compose.ui.test.onLast
2527
import androidx.compose.ui.test.onNodeWithContentDescription
2628
import androidx.compose.ui.test.onNodeWithText
2729
import androidx.compose.ui.test.performClick
@@ -213,7 +215,12 @@ class NavigationTest {
213215
onNodeWithText(ok).performClick()
214216

215217
// Check that the saved screen is still visible and selected.
216-
onAllNodesWithText(saved).onLast().assertIsSelected()
218+
onNode(
219+
hasText(saved) and
220+
hasAnyAncestor(
221+
hasTestTag("NiaBottomBar") or hasTestTag("NiaNavRail"),
222+
),
223+
).assertIsSelected()
217224
}
218225
}
219226

0 commit comments

Comments
 (0)