From ef9944e9ca6c7af9becfc17bcebe6296ab96ed2e Mon Sep 17 00:00:00 2001 From: Daniele Date: Sun, 5 Sep 2021 20:52:07 +0200 Subject: [PATCH] Pre-review version --- .../subitobeers/ui/BeersFragmentTest.kt | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/app/src/androidTest/java/it/danieleverducci/subitobeers/ui/BeersFragmentTest.kt b/app/src/androidTest/java/it/danieleverducci/subitobeers/ui/BeersFragmentTest.kt index a2e9e80..8ddcaa7 100644 --- a/app/src/androidTest/java/it/danieleverducci/subitobeers/ui/BeersFragmentTest.kt +++ b/app/src/androidTest/java/it/danieleverducci/subitobeers/ui/BeersFragmentTest.kt @@ -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())) } + } \ No newline at end of file