Skip to content

Commit db1bf2a

Browse files
committed
tests: make sure clicking on the settings button opens the settings sheet
1 parent 285b866 commit db1bf2a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package org.kabiri.android.usbterminal
22

33
import androidx.test.espresso.Espresso.onView
44
import androidx.test.espresso.assertion.ViewAssertions.matches
5+
import androidx.test.espresso.action.ViewActions.click
56
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
67
import androidx.test.espresso.matcher.ViewMatchers.withId
78
import androidx.test.ext.junit.rules.activityScenarioRule
@@ -22,5 +23,18 @@ internal class MainActivityAndroidTest {
2223
onView(withId(R.id.tvOutput)).check(matches(isDisplayed()))
2324
onView(withId(R.id.btEnter)).check(matches(isDisplayed()))
2425
onView(withId(R.id.etInput)).check(matches(isDisplayed()))
26+
27+
// Check menu items are displayed
28+
onView(withId(R.id.actionSettings)).check(matches(isDisplayed()))
29+
onView(withId(R.id.actionConnect)).check(matches(isDisplayed()))
30+
onView(withId(R.id.actionDisconnect)).check(matches(isDisplayed()))
31+
}
32+
33+
@Test
34+
fun clickingSettingsOpensSettingsBottomSheet() {
35+
// Click the Settings menu item
36+
onView(withId(R.id.actionSettings)).perform(click())
37+
// Assert the bottom sheet content is displayed
38+
onView(withId(R.id.composeViewSettingContent)).check(matches(isDisplayed()))
2539
}
2640
}

0 commit comments

Comments
 (0)