Skip to content

Commit 1109bba

Browse files
committed
tests: separate checking action menu items in another method
1 parent 895eeed commit 1109bba

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

app/src/androidTest/java/org/kabiri/android/usbterminal/MainActivityAndroidTest.kt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,24 @@ internal class MainActivityAndroidTest {
3535

3636
@Test
3737
fun checkUiViewsAreDisplayed() {
38+
// arrange
39+
// act
40+
// assert
3841
onView(withId(R.id.tvOutput)).check(matches(isDisplayed()))
3942
onView(withId(R.id.btEnter)).check(matches(isDisplayed()))
4043
onView(withId(R.id.etInput)).check(matches(isDisplayed()))
44+
}
4145

46+
@Test
47+
fun checkActionMenuItemsAreDisplayed() {
48+
// arrange
49+
// act
4250
// Ensure action items are accessible, either in the toolbar or via overflow
4351
ensureMenuIsAccessible(R.id.actionSettings)
4452
ensureMenuIsAccessible(R.id.actionConnect)
4553
ensureMenuIsAccessible(R.id.actionDisconnect)
4654

55+
// assert
4756
// Check menu items are displayed
4857
onView(withId(R.id.actionSettings)).check(matches(isDisplayed()))
4958
onView(withId(R.id.actionConnect)).check(matches(isDisplayed()))
@@ -52,11 +61,14 @@ internal class MainActivityAndroidTest {
5261

5362
@Test
5463
fun clickingSettingsOpensSettingsBottomSheet() {
64+
// arrange
5565
// Ensure the action item is accisble, either in the toolbar or via overflow
5666
ensureMenuIsAccessible(R.id.actionSettings)
57-
// Click the Settings menu item
67+
68+
// act
5869
onView(withId(R.id.actionSettings)).perform(click())
59-
// Assert the bottom sheet content is displayed
70+
71+
// assert
6072
onView(withId(R.id.composeViewSettingContent)).check(matches(isDisplayed()))
6173
}
6274
}

0 commit comments

Comments
 (0)