diff --git a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaAssertions.kt b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaAssertions.kt index ddca4a33..d5ba870c 100644 --- a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaAssertions.kt +++ b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaAssertions.kt @@ -1,14 +1,14 @@ package com.adevinta.android.barista.assertion +import android.view.View import androidx.test.espresso.Espresso.onView import androidx.test.espresso.NoActivityResumedException import androidx.test.espresso.action.ViewActions -import androidx.test.espresso.matcher.ViewMatchers import androidx.test.espresso.matcher.ViewMatchers.isRoot -import android.view.View import com.adevinta.android.barista.internal.assertAnyView import com.adevinta.android.barista.internal.failurehandler.RethrowingFailureHandler import com.adevinta.android.barista.internal.matcher.BooleanMatcher +import com.adevinta.android.barista.internal.matcher.withCompatText import com.adevinta.android.barista.internal.util.resourceMatcher import org.hamcrest.Matcher import org.junit.Assert.fail @@ -42,7 +42,7 @@ object BaristaAssertions { */ @JvmStatic inline fun assertAny(text: String, assertionDescription: String? = null, noinline block: (T) -> Boolean) { - assertAny(ViewMatchers.withText(text), assertionDescription, block) + assertAny(withCompatText(text), assertionDescription, block) } /** diff --git a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaAssistiveTextAssertions.kt b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaAssistiveTextAssertions.kt index 9e00bdb6..9524a6b3 100644 --- a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaAssistiveTextAssertions.kt +++ b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaAssistiveTextAssertions.kt @@ -5,8 +5,8 @@ import androidx.annotation.IdRes import androidx.annotation.StringRes import androidx.test.espresso.matcher.ViewMatchers import androidx.test.platform.app.InstrumentationRegistry -import com.google.android.material.textfield.TextInputLayout import com.adevinta.android.barista.internal.assertAny +import com.google.android.material.textfield.TextInputLayout import org.hamcrest.Description import org.hamcrest.Matcher import org.hamcrest.TypeSafeMatcher diff --git a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaCheckedAssertions.kt b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaCheckedAssertions.kt index 7a08fba8..26db56dd 100644 --- a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaCheckedAssertions.kt +++ b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaCheckedAssertions.kt @@ -1,8 +1,8 @@ package com.adevinta.android.barista.assertion import androidx.test.espresso.matcher.ViewMatchers.isChecked -import androidx.test.espresso.matcher.ViewMatchers.withText import com.adevinta.android.barista.internal.assertAny +import com.adevinta.android.barista.internal.matcher.withCompatText import com.adevinta.android.barista.internal.util.resourceMatcher import org.hamcrest.Matchers.not @@ -15,7 +15,7 @@ object BaristaCheckedAssertions { @JvmStatic fun assertChecked(text: String) { - withText(text).assertAny(isChecked()) + withCompatText(text).assertAny(isChecked()) } @JvmStatic @@ -25,6 +25,6 @@ object BaristaCheckedAssertions { @JvmStatic fun assertUnchecked(text: String) { - withText(text).assertAny(not(isChecked())) + withCompatText(text).assertAny(not(isChecked())) } } \ No newline at end of file diff --git a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaChipAssertions.kt b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaChipAssertions.kt index ca946062..79494fa7 100644 --- a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaChipAssertions.kt +++ b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaChipAssertions.kt @@ -2,8 +2,8 @@ package com.adevinta.android.barista.assertion import android.view.View import androidx.annotation.IdRes -import com.google.android.material.chip.ChipGroup import com.adevinta.android.barista.assertion.BaristaAssertions.assertAny +import com.google.android.material.chip.ChipGroup object BaristaChipAssertions { diff --git a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaClickableAssertions.kt b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaClickableAssertions.kt index 4d814246..fa9011bd 100644 --- a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaClickableAssertions.kt +++ b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaClickableAssertions.kt @@ -1,9 +1,9 @@ package com.adevinta.android.barista.assertion import androidx.test.espresso.matcher.ViewMatchers.isClickable -import androidx.test.espresso.matcher.ViewMatchers.withText import com.adevinta.android.barista.internal.assertAny import com.adevinta.android.barista.internal.util.resourceMatcher +import com.adevinta.android.barista.internal.matcher.withCompatText import org.hamcrest.Matchers.not object BaristaClickableAssertions { @@ -15,7 +15,7 @@ object BaristaClickableAssertions { @JvmStatic fun assertClickable(text: String) { - withText(text).assertAny(isClickable()) + withCompatText(text).assertAny(isClickable()) } @JvmStatic @@ -25,6 +25,6 @@ object BaristaClickableAssertions { @JvmStatic fun assertNotClickable(text: String) { - withText(text).assertAny(not(isClickable())) + withCompatText(text).assertAny(not(isClickable())) } } \ No newline at end of file diff --git a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaDrawerAssertions.kt b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaDrawerAssertions.kt index 6339fa73..21109581 100644 --- a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaDrawerAssertions.kt +++ b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaDrawerAssertions.kt @@ -1,13 +1,13 @@ package com.adevinta.android.barista.assertion import androidx.annotation.IdRes +import androidx.core.view.GravityCompat +import androidx.drawerlayout.widget.DrawerLayout import androidx.test.espresso.Espresso.onView import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.contrib.DrawerMatchers.isClosed import androidx.test.espresso.contrib.DrawerMatchers.isOpen import androidx.test.espresso.matcher.ViewMatchers -import androidx.core.view.GravityCompat -import androidx.drawerlayout.widget.DrawerLayout object BaristaDrawerAssertions { diff --git a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaEnabledAssertions.kt b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaEnabledAssertions.kt index 68e90424..70e0d3de 100644 --- a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaEnabledAssertions.kt +++ b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaEnabledAssertions.kt @@ -1,9 +1,9 @@ package com.adevinta.android.barista.assertion import androidx.test.espresso.matcher.ViewMatchers.isEnabled -import androidx.test.espresso.matcher.ViewMatchers.withText import com.adevinta.android.barista.internal.assertAny import com.adevinta.android.barista.internal.util.resourceMatcher +import com.adevinta.android.barista.internal.matcher.withCompatText import org.hamcrest.Matchers.not object BaristaEnabledAssertions { @@ -15,7 +15,7 @@ object BaristaEnabledAssertions { @JvmStatic fun assertEnabled(text: String) { - withText(text).assertAny(isEnabled()) + withCompatText(text).assertAny(isEnabled()) } @JvmStatic @@ -25,6 +25,6 @@ object BaristaEnabledAssertions { @JvmStatic fun assertDisabled(text: String) { - withText(text).assertAny(not(isEnabled())) + withCompatText(text).assertAny(not(isEnabled())) } } \ No newline at end of file diff --git a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaErrorAssertions.kt b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaErrorAssertions.kt index 9d49fb1d..a6782197 100644 --- a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaErrorAssertions.kt +++ b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaErrorAssertions.kt @@ -7,8 +7,8 @@ import androidx.annotation.IdRes import androidx.annotation.StringRes import androidx.test.core.app.ApplicationProvider import androidx.test.espresso.matcher.ViewMatchers -import com.google.android.material.textfield.TextInputLayout import com.adevinta.android.barista.internal.assertAny +import com.google.android.material.textfield.TextInputLayout import org.hamcrest.Description import org.hamcrest.Matcher import org.hamcrest.TypeSafeMatcher diff --git a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaFocusedAssertions.kt b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaFocusedAssertions.kt index 46b86ae3..70e47549 100644 --- a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaFocusedAssertions.kt +++ b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaFocusedAssertions.kt @@ -2,9 +2,9 @@ package com.adevinta.android.barista.assertion import androidx.annotation.IdRes import androidx.test.espresso.matcher.ViewMatchers.hasFocus -import androidx.test.espresso.matcher.ViewMatchers.withText import com.adevinta.android.barista.internal.assertAny import com.adevinta.android.barista.internal.util.resourceMatcher +import com.adevinta.android.barista.internal.matcher.withCompatText import org.hamcrest.Matchers.not object BaristaFocusedAssertions { @@ -21,11 +21,11 @@ object BaristaFocusedAssertions { @JvmStatic fun assertFocused(text: String) { - withText(text).assertAny(hasFocus()) + withCompatText(text).assertAny(hasFocus()) } @JvmStatic fun assertNotFocused(text: String) { - withText(text).assertAny(not(hasFocus())) + withCompatText(text).assertAny(not(hasFocus())) } } \ No newline at end of file diff --git a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaHintAssertions.kt b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaHintAssertions.kt index 96c8b6b8..4910aa3b 100644 --- a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaHintAssertions.kt +++ b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaHintAssertions.kt @@ -1,16 +1,16 @@ package com.adevinta.android.barista.assertion import android.content.Context -import androidx.annotation.IdRes -import androidx.annotation.StringRes -import com.google.android.material.textfield.TextInputEditText -import com.google.android.material.textfield.TextInputLayout -import androidx.test.espresso.matcher.ViewMatchers.withId import android.view.View import android.widget.EditText import android.widget.FrameLayout +import androidx.annotation.IdRes +import androidx.annotation.StringRes import androidx.test.core.app.ApplicationProvider +import androidx.test.espresso.matcher.ViewMatchers.withId import com.adevinta.android.barista.internal.assertAny +import com.google.android.material.textfield.TextInputEditText +import com.google.android.material.textfield.TextInputLayout import org.hamcrest.Description import org.hamcrest.Matcher import org.hamcrest.TypeSafeMatcher diff --git a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaListAssertions.kt b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaListAssertions.kt index 553f50be..0b63b06b 100644 --- a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaListAssertions.kt +++ b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaListAssertions.kt @@ -1,25 +1,26 @@ package com.adevinta.android.barista.assertion +import android.view.View +import android.widget.ListView +import androidx.annotation.DrawableRes import androidx.annotation.IdRes import androidx.annotation.StringRes +import androidx.recyclerview.widget.RecyclerView import androidx.test.espresso.Espresso import androidx.test.espresso.NoMatchingViewException import androidx.test.espresso.ViewAssertion import androidx.test.espresso.assertion.ViewAssertions import androidx.test.espresso.matcher.ViewMatchers -import androidx.recyclerview.widget.RecyclerView -import android.view.View -import android.widget.ListView -import androidx.annotation.DrawableRes import com.adevinta.android.barista.interaction.BaristaListInteractions.findListViewMatcher import com.adevinta.android.barista.interaction.BaristaListInteractions.findRecyclerMatcher import com.adevinta.android.barista.interaction.BaristaListInteractions.scrollListToPosition import com.adevinta.android.barista.internal.failurehandler.SpyFailureHandler -import com.adevinta.android.barista.internal.matcher.ListViewNotEmptyAssertion +import com.adevinta.android.barista.internal.matcher.DrawableMatcher import com.adevinta.android.barista.internal.matcher.ListViewItemCountAssertion -import com.adevinta.android.barista.internal.matcher.RecyclerViewNotEmptyAssertion +import com.adevinta.android.barista.internal.matcher.ListViewNotEmptyAssertion import com.adevinta.android.barista.internal.matcher.RecyclerViewItemCountAssertion -import com.adevinta.android.barista.internal.matcher.DrawableMatcher +import com.adevinta.android.barista.internal.matcher.RecyclerViewNotEmptyAssertion +import com.adevinta.android.barista.internal.matcher.withCompatText import org.hamcrest.CoreMatchers import org.hamcrest.Description import org.hamcrest.Matcher @@ -81,8 +82,8 @@ object BaristaListAssertions { targetViewId = targetViewId, viewAssertion = ViewAssertions.matches( CoreMatchers.anyOf( - ViewMatchers.withChild(ViewMatchers.withText(text)), - ViewMatchers.withText(text) + ViewMatchers.withChild(withCompatText(text)), + withCompatText(text) ) ) ) diff --git a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaVisibilityAssertions.kt b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaVisibilityAssertions.kt index 347389b0..0aa07e62 100644 --- a/library/src/main/java/com/adevinta/android/barista/assertion/BaristaVisibilityAssertions.kt +++ b/library/src/main/java/com/adevinta/android/barista/assertion/BaristaVisibilityAssertions.kt @@ -1,7 +1,6 @@ package com.adevinta.android.barista.assertion import android.view.View -import androidx.annotation.AttrRes import androidx.annotation.IdRes import androidx.annotation.StringRes import androidx.annotation.StyleRes @@ -16,6 +15,7 @@ import com.adevinta.android.barista.internal.assertAny import com.adevinta.android.barista.internal.matcher.TextColorMatcher import com.adevinta.android.barista.internal.matcher.TextStyleableColorMatcher import com.adevinta.android.barista.internal.util.resourceMatcher +import com.adevinta.android.barista.internal.matcher.withCompatText import org.hamcrest.CoreMatchers.containsString import org.hamcrest.Matcher import org.hamcrest.Matchers.allOf @@ -35,12 +35,12 @@ object BaristaVisibilityAssertions { @JvmStatic fun assertDisplayed(text: String) { - withText(text).assertAny(isDisplayed()) + withCompatText(text).assertAny(isDisplayed()) } @JvmStatic fun assertDisplayed(@IdRes viewId: Int, text: String) { - viewId.resourceMatcher().assertAny(allOf(isDisplayed(), withText(text))) + viewId.resourceMatcher().assertAny(allOf(isDisplayed(), withCompatText(text))) } @JvmStatic @@ -55,7 +55,7 @@ object BaristaVisibilityAssertions { @JvmStatic fun assertNotExist(text: String) { - onView(withText(text)).check(doesNotExist()) + onView(withCompatText(text)).check(doesNotExist()) } @JvmStatic @@ -65,7 +65,7 @@ object BaristaVisibilityAssertions { @JvmStatic fun assertNotDisplayed(text: String) { - withText(text).assertAny(not(isDisplayed())) + withCompatText(text).assertAny(not(isDisplayed())) } @JvmStatic @@ -75,7 +75,7 @@ object BaristaVisibilityAssertions { @JvmStatic fun assertNotDisplayed(@IdRes viewId: Int, text: String) { - viewId.resourceMatcher().assertAny(not(allOf(isDisplayed(), withText(text)))) + viewId.resourceMatcher().assertAny(not(allOf(isDisplayed(), withCompatText(text)))) } @JvmStatic @@ -85,7 +85,7 @@ object BaristaVisibilityAssertions { @JvmStatic fun assertContains(text: String) { - withText(containsString(text)).assertAny(isDisplayed()) + withCompatText(containsString(text)).assertAny(isDisplayed()) } @JvmStatic @@ -96,7 +96,7 @@ object BaristaVisibilityAssertions { @JvmStatic fun assertContains(@IdRes viewId: Int, text: String) { - viewId.resourceMatcher().assertAny(withText(containsString(text))) + viewId.resourceMatcher().assertAny(withCompatText(containsString(text))) } @JvmStatic @@ -107,7 +107,7 @@ object BaristaVisibilityAssertions { @JvmStatic fun assertNotContains(text: String) { - onView(withText(containsString(text))).check(doesNotExist()) + onView(withCompatText(containsString(text))).check(doesNotExist()) } @JvmStatic @@ -118,7 +118,7 @@ object BaristaVisibilityAssertions { @JvmStatic fun assertNotContains(@IdRes resId: Int, text: String) { - onView(allOf(withId(resId), withText(containsString(text)))).check(doesNotExist()) + onView(allOf(withId(resId), withCompatText(containsString(text)))).check(doesNotExist()) } @JvmStatic diff --git a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaAutoCompleteTextViewInteractions.kt b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaAutoCompleteTextViewInteractions.kt index 8799e2bc..496874d1 100644 --- a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaAutoCompleteTextViewInteractions.kt +++ b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaAutoCompleteTextViewInteractions.kt @@ -1,10 +1,10 @@ package com.adevinta.android.barista.interaction +import android.widget.EditText import androidx.annotation.IdRes import androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom import androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA import androidx.test.espresso.matcher.ViewMatchers.withId -import android.widget.EditText import com.adevinta.android.barista.internal.performAction import com.adevinta.android.barista.internal.viewaction.AutoCompleteViewActions.replaceAutoComplete import org.hamcrest.Matchers.allOf diff --git a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaClickInteractions.kt b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaClickInteractions.kt index ec2b3129..820a5e93 100644 --- a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaClickInteractions.kt +++ b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaClickInteractions.kt @@ -3,9 +3,9 @@ package com.adevinta.android.barista.interaction import androidx.test.espresso.Espresso.pressBack import androidx.test.espresso.action.ViewActions.click import androidx.test.espresso.action.ViewActions.longClick -import androidx.test.espresso.matcher.ViewMatchers.withText import com.adevinta.android.barista.internal.performAction import com.adevinta.android.barista.internal.util.resourceMatcher +import com.adevinta.android.barista.internal.matcher.withCompatText object BaristaClickInteractions { @@ -21,7 +21,7 @@ object BaristaClickInteractions { @JvmStatic fun clickOn(text: String) { - withText(text).performAction(click()) + withCompatText(text).performAction(click()) } @JvmStatic @@ -31,6 +31,6 @@ object BaristaClickInteractions { @JvmStatic fun longClickOn(text: String) { - withText(text).performAction(longClick()) + withCompatText(text).performAction(longClick()) } } diff --git a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaDrawerInteractions.kt b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaDrawerInteractions.kt index 81991cb6..878de3a4 100644 --- a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaDrawerInteractions.kt +++ b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaDrawerInteractions.kt @@ -1,12 +1,12 @@ package com.adevinta.android.barista.interaction import androidx.annotation.IdRes +import androidx.core.view.GravityCompat +import androidx.drawerlayout.widget.DrawerLayout import androidx.test.espresso.contrib.DrawerActions.close import androidx.test.espresso.contrib.DrawerActions.open import androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom import androidx.test.espresso.matcher.ViewMatchers.withId -import androidx.core.view.GravityCompat -import androidx.drawerlayout.widget.DrawerLayout import com.adevinta.android.barista.internal.performAction object BaristaDrawerInteractions { diff --git a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaEditTextInteractions.kt b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaEditTextInteractions.kt index d96cbf9e..c2d82310 100644 --- a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaEditTextInteractions.kt +++ b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaEditTextInteractions.kt @@ -1,5 +1,6 @@ package com.adevinta.android.barista.interaction +import android.widget.EditText import androidx.annotation.IdRes import androidx.test.espresso.action.ViewActions.clearText import androidx.test.espresso.action.ViewActions.replaceText @@ -7,7 +8,6 @@ import androidx.test.espresso.action.ViewActions.typeText import androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom import androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA import androidx.test.espresso.matcher.ViewMatchers.withId -import android.widget.EditText import com.adevinta.android.barista.internal.performAction import org.hamcrest.Matchers.allOf import org.hamcrest.Matchers.anyOf diff --git a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaKeyboardInteractions.kt b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaKeyboardInteractions.kt index fdc0360c..10499fcf 100644 --- a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaKeyboardInteractions.kt +++ b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaKeyboardInteractions.kt @@ -1,5 +1,6 @@ package com.adevinta.android.barista.interaction +import android.widget.EditText import androidx.annotation.IdRes import androidx.test.espresso.Espresso.onView import androidx.test.espresso.action.ViewActions @@ -8,7 +9,6 @@ import androidx.test.espresso.matcher.ViewMatchers import androidx.test.espresso.matcher.ViewMatchers.hasFocus import androidx.test.espresso.matcher.ViewMatchers.isRoot import androidx.test.espresso.matcher.ViewMatchers.withId -import android.widget.EditText import com.adevinta.android.barista.internal.performAction import org.hamcrest.core.AllOf.allOf diff --git a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaListInteractions.kt b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaListInteractions.kt index 63bfebe3..3c76631b 100644 --- a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaListInteractions.kt +++ b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaListInteractions.kt @@ -1,7 +1,12 @@ package com.adevinta.android.barista.interaction import android.content.Context +import android.view.View +import android.widget.AbsListView import androidx.annotation.IdRes +import androidx.recyclerview.widget.RecyclerView +import androidx.recyclerview.widget.RecyclerView.ViewHolder +import androidx.test.core.app.ApplicationProvider import androidx.test.espresso.AmbiguousViewMatcherException import androidx.test.espresso.Espresso.onData import androidx.test.espresso.Espresso.onView @@ -15,11 +20,6 @@ import androidx.test.espresso.contrib.RecyclerViewActions.scrollToPosition import androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom import androidx.test.espresso.matcher.ViewMatchers.isDisplayed import androidx.test.espresso.matcher.ViewMatchers.withId -import androidx.recyclerview.widget.RecyclerView -import androidx.recyclerview.widget.RecyclerView.ViewHolder -import android.view.View -import android.widget.AbsListView -import androidx.test.core.app.ApplicationProvider import com.adevinta.android.barista.internal.failurehandler.SpyFailureHandler import com.adevinta.android.barista.internal.failurehandler.description import com.adevinta.android.barista.internal.failurehandler.withFailureHandler diff --git a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaMenuClickInteractions.kt b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaMenuClickInteractions.kt index b923cd3b..5e272551 100644 --- a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaMenuClickInteractions.kt +++ b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaMenuClickInteractions.kt @@ -1,7 +1,9 @@ package com.adevinta.android.barista.interaction import android.content.Context +import android.view.View import androidx.annotation.IdRes +import androidx.test.core.app.ApplicationProvider import androidx.test.espresso.Espresso.onData import androidx.test.espresso.Espresso.onView import androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu @@ -10,13 +12,11 @@ import androidx.test.espresso.action.ViewActions.click import androidx.test.espresso.matcher.RootMatchers.isPlatformPopup import androidx.test.espresso.matcher.ViewMatchers.withContentDescription import androidx.test.espresso.matcher.ViewMatchers.withId -import androidx.test.espresso.matcher.ViewMatchers.withText -import android.view.View -import androidx.test.core.app.ApplicationProvider import com.adevinta.android.barista.internal.failurehandler.SpyFailureHandler import com.adevinta.android.barista.internal.failurehandler.withFailureHandler import com.adevinta.android.barista.internal.matcher.DisplayedMatchers.displayedAnd import com.adevinta.android.barista.internal.matcher.HelperMatchers.menuIdMatcher +import com.adevinta.android.barista.internal.matcher.withCompatText import org.hamcrest.Matcher import org.hamcrest.Matchers.hasToString @@ -40,7 +40,7 @@ object BaristaMenuClickInteractions { fun clickMenu(text: String) { val spyFailureHandler = SpyFailureHandler() try { - clickDisplayedView(withText(text), spyFailureHandler) + clickDisplayedView(withCompatText(text), spyFailureHandler) } catch (noMatchingViewException: NoMatchingViewException) { try { clickViewWithDescription(text, spyFailureHandler) diff --git a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaPickerInteractions.java b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaPickerInteractions.java index 6291e4da..c1e1c171 100644 --- a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaPickerInteractions.java +++ b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaPickerInteractions.java @@ -1,8 +1,8 @@ package com.adevinta.android.barista.interaction; -import androidx.test.espresso.contrib.PickerActions; import android.widget.DatePicker; import android.widget.TimePicker; +import androidx.test.espresso.contrib.PickerActions; import org.hamcrest.Matchers; import static androidx.test.espresso.Espresso.onView; diff --git a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaRadioButtonInteractions.kt b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaRadioButtonInteractions.kt index ae4cad60..96aa54af 100644 --- a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaRadioButtonInteractions.kt +++ b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaRadioButtonInteractions.kt @@ -4,9 +4,9 @@ import androidx.annotation.IdRes import androidx.test.espresso.action.ViewActions.click import androidx.test.espresso.matcher.ViewMatchers import androidx.test.espresso.matcher.ViewMatchers.withId -import androidx.test.espresso.matcher.ViewMatchers.withText import com.adevinta.android.barista.internal.matcher.HelperMatchers.withParentId import com.adevinta.android.barista.internal.performAction +import com.adevinta.android.barista.internal.matcher.withCompatText import org.hamcrest.Matchers.allOf object BaristaRadioButtonInteractions { @@ -19,7 +19,7 @@ object BaristaRadioButtonInteractions { @JvmStatic fun clickRadioButtonItem(@IdRes radioGroupId: Int, text: String) { - allOf(withParentId(radioGroupId), withText(text)) + allOf(withParentId(radioGroupId), withCompatText(text)) .performAction(click()) } diff --git a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaScrollInteractions.kt b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaScrollInteractions.kt index 8dedd2db..a7b2c348 100644 --- a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaScrollInteractions.kt +++ b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaScrollInteractions.kt @@ -3,9 +3,9 @@ package com.adevinta.android.barista.interaction import android.view.View import androidx.test.espresso.Espresso.onView import androidx.test.espresso.PerformException -import androidx.test.espresso.matcher.ViewMatchers.withText import com.adevinta.android.barista.internal.failurehandler.SpyFailureHandler import com.adevinta.android.barista.internal.failurehandler.description +import com.adevinta.android.barista.internal.matcher.withCompatText import com.adevinta.android.barista.internal.util.resourceMatcher import com.adevinta.android.barista.internal.viewaction.NestedEnabledScrollToAction.nestedScrollToAction import org.hamcrest.Matcher @@ -32,7 +32,7 @@ object BaristaScrollInteractions { @JvmStatic fun scrollTo(text: String) { - scrollWithMultipleAttempts(withText(text), failAtEnd = true) + scrollWithMultipleAttempts(withCompatText(text), failAtEnd = true) } @JvmStatic @@ -47,7 +47,7 @@ object BaristaScrollInteractions { @JvmStatic fun safelyScrollTo(text: String) { - scrollWithMultipleAttempts(withText(text), failAtEnd = false) + scrollWithMultipleAttempts(withCompatText(text), failAtEnd = false) } private fun scrollWithMultipleAttempts(matcher: Matcher, failAtEnd: Boolean) { diff --git a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaSpinnerInteractions.kt b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaSpinnerInteractions.kt index a2ed6e5a..a559b73e 100644 --- a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaSpinnerInteractions.kt +++ b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaSpinnerInteractions.kt @@ -1,11 +1,11 @@ package com.adevinta.android.barista.interaction +import android.widget.AdapterView import androidx.annotation.IdRes import androidx.test.espresso.Espresso.onData import androidx.test.espresso.action.ViewActions import androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom import androidx.test.espresso.matcher.ViewMatchers.isDisplayed -import android.widget.AdapterView import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn import org.hamcrest.Matchers.`is` import org.hamcrest.Matchers.allOf diff --git a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaSwipeRefreshInteractions.kt b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaSwipeRefreshInteractions.kt index 48c88045..2af2cbb7 100644 --- a/library/src/main/java/com/adevinta/android/barista/interaction/BaristaSwipeRefreshInteractions.kt +++ b/library/src/main/java/com/adevinta/android/barista/interaction/BaristaSwipeRefreshInteractions.kt @@ -1,10 +1,10 @@ package com.adevinta.android.barista.interaction import androidx.annotation.IdRes +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import androidx.test.espresso.Espresso.onView import androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom import androidx.test.espresso.matcher.ViewMatchers.withId -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import com.adevinta.android.barista.internal.viewaction.SwipeRefreshActions.pullToRefresh object BaristaSwipeRefreshInteractions { diff --git a/library/src/main/java/com/adevinta/android/barista/internal/AssertAny.kt b/library/src/main/java/com/adevinta/android/barista/internal/AssertAny.kt index a33d3d4b..47a7d1b3 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/AssertAny.kt +++ b/library/src/main/java/com/adevinta/android/barista/internal/AssertAny.kt @@ -1,10 +1,10 @@ package com.adevinta.android.barista.internal +import android.view.View import androidx.test.espresso.AmbiguousViewMatcherException import androidx.test.espresso.Espresso.onView import androidx.test.espresso.NoMatchingViewException import androidx.test.espresso.assertion.ViewAssertions -import android.view.View import com.adevinta.android.barista.internal.failurehandler.SpyFailureHandler import com.adevinta.android.barista.internal.failurehandler.description import com.adevinta.android.barista.internal.matcher.HelperMatchers.firstViewOf diff --git a/library/src/main/java/com/adevinta/android/barista/internal/PerformAction.kt b/library/src/main/java/com/adevinta/android/barista/internal/PerformAction.kt index 65864e3b..6040566b 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/PerformAction.kt +++ b/library/src/main/java/com/adevinta/android/barista/internal/PerformAction.kt @@ -1,16 +1,16 @@ package com.adevinta.android.barista.internal +import android.view.View +import android.widget.AbsListView +import android.widget.HorizontalScrollView +import android.widget.ScrollView +import androidx.core.widget.NestedScrollView import androidx.test.espresso.Espresso.onView import androidx.test.espresso.ViewAction import androidx.test.espresso.action.ViewActions.scrollTo import androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom import androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA import androidx.test.espresso.matcher.ViewMatchers.isDisplayed -import androidx.core.widget.NestedScrollView -import android.view.View -import android.widget.AbsListView -import android.widget.HorizontalScrollView -import android.widget.ScrollView import com.adevinta.android.barista.internal.failurehandler.SpyFailureHandler import com.adevinta.android.barista.internal.failurehandler.description import com.adevinta.android.barista.internal.matcher.DisplayedMatchers.displayedAnd diff --git a/library/src/main/java/com/adevinta/android/barista/internal/failurehandler/HelperFunctions.kt b/library/src/main/java/com/adevinta/android/barista/internal/failurehandler/HelperFunctions.kt index c1387a9b..a535bc8b 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/failurehandler/HelperFunctions.kt +++ b/library/src/main/java/com/adevinta/android/barista/internal/failurehandler/HelperFunctions.kt @@ -1,9 +1,9 @@ package com.adevinta.android.barista.internal.failurehandler +import android.view.View import androidx.test.espresso.Espresso import androidx.test.espresso.FailureHandler import androidx.test.espresso.getFailureHandler -import android.view.View import org.hamcrest.Matcher import org.hamcrest.StringDescription diff --git a/library/src/main/java/com/adevinta/android/barista/internal/failurehandler/RethrowingFailureHandler.kt b/library/src/main/java/com/adevinta/android/barista/internal/failurehandler/RethrowingFailureHandler.kt index 9e363f19..0c46e092 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/failurehandler/RethrowingFailureHandler.kt +++ b/library/src/main/java/com/adevinta/android/barista/internal/failurehandler/RethrowingFailureHandler.kt @@ -1,7 +1,7 @@ package com.adevinta.android.barista.internal.failurehandler -import androidx.test.espresso.FailureHandler import android.view.View +import androidx.test.espresso.FailureHandler import org.hamcrest.Matcher class RethrowingFailureHandler : FailureHandler { diff --git a/library/src/main/java/com/adevinta/android/barista/internal/failurehandler/SpyFailureHandler.kt b/library/src/main/java/com/adevinta/android/barista/internal/failurehandler/SpyFailureHandler.kt index d614fadd..c589629e 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/failurehandler/SpyFailureHandler.kt +++ b/library/src/main/java/com/adevinta/android/barista/internal/failurehandler/SpyFailureHandler.kt @@ -1,8 +1,8 @@ package com.adevinta.android.barista.internal.failurehandler +import android.view.View import androidx.test.espresso.FailureHandler import androidx.test.espresso.getFailureHandler -import android.view.View import org.hamcrest.Matcher open class SpyFailureHandler : FailureHandler { diff --git a/library/src/main/java/com/adevinta/android/barista/internal/matcher/DisplayedMatchers.java b/library/src/main/java/com/adevinta/android/barista/internal/matcher/DisplayedMatchers.java index f7cfd94c..1ff9c7b4 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/matcher/DisplayedMatchers.java +++ b/library/src/main/java/com/adevinta/android/barista/internal/matcher/DisplayedMatchers.java @@ -1,8 +1,8 @@ package com.adevinta.android.barista.internal.matcher; +import android.view.View; import androidx.annotation.IdRes; import androidx.annotation.NonNull; -import android.view.View; import org.hamcrest.Matcher; import static androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom; diff --git a/library/src/main/java/com/adevinta/android/barista/internal/matcher/DrawableMatcher.kt b/library/src/main/java/com/adevinta/android/barista/internal/matcher/DrawableMatcher.kt index eb587833..24097ded 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/matcher/DrawableMatcher.kt +++ b/library/src/main/java/com/adevinta/android/barista/internal/matcher/DrawableMatcher.kt @@ -8,9 +8,9 @@ import android.widget.ImageView import androidx.annotation.DrawableRes import androidx.appcompat.content.res.AppCompatResources import androidx.core.graphics.drawable.DrawableCompat -import com.google.android.material.button.MaterialButton import com.adevinta.android.barista.internal.util.BitmapComparator import com.adevinta.android.barista.internal.util.DrawableToBitmapConverter +import com.google.android.material.button.MaterialButton import org.hamcrest.Description import org.hamcrest.TypeSafeMatcher diff --git a/library/src/main/java/com/adevinta/android/barista/internal/matcher/HelperMatchers.java b/library/src/main/java/com/adevinta/android/barista/internal/matcher/HelperMatchers.java index 64004079..2678ab6f 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/matcher/HelperMatchers.java +++ b/library/src/main/java/com/adevinta/android/barista/internal/matcher/HelperMatchers.java @@ -1,9 +1,9 @@ package com.adevinta.android.barista.internal.matcher; -import androidx.annotation.IdRes; -import androidx.test.espresso.matcher.BoundedMatcher; import android.view.MenuItem; import android.view.View; +import androidx.annotation.IdRes; +import androidx.test.espresso.matcher.BoundedMatcher; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; import org.hamcrest.Matcher; diff --git a/library/src/main/java/com/adevinta/android/barista/internal/matcher/ListViewItemCountAssertion.kt b/library/src/main/java/com/adevinta/android/barista/internal/matcher/ListViewItemCountAssertion.kt index a80db238..84beba6f 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/matcher/ListViewItemCountAssertion.kt +++ b/library/src/main/java/com/adevinta/android/barista/internal/matcher/ListViewItemCountAssertion.kt @@ -1,9 +1,9 @@ package com.adevinta.android.barista.internal.matcher -import androidx.test.espresso.NoMatchingViewException -import androidx.test.espresso.ViewAssertion import android.view.View import android.widget.ListView +import androidx.test.espresso.NoMatchingViewException +import androidx.test.espresso.ViewAssertion import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.`is` diff --git a/library/src/main/java/com/adevinta/android/barista/internal/matcher/ListViewNotEmptyAssertion.kt b/library/src/main/java/com/adevinta/android/barista/internal/matcher/ListViewNotEmptyAssertion.kt index f074231f..36014fed 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/matcher/ListViewNotEmptyAssertion.kt +++ b/library/src/main/java/com/adevinta/android/barista/internal/matcher/ListViewNotEmptyAssertion.kt @@ -1,9 +1,9 @@ package com.adevinta.android.barista.internal.matcher -import androidx.test.espresso.NoMatchingViewException -import androidx.test.espresso.ViewAssertion import android.view.View import android.widget.ListView +import androidx.test.espresso.NoMatchingViewException +import androidx.test.espresso.ViewAssertion import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.not diff --git a/library/src/main/java/com/adevinta/android/barista/internal/matcher/ProgressBarMatchers.kt b/library/src/main/java/com/adevinta/android/barista/internal/matcher/ProgressBarMatchers.kt index 133e2b5e..426c8224 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/matcher/ProgressBarMatchers.kt +++ b/library/src/main/java/com/adevinta/android/barista/internal/matcher/ProgressBarMatchers.kt @@ -1,8 +1,8 @@ package com.adevinta.android.barista.internal.matcher -import androidx.test.espresso.matcher.BoundedMatcher import android.view.View import android.widget.ProgressBar +import androidx.test.espresso.matcher.BoundedMatcher import org.hamcrest.Description object ProgressBarMatchers { diff --git a/library/src/main/java/com/adevinta/android/barista/internal/matcher/RecyclerViewItemCountAssertion.java b/library/src/main/java/com/adevinta/android/barista/internal/matcher/RecyclerViewItemCountAssertion.java index f75145b4..2f0ca38d 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/matcher/RecyclerViewItemCountAssertion.java +++ b/library/src/main/java/com/adevinta/android/barista/internal/matcher/RecyclerViewItemCountAssertion.java @@ -1,9 +1,9 @@ package com.adevinta.android.barista.internal.matcher; +import android.view.View; +import androidx.recyclerview.widget.RecyclerView; import androidx.test.espresso.NoMatchingViewException; import androidx.test.espresso.ViewAssertion; -import androidx.recyclerview.widget.RecyclerView; -import android.view.View; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; diff --git a/library/src/main/java/com/adevinta/android/barista/internal/matcher/TextMatcher.kt b/library/src/main/java/com/adevinta/android/barista/internal/matcher/TextMatcher.kt new file mode 100644 index 00000000..6195c9df --- /dev/null +++ b/library/src/main/java/com/adevinta/android/barista/internal/matcher/TextMatcher.kt @@ -0,0 +1,31 @@ +package com.adevinta.android.barista.internal.matcher + +import android.view.View +import androidx.test.espresso.matcher.ViewMatchers.hasDescendant +import androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom +import androidx.test.espresso.matcher.ViewMatchers.withParent +import androidx.test.espresso.matcher.ViewMatchers.withText +import com.google.android.material.textfield.TextInputLayout +import org.hamcrest.Matcher +import org.hamcrest.Matchers.allOf +import org.hamcrest.Matchers.anyOf + +fun withCompatText(string: String): Matcher { + return anyOf( + withText(string), + allOf( + withParent(isAssignableFrom(TextInputLayout::class.java)), + hasDescendant(withText(string)) + ) + ) +} + +fun withCompatText(stringMatcher: Matcher): Matcher { + return anyOf( + withText(stringMatcher), + allOf( + withParent(isAssignableFrom(TextInputLayout::class.java)), + hasDescendant(withText(stringMatcher)) + ) + ) +} \ No newline at end of file diff --git a/library/src/main/java/com/adevinta/android/barista/internal/matcher/TextStyleableColorMatcher.kt b/library/src/main/java/com/adevinta/android/barista/internal/matcher/TextStyleableColorMatcher.kt index f7aff4ff..a71872ef 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/matcher/TextStyleableColorMatcher.kt +++ b/library/src/main/java/com/adevinta/android/barista/internal/matcher/TextStyleableColorMatcher.kt @@ -2,12 +2,9 @@ package com.adevinta.android.barista.internal.matcher import android.content.res.ColorStateList import android.view.View import android.widget.TextView -import androidx.annotation.AttrRes import androidx.annotation.StyleRes import androidx.annotation.StyleableRes import androidx.test.espresso.matcher.BoundedMatcher -import com.adevinta.android.barista.internal.util.ColorResourceType -import com.adevinta.android.barista.internal.util.colorResourceType import org.hamcrest.Description class TextStyleableColorMatcher( diff --git a/library/src/main/java/com/adevinta/android/barista/internal/viewaction/AutoCompleteViewActions.java b/library/src/main/java/com/adevinta/android/barista/internal/viewaction/AutoCompleteViewActions.java index 1e8fc761..91bc1655 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/viewaction/AutoCompleteViewActions.java +++ b/library/src/main/java/com/adevinta/android/barista/internal/viewaction/AutoCompleteViewActions.java @@ -1,14 +1,14 @@ package com.adevinta.android.barista.internal.viewaction; -import androidx.test.espresso.UiController; -import androidx.test.espresso.ViewAction; -import androidx.test.espresso.action.ReplaceTextAction; import android.view.View; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.CursorAdapter; import android.widget.EditText; import android.widget.ListAdapter; +import androidx.test.espresso.UiController; +import androidx.test.espresso.ViewAction; +import androidx.test.espresso.action.ReplaceTextAction; import javax.annotation.Nonnull; import org.hamcrest.Matcher; diff --git a/library/src/main/java/com/adevinta/android/barista/internal/viewaction/ClickChildAction.java b/library/src/main/java/com/adevinta/android/barista/internal/viewaction/ClickChildAction.java index d313c6d0..e5d545d9 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/viewaction/ClickChildAction.java +++ b/library/src/main/java/com/adevinta/android/barista/internal/viewaction/ClickChildAction.java @@ -1,20 +1,19 @@ package com.adevinta.android.barista.internal.viewaction; +import android.view.View; +import android.widget.TextView; import androidx.annotation.IdRes; import androidx.test.espresso.PerformException; import androidx.test.espresso.UiController; import androidx.test.espresso.ViewAction; import androidx.test.espresso.util.HumanReadables; -import android.view.View; -import android.widget.TextView; import com.adevinta.android.barista.internal.failurehandler.HelperFunctionsKt; import com.adevinta.android.barista.internal.util.ViewTreeAnalyzer; import org.hamcrest.Matcher; - import static androidx.test.espresso.matcher.ViewMatchers.hasDescendant; import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; import static androidx.test.espresso.matcher.ViewMatchers.withId; -import static androidx.test.espresso.matcher.ViewMatchers.withText; +import static com.adevinta.android.barista.internal.matcher.TextMatcherKt.withCompatText; import static org.hamcrest.Matchers.allOf; public class ClickChildAction { @@ -50,11 +49,11 @@ public void perform(UiController uiController, View view) { }; } - public static ViewAction clickChildWithText(final String text) { + public static ViewAction clickChildwithCompatText(final String text) { return new ViewAction() { @Override public Matcher getConstraints() { - return allOf(isDisplayed(), hasDescendant(withText(text))); + return allOf(isDisplayed(), hasDescendant(withCompatText(text))); } @Override diff --git a/library/src/main/java/com/adevinta/android/barista/internal/viewaction/NestedEnabledScrollToAction.java b/library/src/main/java/com/adevinta/android/barista/internal/viewaction/NestedEnabledScrollToAction.java index 87ce3639..fa60318e 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/viewaction/NestedEnabledScrollToAction.java +++ b/library/src/main/java/com/adevinta/android/barista/internal/viewaction/NestedEnabledScrollToAction.java @@ -1,13 +1,13 @@ package com.adevinta.android.barista.internal.viewaction; +import android.view.View; +import android.widget.HorizontalScrollView; +import android.widget.ScrollView; +import androidx.core.widget.NestedScrollView; import androidx.test.espresso.UiController; import androidx.test.espresso.ViewAction; import androidx.test.espresso.action.ScrollToAction; import androidx.test.espresso.matcher.ViewMatchers; -import androidx.core.widget.NestedScrollView; -import android.view.View; -import android.widget.HorizontalScrollView; -import android.widget.ScrollView; import org.hamcrest.Matcher; import static androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom; diff --git a/library/src/main/java/com/adevinta/android/barista/internal/viewaction/PerformClickAction.java b/library/src/main/java/com/adevinta/android/barista/internal/viewaction/PerformClickAction.java index cd3e591f..5f845240 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/viewaction/PerformClickAction.java +++ b/library/src/main/java/com/adevinta/android/barista/internal/viewaction/PerformClickAction.java @@ -1,8 +1,8 @@ package com.adevinta.android.barista.internal.viewaction; +import android.view.View; import androidx.test.espresso.UiController; import androidx.test.espresso.ViewAction; -import android.view.View; import org.hamcrest.Matcher; import static androidx.test.espresso.action.ViewActions.click; diff --git a/library/src/main/java/com/adevinta/android/barista/internal/viewaction/RatingBarActions.kt b/library/src/main/java/com/adevinta/android/barista/internal/viewaction/RatingBarActions.kt index d4bec6b5..25aa574c 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/viewaction/RatingBarActions.kt +++ b/library/src/main/java/com/adevinta/android/barista/internal/viewaction/RatingBarActions.kt @@ -1,11 +1,11 @@ package com.adevinta.android.barista.internal.viewaction +import android.view.View +import android.widget.RatingBar import androidx.test.espresso.UiController import androidx.test.espresso.ViewAction import androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom import androidx.test.espresso.matcher.ViewMatchers.isDisplayed -import android.view.View -import android.widget.RatingBar import org.hamcrest.Matcher import org.hamcrest.Matchers.allOf diff --git a/library/src/main/java/com/adevinta/android/barista/internal/viewaction/SeekBarActions.kt b/library/src/main/java/com/adevinta/android/barista/internal/viewaction/SeekBarActions.kt index 681c9589..7b702481 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/viewaction/SeekBarActions.kt +++ b/library/src/main/java/com/adevinta/android/barista/internal/viewaction/SeekBarActions.kt @@ -1,11 +1,11 @@ package com.adevinta.android.barista.internal.viewaction +import android.view.View +import android.widget.SeekBar import androidx.test.espresso.UiController import androidx.test.espresso.ViewAction import androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom import androidx.test.espresso.matcher.ViewMatchers.isDisplayed -import android.view.View -import android.widget.SeekBar import org.hamcrest.Matcher import org.hamcrest.Matchers.allOf diff --git a/library/src/main/java/com/adevinta/android/barista/internal/viewaction/SleepViewAction.java b/library/src/main/java/com/adevinta/android/barista/internal/viewaction/SleepViewAction.java index 552a507e..f925a2be 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/viewaction/SleepViewAction.java +++ b/library/src/main/java/com/adevinta/android/barista/internal/viewaction/SleepViewAction.java @@ -1,8 +1,8 @@ package com.adevinta.android.barista.internal.viewaction; +import android.view.View; import androidx.test.espresso.UiController; import androidx.test.espresso.ViewAction; -import android.view.View; import org.hamcrest.Matcher; import static androidx.test.espresso.matcher.ViewMatchers.isRoot; diff --git a/library/src/main/java/com/adevinta/android/barista/internal/viewaction/SwipeRefreshActions.java b/library/src/main/java/com/adevinta/android/barista/internal/viewaction/SwipeRefreshActions.java index e7f72343..3a95ee85 100644 --- a/library/src/main/java/com/adevinta/android/barista/internal/viewaction/SwipeRefreshActions.java +++ b/library/src/main/java/com/adevinta/android/barista/internal/viewaction/SwipeRefreshActions.java @@ -1,9 +1,9 @@ package com.adevinta.android.barista.internal.viewaction; +import android.view.View; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.test.espresso.UiController; import androidx.test.espresso.ViewAction; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; import org.hamcrest.Matcher; import static androidx.test.espresso.action.ViewActions.actionWithAssertions; diff --git a/library/src/main/java/com/adevinta/android/barista/rule/cleardata/ClearPreferencesRule.java b/library/src/main/java/com/adevinta/android/barista/rule/cleardata/ClearPreferencesRule.java index 08232eef..2fb4e999 100644 --- a/library/src/main/java/com/adevinta/android/barista/rule/cleardata/ClearPreferencesRule.java +++ b/library/src/main/java/com/adevinta/android/barista/rule/cleardata/ClearPreferencesRule.java @@ -4,7 +4,6 @@ import android.content.SharedPreferences; import androidx.annotation.NonNull; import androidx.test.core.app.ApplicationProvider; - import java.io.File; import java.util.ArrayList; import java.util.Collections; diff --git a/library/src/main/java/com/adevinta/android/barista/rule/flaky/internal/FlakyUtil.java b/library/src/main/java/com/adevinta/android/barista/rule/flaky/internal/FlakyUtil.java index 6080d401..4ba07ca2 100644 --- a/library/src/main/java/com/adevinta/android/barista/rule/flaky/internal/FlakyUtil.java +++ b/library/src/main/java/com/adevinta/android/barista/rule/flaky/internal/FlakyUtil.java @@ -1,10 +1,10 @@ package com.adevinta.android.barista.rule.flaky.internal; import android.app.Activity; +import android.util.Log; import androidx.test.InstrumentationRegistry; import androidx.test.runner.lifecycle.ActivityLifecycleMonitorRegistry; import androidx.test.runner.lifecycle.Stage; -import android.util.Log; import java.util.ArrayList; import java.util.EnumSet; import java.util.List; diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/AssertAnyTest.kt b/sample/src/androidTest/java/com/adevinta/android/barista/sample/AssertAnyTest.kt index dd527152..89c88e95 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/AssertAnyTest.kt +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/AssertAnyTest.kt @@ -1,10 +1,10 @@ package com.adevinta.android.barista.sample +import android.widget.EditText +import android.widget.ImageView import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.rule.ActivityTestRule import androidx.test.runner.AndroidJUnit4 -import android.widget.EditText -import android.widget.ImageView import com.adevinta.android.barista.assertion.BaristaAssertions.assertAny import com.adevinta.android.barista.interaction.BaristaEditTextInteractions.writeTo import com.adevinta.android.barista.internal.failurehandler.BaristaException diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/DrawerActivityTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/DrawerActivityTest.java index bd38287e..2506e9df 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/DrawerActivityTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/DrawerActivityTest.java @@ -1,8 +1,8 @@ package com.adevinta.android.barista.sample; +import androidx.core.view.GravityCompat; import androidx.test.rule.ActivityTestRule; import androidx.test.runner.AndroidJUnit4; -import androidx.core.view.GravityCompat; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/TextInputLayoutWithTextTest.kt b/sample/src/androidTest/java/com/adevinta/android/barista/sample/TextInputLayoutWithTextTest.kt new file mode 100644 index 00000000..c4edad5c --- /dev/null +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/TextInputLayoutWithTextTest.kt @@ -0,0 +1,40 @@ +package com.adevinta.android.barista.sample + +import androidx.test.rule.ActivityTestRule +import com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed +import com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertNotDisplayed +import com.adevinta.android.barista.interaction.BaristaEditTextInteractions.writeTo +import com.adevinta.android.barista.internal.failurehandler.BaristaException +import com.adevinta.android.barista.rule.flaky.Repeat +import org.junit.Rule +import org.junit.Test + +class TextInputLayoutWithTextTest { + + @get:Rule + var activityRule = ActivityTestRule(HintAndErrorActivity::class.java) + + @Test + fun assertText() { + writeTo(R.id.hintanderror_inputlayout, "Test text") + assertDisplayed("Test text") + } + + @Test + fun assertNoText() { + writeTo(R.id.hintanderror_inputlayout_editText, "Test text") + assertNotDisplayed(R.id.hintanderror_inputlayout, "Other test text") + } + + @Test(expected = BaristaException::class) + fun assertTextFail() { + writeTo(R.id.hintanderror_inputlayout_editText, "Test text") + assertDisplayed("Other test text") + } + + @Test(expected = BaristaException::class) + fun assertNoTextFail() { + writeTo(R.id.hintanderror_inputlayout_editText, "Test text") + assertNotDisplayed("Test text") + } +} \ No newline at end of file diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/assertion/VisibilityAssertionsTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/assertion/VisibilityAssertionsTest.java index f37daf3f..760d3ffb 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/assertion/VisibilityAssertionsTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/assertion/VisibilityAssertionsTest.java @@ -1,14 +1,12 @@ package com.adevinta.android.barista.sample.assertion; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.internal.failurehandler.BaristaException; import com.adevinta.android.barista.sample.R; import com.adevinta.android.barista.sample.SomeViewsWithDifferentVisibilitiesActivity; import com.adevinta.android.barista.sample.util.SpyFailureHandlerRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static androidx.test.espresso.matcher.ViewMatchers.withTagValue; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; @@ -18,7 +16,6 @@ import static org.assertj.core.api.ThrowableAssert.catchThrowable; import static org.hamcrest.CoreMatchers.is; -@RunWith(AndroidJUnit4.class) public class VisibilityAssertionsTest { @Rule @@ -65,8 +62,10 @@ public void checkDisplayedViews_failsWhenInvisible() { Throwable thrown3 = catchThrowable(() -> assertDisplayed("I'm invisible!")); assertThat(thrown3).isInstanceOf(BaristaException.class) - .hasMessage("View (with text: is \"I'm invisible!\") " - + "didn't match condition (is displayed on the screen to the user)"); + .hasMessage("View ((with text: is \"I'm invisible!\" " + + "or (has parent matching: is assignable from class: class com.google.android.material.textfield.TextInputLayout " + + "and has descendant: with text: is \"I'm invisible!\"))) didn't match condition " + + "(is displayed on the screen to the user)"); spyFailureHandlerRule.assertEspressoFailures(3); } @@ -83,7 +82,9 @@ public void checkDisplayed_failsWhenNotExists() { Throwable thrown3 = catchThrowable(() -> assertDisplayed("Not exists")); assertThat(thrown3).isInstanceOf(BaristaException.class) - .hasMessageContaining("No view matching (with text: is \"Not exists\") was found"); + .hasMessageContaining("No view matching ((with text: is \"Not exists\" " + + "or (has parent matching: is assignable from class: class com.google.android.material.textfield.TextInputLayout " + + "and has descendant: with text: is \"Not exists\"))) was found"); spyFailureHandlerRule.assertEspressoFailures(3); } @@ -107,7 +108,9 @@ public void checkDisplayedIdAndText_failsWhenTextIsNotTheExpected() { Throwable thrown2 = catchThrowable(() -> assertDisplayed(R.id.visible_view, "This is not the text you are looking for")); assertThat(thrown2).isInstanceOf(BaristaException.class) .hasMessage("View (with id: com.adevinta.android.barista.sample:id/visible_view) didn't match condition " - + "((is displayed on the screen to the user and with text: is \"This is not the text you are looking for\"))"); + + "((is displayed on the screen to the user and (with text: is \"This is not the text you are looking for\" " + + "or (has parent matching: is assignable from class: class com.google.android.material.textfield.TextInputLayout " + + "and has descendant: with text: is \"This is not the text you are looking for\"))))"); spyFailureHandlerRule.assertEspressoFailures(2); } @@ -122,7 +125,9 @@ public void checkDisplayedIdAndText_failsWhenInvisible() { Throwable thrown2 = catchThrowable(() -> assertDisplayed(R.id.invisible_view, "I'm invisible!")); assertThat(thrown2).isInstanceOf(BaristaException.class) .hasMessage("View (with id: com.adevinta.android.barista.sample:id/invisible_view) didn't match condition " - + "((is displayed on the screen to the user and with text: is \"I'm invisible!\"))"); + + "((is displayed on the screen to the user and (with text: is \"I'm invisible!\" " + + "or (has parent matching: is assignable from class: class com.google.android.material.textfield.TextInputLayout " + + "and has descendant: with text: is \"I'm invisible!\"))))"); spyFailureHandlerRule.assertEspressoFailures(2); } @@ -164,8 +169,10 @@ public void checkNotDisplayedIdAndText_failsWhenTextMatches() { spyFailureHandlerRule.assertEspressoFailures(1); assertThat(thrown).isInstanceOf(BaristaException.class) - .hasMessage("View (with id: com.adevinta.android.barista.sample:id/visible_view) " - + "didn't match condition (not (is displayed on the screen to the user and with text: is \"Hello world!\"))"); + .hasMessage("View (with id: com.adevinta.android.barista.sample:id/visible_view) didn't match condition " + + "(not (is displayed on the screen to the user and (with text: is \"Hello world!\" " + + "or (has parent matching: is assignable from class: class com.google.android.material.textfield.TextInputLayout " + + "and has descendant: with text: is \"Hello world!\"))))"); } @Test diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/util/SpyFailureHandlerRuleTest.kt b/sample/src/androidTest/java/com/adevinta/android/barista/sample/util/SpyFailureHandlerRuleTest.kt index fa2bff91..618526cf 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/util/SpyFailureHandlerRuleTest.kt +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/util/SpyFailureHandlerRuleTest.kt @@ -1,8 +1,8 @@ package com.adevinta.android.barista.sample.util +import com.adevinta.android.barista.internal.failurehandler.SpyFailureHandler import com.nhaarman.mockito_kotlin.given import com.nhaarman.mockito_kotlin.mock -import com.adevinta.android.barista.internal.failurehandler.SpyFailureHandler import org.junit.Test import org.junit.runner.Description import org.junit.runners.model.Statement diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/AutoCompleteTextViewActivity.java b/sample/src/main/java/com/adevinta/android/barista/sample/AutoCompleteTextViewActivity.java index 89db334b..07b11400 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/AutoCompleteTextViewActivity.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/AutoCompleteTextViewActivity.java @@ -1,9 +1,9 @@ package com.adevinta.android.barista.sample; import android.os.Bundle; -import androidx.appcompat.app.AppCompatActivity; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; +import androidx.appcompat.app.AppCompatActivity; public class AutoCompleteTextViewActivity extends AppCompatActivity { diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/CameraActivity.kt b/sample/src/main/java/com/adevinta/android/barista/sample/CameraActivity.kt index 2d3f27aa..c73caadd 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/CameraActivity.kt +++ b/sample/src/main/java/com/adevinta/android/barista/sample/CameraActivity.kt @@ -5,8 +5,8 @@ import android.content.Intent import android.net.Uri import android.os.Bundle import android.provider.MediaStore -import androidx.core.content.FileProvider import androidx.appcompat.app.AppCompatActivity +import androidx.core.content.FileProvider import com.bumptech.glide.Glide import kotlinx.android.synthetic.main.activity_camera.image_view import kotlinx.android.synthetic.main.activity_camera.take_picture diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/CheckBoxActivity.java b/sample/src/main/java/com/adevinta/android/barista/sample/CheckBoxActivity.java index 48a0b421..a7ead93c 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/CheckBoxActivity.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/CheckBoxActivity.java @@ -1,10 +1,10 @@ package com.adevinta.android.barista.sample; import android.os.Bundle; -import androidx.appcompat.app.AppCompatActivity; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; public class CheckBoxActivity extends AppCompatActivity { diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/DialogActivity.java b/sample/src/main/java/com/adevinta/android/barista/sample/DialogActivity.java index 8d979490..4a711b8f 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/DialogActivity.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/DialogActivity.java @@ -2,11 +2,11 @@ import android.content.DialogInterface; import android.os.Bundle; -import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.TextView; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; public class DialogActivity extends AppCompatActivity { diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/FileActivity.java b/sample/src/main/java/com/adevinta/android/barista/sample/FileActivity.java index 441cfba9..2d33c0fa 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/FileActivity.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/FileActivity.java @@ -2,10 +2,10 @@ import android.app.Activity; import android.os.Bundle; -import androidx.annotation.NonNull; import android.util.Log; import android.view.View; import android.widget.TextView; +import androidx.annotation.NonNull; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/FlowFirstScreen.java b/sample/src/main/java/com/adevinta/android/barista/sample/FlowFirstScreen.java index 741dc2b4..13cbf883 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/FlowFirstScreen.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/FlowFirstScreen.java @@ -2,11 +2,11 @@ import android.content.Intent; import android.os.Bundle; -import androidx.appcompat.app.AppCompatActivity; import android.view.View; import android.view.ViewTreeObserver; import android.widget.Button; import android.widget.ScrollView; +import androidx.appcompat.app.AppCompatActivity; public class FlowFirstScreen extends AppCompatActivity { diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/KeyboardActivity.java b/sample/src/main/java/com/adevinta/android/barista/sample/KeyboardActivity.java index 2ebfcf45..b8e9c074 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/KeyboardActivity.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/KeyboardActivity.java @@ -1,10 +1,10 @@ package com.adevinta.android.barista.sample; import android.os.Bundle; -import androidx.appcompat.app.AppCompatActivity; import android.view.KeyEvent; import android.widget.EditText; import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; public class KeyboardActivity extends AppCompatActivity { diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/LabelActivity.java b/sample/src/main/java/com/adevinta/android/barista/sample/LabelActivity.java index 2ff5e0b2..2f0e1d15 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/LabelActivity.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/LabelActivity.java @@ -1,8 +1,8 @@ package com.adevinta.android.barista.sample; import android.os.Bundle; -import androidx.appcompat.app.AppCompatActivity; import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; public class LabelActivity extends AppCompatActivity { diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/ListsActivity.java b/sample/src/main/java/com/adevinta/android/barista/sample/ListsActivity.java index 86910569..3031e8fd 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/ListsActivity.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/ListsActivity.java @@ -3,9 +3,6 @@ import android.content.Context; import android.content.Intent; import android.os.Bundle; -import androidx.appcompat.app.AppCompatActivity; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; @@ -14,6 +11,9 @@ import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; /** * This Activity helps testing a variety of scenarios with different ListView and RecyclerView. diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/MenuActivity.java b/sample/src/main/java/com/adevinta/android/barista/sample/MenuActivity.java index f3e92c92..6805d818 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/MenuActivity.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/MenuActivity.java @@ -1,10 +1,10 @@ package com.adevinta.android.barista.sample; import android.os.Bundle; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.widget.Toolbar; import android.view.MenuItem; import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; public class MenuActivity extends AppCompatActivity { diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/MenuSupportActionBarActivity.java b/sample/src/main/java/com/adevinta/android/barista/sample/MenuSupportActionBarActivity.java index 9ff3b1a5..a9acc0c7 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/MenuSupportActionBarActivity.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/MenuSupportActionBarActivity.java @@ -1,11 +1,11 @@ package com.adevinta.android.barista.sample; import android.os.Bundle; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; public class MenuSupportActionBarActivity extends AppCompatActivity { diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/NavigationDrawerActivity.java b/sample/src/main/java/com/adevinta/android/barista/sample/NavigationDrawerActivity.java index 24f2da6b..6ef06831 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/NavigationDrawerActivity.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/NavigationDrawerActivity.java @@ -1,14 +1,14 @@ package com.adevinta.android.barista.sample; import android.os.Bundle; +import android.view.MenuItem; +import android.view.View; import androidx.annotation.NonNull; -import com.google.android.material.navigation.NavigationView; -import androidx.core.view.GravityCompat; -import androidx.drawerlayout.widget.DrawerLayout; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; -import android.view.MenuItem; -import android.view.View; +import androidx.core.view.GravityCompat; +import androidx.drawerlayout.widget.DrawerLayout; +import com.google.android.material.navigation.NavigationView; public class NavigationDrawerActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/NestedScrollViewActivity.java b/sample/src/main/java/com/adevinta/android/barista/sample/NestedScrollViewActivity.java index a86ba661..c9abb3ff 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/NestedScrollViewActivity.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/NestedScrollViewActivity.java @@ -2,9 +2,9 @@ import android.content.Intent; import android.os.Bundle; +import android.view.View; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; -import android.view.View; public class NestedScrollViewActivity extends AppCompatActivity { @Override diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/PickersActivity.java b/sample/src/main/java/com/adevinta/android/barista/sample/PickersActivity.java index 65ca6136..49ad6612 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/PickersActivity.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/PickersActivity.java @@ -4,13 +4,13 @@ import android.app.Dialog; import android.app.TimePickerDialog; import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.fragment.app.DialogFragment; -import androidx.appcompat.app.AppCompatActivity; import android.view.View; import android.widget.DatePicker; import android.widget.TextView; import android.widget.TimePicker; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.DialogFragment; import java.util.Calendar; public class PickersActivity extends AppCompatActivity { diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/RadioButtonsActivity.java b/sample/src/main/java/com/adevinta/android/barista/sample/RadioButtonsActivity.java index 5bc68ebb..105ff9f0 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/RadioButtonsActivity.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/RadioButtonsActivity.java @@ -1,10 +1,10 @@ package com.adevinta.android.barista.sample; import android.os.Bundle; -import androidx.annotation.IdRes; -import androidx.appcompat.app.AppCompatActivity; import android.widget.RadioGroup; import android.widget.TextView; +import androidx.annotation.IdRes; +import androidx.appcompat.app.AppCompatActivity; public class RadioButtonsActivity extends AppCompatActivity { diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/RecyclerViewsInsideViewPagerActivity.java b/sample/src/main/java/com/adevinta/android/barista/sample/RecyclerViewsInsideViewPagerActivity.java index b9f07a69..1ff931f8 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/RecyclerViewsInsideViewPagerActivity.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/RecyclerViewsInsideViewPagerActivity.java @@ -3,18 +3,18 @@ import android.app.Activity; import android.content.Intent; import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentStatePagerAdapter; -import androidx.viewpager.widget.PagerAdapter; -import androidx.viewpager.widget.ViewPager; -import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; +import androidx.viewpager.widget.PagerAdapter; +import androidx.viewpager.widget.ViewPager; public class RecyclerViewsInsideViewPagerActivity extends AppCompatActivity { diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/SeekBarActivity.java b/sample/src/main/java/com/adevinta/android/barista/sample/SeekBarActivity.java index b67fad29..c7c06061 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/SeekBarActivity.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/SeekBarActivity.java @@ -1,10 +1,10 @@ package com.adevinta.android.barista.sample; import android.os.Bundle; -import androidx.appcompat.app.AppCompatActivity; import android.widget.RatingBar; import android.widget.SeekBar; import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; public class SeekBarActivity extends AppCompatActivity { @Override diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/SpinnerActivity.java b/sample/src/main/java/com/adevinta/android/barista/sample/SpinnerActivity.java index 6ddfbf81..17af307c 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/SpinnerActivity.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/SpinnerActivity.java @@ -1,9 +1,9 @@ package com.adevinta.android.barista.sample; import android.os.Bundle; -import androidx.appcompat.app.AppCompatActivity; import android.widget.ArrayAdapter; import android.widget.Spinner; +import androidx.appcompat.app.AppCompatActivity; public class SpinnerActivity extends AppCompatActivity { diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/SwipeRefreshActivity.java b/sample/src/main/java/com/adevinta/android/barista/sample/SwipeRefreshActivity.java index 1392d559..caaaeaad 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/SwipeRefreshActivity.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/SwipeRefreshActivity.java @@ -1,10 +1,10 @@ package com.adevinta.android.barista.sample; import android.os.Bundle; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import androidx.appcompat.app.AppCompatActivity; import android.view.View; import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; public class SwipeRefreshActivity extends AppCompatActivity { diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/TextRecyclerViewAdapter.java b/sample/src/main/java/com/adevinta/android/barista/sample/TextRecyclerViewAdapter.java index 4a6ec794..97fd42f6 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/TextRecyclerViewAdapter.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/TextRecyclerViewAdapter.java @@ -1,10 +1,10 @@ package com.adevinta.android.barista.sample; -import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; +import androidx.recyclerview.widget.RecyclerView; import static com.adevinta.android.barista.sample.ListsActivity.getRecyclerViewTextAt; diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/ViewPagerButtonFragment.java b/sample/src/main/java/com/adevinta/android/barista/sample/ViewPagerButtonFragment.java index 8e679326..97d24a25 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/ViewPagerButtonFragment.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/ViewPagerButtonFragment.java @@ -1,11 +1,11 @@ package com.adevinta.android.barista.sample; import android.os.Bundle; -import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; +import androidx.fragment.app.Fragment; public class ViewPagerButtonFragment extends Fragment { diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/ViewPagerFirstFragment.java b/sample/src/main/java/com/adevinta/android/barista/sample/ViewPagerFirstFragment.java index 6ec4feeb..b3dc36a6 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/ViewPagerFirstFragment.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/ViewPagerFirstFragment.java @@ -1,11 +1,11 @@ package com.adevinta.android.barista.sample; import android.os.Bundle; -import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; +import androidx.fragment.app.Fragment; public class ViewPagerFirstFragment extends Fragment { diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/ViewPagerSecondFragment.java b/sample/src/main/java/com/adevinta/android/barista/sample/ViewPagerSecondFragment.java index 9ad08eba..8c8ec1a6 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/ViewPagerSecondFragment.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/ViewPagerSecondFragment.java @@ -1,11 +1,11 @@ package com.adevinta.android.barista.sample; import android.os.Bundle; -import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; +import androidx.fragment.app.Fragment; public class ViewPagerSecondFragment extends Fragment { diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/WrappedEditTextActivity.java b/sample/src/main/java/com/adevinta/android/barista/sample/WrappedEditTextActivity.java index eeb2b8b5..417ab0ba 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/WrappedEditTextActivity.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/WrappedEditTextActivity.java @@ -4,17 +4,17 @@ import android.database.Cursor; import android.database.MatrixCursor; import android.os.Bundle; -import androidx.annotation.NonNull; -import com.google.android.material.textfield.TextInputLayout; -import androidx.cursoradapter.widget.CursorAdapter; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.widget.SearchView; import android.text.Editable; import android.text.TextWatcher; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.SearchView; +import androidx.cursoradapter.widget.CursorAdapter; +import com.google.android.material.textfield.TextInputLayout; public class WrappedEditTextActivity extends AppCompatActivity { diff --git a/sample/src/main/res/layout/activity_hintanderrortext.xml b/sample/src/main/res/layout/activity_hintanderrortext.xml index 77ce0ab1..34a9de9f 100644 --- a/sample/src/main/res/layout/activity_hintanderrortext.xml +++ b/sample/src/main/res/layout/activity_hintanderrortext.xml @@ -11,7 +11,7 @@ android:id="@+id/showErrors" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Show errrors" + android:text="Show errors" />