Skip to content

Commit

Permalink
test: clarify on the starting state
Browse files Browse the repository at this point in the history
Best to explicitly delete old sleeps than just hoping we won't have any.
  • Loading branch information
vmiklos committed Oct 26, 2024
1 parent 5cf023b commit 329bce2
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,24 @@ class MainActivityUITest {
var activityScenarioRule = ActivityScenarioRule(MainActivity::class.java)

@Test
fun testCreate() {
fun testCreateAndRead() {
// Given no sleeps:
val instrumentation = InstrumentationRegistry.getInstrumentation()
val device = UiDevice.getInstance(instrumentation)
val pkg = instrumentation.processName
val timeout: Long = 5000
device.pressMenu()
val deleteAllSleep = device.wait(Until.findObject(By.text("Delete All Sleep")), timeout)
deleteAllSleep.click()
val yesButton = device.wait(Until.findObject(By.text("YES")), timeout)
yesButton.click()

// When creating one:
val startStop = device.wait(Until.findObject(By.res(pkg, "start_stop")), timeout)
startStop.click()
startStop.click()

// Then make sure we have one sleep:
val sleeps = device.wait(
Until.findObject(By.res(pkg, "fragment_stats_sleeps").text("1")),
timeout
Expand Down

0 comments on commit 329bce2

Please sign in to comment.