Pre-review version

This commit is contained in:
Daniele 2021-09-05 20:52:07 +02:00
parent 25848438b1
commit ef9944e9ca

View File

@ -1,9 +1,9 @@
package it.danieleverducci.subitobeers.ui
import androidx.test.espresso.Espresso
import androidx.test.espresso.action.ViewActions
import androidx.test.espresso.assertion.ViewAssertions
import androidx.test.espresso.matcher.ViewMatchers
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
@ -24,15 +24,17 @@ class BeersFragmentTest {
@Test
fun filter_BeersFragmentTest() {
// Filters for the current date as brewed start date (we expect 0 results)
// Click menu item
Espresso.onView(ViewMatchers.withId(R.id.action_filter)).perform(ViewActions.click())
onView(withId(R.id.action_filter)).perform(click())
// Click filter button
Espresso.onView(ViewMatchers.withId(R.id.list_filter_since_bt)).perform(ViewActions.click())
onView(withId(R.id.list_filter_since_bt)).perform(click())
// Click ok on datepicker
Espresso.onView(ViewMatchers.withText("OK")).perform(ViewActions.click())
onView(withText("OK")).perform(click())
Thread.sleep(500)
// Check the list empty message is correctly displayed
Espresso.onView(ViewMatchers.withId(R.id.list_empty))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
onView(withId(R.id.list_empty))
.check(matches(isDisplayed()))
}
}