diff --git a/library/build.gradle.kts b/library/build.gradle.kts index bef0bc3f..ec0d73f3 100644 --- a/library/build.gradle.kts +++ b/library/build.gradle.kts @@ -22,10 +22,11 @@ android { } dependencies { - api("androidx.test.espresso:espresso-core:3.1.1") - api("androidx.test.espresso:espresso-contrib:3.1.1") + api("androidx.test.espresso:espresso-core:3.4.0") + api("androidx.test.espresso:espresso-contrib:3.4.0") api("androidx.test.uiautomator:uiautomator:2.2.0") - api("androidx.test.espresso:espresso-intents:3.1.1") + api("androidx.test.espresso:espresso-intents:3.4.0") + implementation("androidx.annotation:annotation:1.0.2") implementation("androidx.legacy:legacy-support-core-ui:1.0.0") diff --git a/library/src/main/java/com/adevinta/android/barista/rule/flaky/FlakyTestRule.kt b/library/src/main/java/com/adevinta/android/barista/rule/flaky/FlakyTestRule.kt index eb653eed..e5f97443 100644 --- a/library/src/main/java/com/adevinta/android/barista/rule/flaky/FlakyTestRule.kt +++ b/library/src/main/java/com/adevinta/android/barista/rule/flaky/FlakyTestRule.kt @@ -44,8 +44,8 @@ class FlakyTestRule : TestRule { override fun apply(base: Statement, description: Description): Statement { return flakyStatementBuilder - .setBase(base) - .setDescription(description) - .build() + .setBase(base) + .setDescription(description) + .build() } } diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index d9cd4f1c..b92fa01a 100644 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -10,7 +10,7 @@ android { compileSdk = 30 defaultConfig { - minSdk = 19 + minSdk = 21 targetSdk = 30 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" 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 89c88e95..be31a8ca 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 @@ -4,7 +4,6 @@ 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 com.adevinta.android.barista.assertion.BaristaAssertions.assertAny import com.adevinta.android.barista.interaction.BaristaEditTextInteractions.writeTo import com.adevinta.android.barista.internal.failurehandler.BaristaException @@ -15,7 +14,7 @@ import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith -@RunWith(AndroidJUnit4::class) + class AssertAnyTest { @get:Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/AssertionsTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/AssertionsTest.java index 18e8c61d..e114b10f 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/AssertionsTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/AssertionsTest.java @@ -1,13 +1,11 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.internal.failurehandler.BaristaException; import com.adevinta.android.barista.internal.util.BaristaResourceTypeException; import junit.framework.AssertionFailedError; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaAssertions.assertThatBackButtonClosesTheApp; import static com.adevinta.android.barista.assertion.BaristaBackgroundAssertions.assertHasAnyBackground; @@ -31,7 +29,6 @@ import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertNotExist; import static junit.framework.Assert.fail; -@RunWith(AndroidJUnit4.class) public class AssertionsTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/AutoCompleteTextViewTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/AutoCompleteTextViewTest.java index 85ac9c22..ae9c0274 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/AutoCompleteTextViewTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/AutoCompleteTextViewTest.java @@ -1,16 +1,13 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.interaction.BaristaAutoCompleteTextViewInteractions.writeToAutoComplete; -@RunWith(AndroidJUnit4.class) public class AutoCompleteTextViewTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/BaristaRuleActivityTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/BaristaRuleActivityTest.java index 0d82d137..b9bd4263 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/BaristaRuleActivityTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/BaristaRuleActivityTest.java @@ -1,16 +1,13 @@ package com.adevinta.android.barista.sample; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.rule.BaristaRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsNull.notNullValue; import static org.junit.Assert.assertThat; -@RunWith(AndroidJUnit4.class) public class BaristaRuleActivityTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/CameraTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/CameraTest.java index 43e5dacc..7a1f71ac 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/CameraTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/CameraTest.java @@ -1,17 +1,14 @@ package com.adevinta.android.barista.sample; import androidx.test.espresso.intent.rule.IntentsTestRule; -import androidx.test.runner.AndroidJUnit4; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaImageViewAssertions.assertHasAnyDrawable; import static com.adevinta.android.barista.assertion.BaristaImageViewAssertions.assertHasNoDrawable; import static com.adevinta.android.barista.intents.BaristaIntents.mockAndroidCamera; import static com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn; -@RunWith(AndroidJUnit4.class) public class CameraTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ChipsTest.kt b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ChipsTest.kt index 7fe47de7..0d8f6a6c 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ChipsTest.kt +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ChipsTest.kt @@ -44,7 +44,9 @@ class ChipsTest { spyFailureHandlerRule.assertEspressoFailures(1) assertThat(thrown).isInstanceOf(BaristaException::class.java) - .hasMessage("View (with id: com.adevinta.android.barista.sample:id/checkedChip) didn't match condition (not with checkbox state: is )") + .hasMessage("View (view.getId() is <${R.id.checkedChip}/com.adevinta.android.barista.sample:id/checkedChip>)" + + " didn't match condition (not (an instance of android.view.View and an instance of android.widget.Checkable)" + + " and view.isChecked() matching: is )") .hasCauseInstanceOf(AssertionFailedError::class.java) } @@ -64,7 +66,8 @@ class ChipsTest { spyFailureHandlerRule.assertEspressoFailures(1) assertThat(thrown).isInstanceOf(BaristaException::class.java) - .hasMessage("View (with id: com.adevinta.android.barista.sample:id/singleSelectionChildGroup) didn't match condition (custom condition [use `assertionDescription` parameter on `assertAny` to setup descriptive message])") + .hasMessage("View (view.getId() is <${R.id.singleSelectionChildGroup}/com.adevinta.android.barista.sample:id/singleSelectionChildGroup>)" + + " didn't match condition (custom condition [use `assertionDescription` parameter on `assertAny` to setup descriptive message])") .hasCauseInstanceOf(AssertionFailedError::class.java) } diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ClickInsideViewPagerTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ClickInsideViewPagerTest.java index 7928d33b..0b121fd5 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ClickInsideViewPagerTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ClickInsideViewPagerTest.java @@ -1,16 +1,13 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn; -@RunWith(AndroidJUnit4.class) public class ClickInsideViewPagerTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ClickTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ClickTest.java index 99a2c6c2..30ae537c 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ClickTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ClickTest.java @@ -1,17 +1,14 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.interaction.BaristaClickInteractions.clickBack; import static com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn; -@RunWith(AndroidJUnit4.class) public class ClickTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ColorsSecondaryTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ColorsSecondaryTest.java index 3b2b60aa..3c765156 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ColorsSecondaryTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ColorsSecondaryTest.java @@ -1,17 +1,14 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.internal.failurehandler.BaristaException; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertTextColorIs; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertTextColorIsNot; -@RunWith(AndroidJUnit4.class) public class ColorsSecondaryTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ColorsTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ColorsTest.java index 6193a567..d928abde 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ColorsTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ColorsTest.java @@ -2,17 +2,14 @@ import android.graphics.Color; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.internal.failurehandler.BaristaException; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertTextColorIs; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertTextColorIsNot; -@RunWith(AndroidJUnit4.class) public class ColorsTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ContentDescriptionTest.kt b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ContentDescriptionTest.kt index 5c174b26..e6480d33 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ContentDescriptionTest.kt +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ContentDescriptionTest.kt @@ -35,8 +35,8 @@ class ContentDescriptionTest { spyFailureHandlerRule.assertEspressoFailures(1) assertThat(thrown).isInstanceOf(BaristaException::class.java) - .hasMessage("View (with id: com.adevinta.android.barista.sample:id/imageGreen) " + - "didn't match condition (with content description: Image color green)") + .hasMessage("View (view.getId() is <${R.id.imageGreen}/com.adevinta.android.barista.sample:id/imageGreen>)" + + " didn't match condition (with content description: Image color green)") } @Test @@ -48,8 +48,7 @@ class ContentDescriptionTest { spyFailureHandlerRule.assertEspressoFailures(1) assertThat(thrown).isInstanceOf(BaristaException::class.java) - .hasMessage("View (with id: com.adevinta.android.barista.sample:id/imageGreen) " + - "didn't match condition (with content description)") + .hasMessage("View (view.getId() is <${R.id.imageGreen}/com.adevinta.android.barista.sample:id/imageGreen>) didn't match condition (with content description)") } @Test diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/DialogActivityTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/DialogActivityTest.java index 65628d2c..732f6185 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/DialogActivityTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/DialogActivityTest.java @@ -1,12 +1,10 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Before; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn; @@ -14,7 +12,6 @@ import static com.adevinta.android.barista.interaction.BaristaDialogInteractions.clickDialogNeutralButton; import static com.adevinta.android.barista.interaction.BaristaDialogInteractions.clickDialogPositiveButton; -@RunWith(AndroidJUnit4.class) public class DialogActivityTest { @Rule 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 2506e9df..4bf6b759 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 @@ -2,11 +2,9 @@ import androidx.core.view.GravityCompat; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaDrawerAssertions.assertDrawerIsClosed; import static com.adevinta.android.barista.assertion.BaristaDrawerAssertions.assertDrawerIsClosedWithGravity; @@ -19,7 +17,6 @@ import static com.adevinta.android.barista.interaction.BaristaDrawerInteractions.openDrawer; import static com.adevinta.android.barista.interaction.BaristaDrawerInteractions.openDrawerWithGravity; -@RunWith(AndroidJUnit4.class) public class DrawerActivityTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/EditTextTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/EditTextTest.java index ac400910..9c2b3670 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/EditTextTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/EditTextTest.java @@ -1,11 +1,9 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaHintAssertions.assertHint; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; @@ -13,7 +11,6 @@ import static com.adevinta.android.barista.interaction.BaristaEditTextInteractions.typeTo; import static com.adevinta.android.barista.interaction.BaristaEditTextInteractions.writeTo; -@RunWith(AndroidJUnit4.class) public class EditTextTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/FailureHandlerTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/FailureHandlerTest.java index e64391a0..1675630e 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/FailureHandlerTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/FailureHandlerTest.java @@ -51,6 +51,6 @@ public void baseFailureHandlerCalledOnce_withEspresso() throws Exception { } private void assertBaseHandlerCalledOnce() { - assertEquals(1, baseFailureHandler.getCapturedFailures().size()); + assertEquals(1, baseFailureHandler.getCapturedFailuresCount()); } } diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/HelperTextTest.kt b/sample/src/androidTest/java/com/adevinta/android/barista/sample/HelperTextTest.kt index 8914ef87..acf39248 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/HelperTextTest.kt +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/HelperTextTest.kt @@ -7,7 +7,7 @@ import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith -@RunWith(AndroidJUnit4::class) + class HelperTextTest { @get:Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/HintAndErrorTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/HintAndErrorTest.java index 9691bfe3..7d19907f 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/HintAndErrorTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/HintAndErrorTest.java @@ -1,18 +1,15 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.internal.failurehandler.BaristaException; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaErrorAssertions.assertErrorDisplayed; import static com.adevinta.android.barista.assertion.BaristaErrorAssertions.assertNoErrorDisplayed; import static com.adevinta.android.barista.assertion.BaristaHintAssertions.assertHint; import static com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn; -@RunWith(AndroidJUnit4.class) public class HintAndErrorTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/KeyboardTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/KeyboardTest.java index e507c160..9291b714 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/KeyboardTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/KeyboardTest.java @@ -1,17 +1,14 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertNotExist; import static com.adevinta.android.barista.interaction.BaristaKeyboardInteractions.pressImeActionButton; -@RunWith(AndroidJUnit4.class) public class KeyboardTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ListViewAssertionTest.kt b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ListViewAssertionTest.kt index 766e6fb3..225093c8 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ListViewAssertionTest.kt +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ListViewAssertionTest.kt @@ -17,7 +17,7 @@ import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith -@RunWith(AndroidJUnit4::class) + class ListViewAssertionTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ListViewWithDifferentDataInsideViewPagerTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ListViewWithDifferentDataInsideViewPagerTest.java index 3eb02284..90fd753a 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ListViewWithDifferentDataInsideViewPagerTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ListViewWithDifferentDataInsideViewPagerTest.java @@ -1,17 +1,14 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaListAssertions.assertDisplayedAtPosition; import static com.adevinta.android.barista.interaction.BaristaSleepInteractions.sleep; import static com.adevinta.android.barista.interaction.BaristaViewPagerInteractions.swipeViewPagerBack; import static com.adevinta.android.barista.interaction.BaristaViewPagerInteractions.swipeViewPagerForward; -@RunWith(AndroidJUnit4.class) public class ListViewWithDifferentDataInsideViewPagerTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ListsChildClickTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ListsChildClickTest.java index a7270c39..bd27b7e2 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ListsChildClickTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ListsChildClickTest.java @@ -3,12 +3,10 @@ import androidx.test.core.app.ApplicationProvider; import androidx.test.espresso.PerformException; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.internal.failurehandler.BaristaException; 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.Espresso.onView; import static androidx.test.espresso.assertion.ViewAssertions.matches; @@ -19,7 +17,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; -@RunWith(AndroidJUnit4.class) public class ListsChildClickTest { @Rule @@ -113,7 +110,7 @@ public void fails_whenRecyclerChildNotExist() { .hasMessageContaining("Could not perform action (actionOnItemAtPosition performing ViewAction: Click on a child view ") .hasMessageContaining("on item at position: 20) on RecyclerView") .hasCauseInstanceOf(PerformException.class) - .hasStackTraceContaining("Didn't find any view with id"); + .hasStackTraceContaining("Didn't find any view view.getId()"); } @Test diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ListsClickTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ListsClickTest.java index 8fdfd6fd..99174ff3 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ListsClickTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ListsClickTest.java @@ -2,12 +2,10 @@ import androidx.test.core.app.ApplicationProvider; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.internal.failurehandler.BaristaException; 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.Espresso.onView; import static androidx.test.espresso.assertion.ViewAssertions.matches; @@ -20,7 +18,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; -@RunWith(AndroidJUnit4.class) public class ListsClickTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ListsScrollTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ListsScrollTest.java index 5309929b..1c21e278 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ListsScrollTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ListsScrollTest.java @@ -2,11 +2,9 @@ import androidx.test.core.app.ApplicationProvider; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertNotExist; @@ -14,7 +12,6 @@ import static com.adevinta.android.barista.sample.ListsActivity.FRUITS; import static com.adevinta.android.barista.sample.ListsActivity.IntentBuilder; -@RunWith(AndroidJUnit4.class) public class ListsScrollTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/LongClickTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/LongClickTest.java index 160c4653..36137e44 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/LongClickTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/LongClickTest.java @@ -1,15 +1,12 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.interaction.BaristaClickInteractions.longClickOn; -@RunWith(AndroidJUnit4.class) public class LongClickTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/MenuClickTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/MenuClickTest.java index c680c2b0..44b81fbe 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/MenuClickTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/MenuClickTest.java @@ -2,18 +2,15 @@ import androidx.test.filters.FlakyTest; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.internal.failurehandler.BaristaException; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.interaction.BaristaMenuClickInteractions.clickMenu; import static com.adevinta.android.barista.interaction.BaristaMenuClickInteractions.openMenu; -@RunWith(AndroidJUnit4.class) public class MenuClickTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/MenuSupportActionBarClickTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/MenuSupportActionBarClickTest.java index 37f0288e..fc7d302a 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/MenuSupportActionBarClickTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/MenuSupportActionBarClickTest.java @@ -1,16 +1,13 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.interaction.BaristaMenuClickInteractions.clickMenu; -@RunWith(AndroidJUnit4.class) public class MenuSupportActionBarClickTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/NestedScrollClickTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/NestedScrollClickTest.java index abd24e4e..124bcbaf 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/NestedScrollClickTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/NestedScrollClickTest.java @@ -1,16 +1,13 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn; -@RunWith(AndroidJUnit4.class) public class NestedScrollClickTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/NestedScrollViewTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/NestedScrollViewTest.java index 633b2333..0c0fe4f3 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/NestedScrollViewTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/NestedScrollViewTest.java @@ -1,17 +1,14 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertNotDisplayed; import static com.adevinta.android.barista.interaction.BaristaScrollInteractions.scrollTo; -@RunWith(AndroidJUnit4.class) public class NestedScrollViewTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/PartiallyVisibleViewPagerTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/PartiallyVisibleViewPagerTest.java index df9ea1e0..395ffa11 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/PartiallyVisibleViewPagerTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/PartiallyVisibleViewPagerTest.java @@ -1,17 +1,14 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertNotDisplayed; import static com.adevinta.android.barista.interaction.BaristaViewPagerInteractions.swipeViewPagerBack; import static com.adevinta.android.barista.interaction.BaristaViewPagerInteractions.swipeViewPagerForward; -@RunWith(AndroidJUnit4.class) public class PartiallyVisibleViewPagerTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/PickersActivityTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/PickersActivityTest.java index 78598eb8..ceab8e06 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/PickersActivityTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/PickersActivityTest.java @@ -1,18 +1,15 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn; import static com.adevinta.android.barista.interaction.BaristaPickerInteractions.setDateOnPicker; import static com.adevinta.android.barista.interaction.BaristaPickerInteractions.setTimeOnPicker; -@RunWith(AndroidJUnit4.class) public class PickersActivityTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ProgressBarMatchersTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ProgressBarMatchersTest.java index cb0c0144..1993fda3 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ProgressBarMatchersTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ProgressBarMatchersTest.java @@ -1,17 +1,14 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import junit.framework.AssertionFailedError; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaProgressBarAssertions.assertProgress; import static com.adevinta.android.barista.assertion.BaristaProgressBarAssertions.assertProgressIsMax; import static com.adevinta.android.barista.assertion.BaristaProgressBarAssertions.assertProgressIsMin; -@RunWith(AndroidJUnit4.class) public class ProgressBarMatchersTest { @Rule public ActivityTestRule activityRule = diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/RadioButtonsReallyFarAwayTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/RadioButtonsReallyFarAwayTest.java index 88e1ac8e..5daf08f5 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/RadioButtonsReallyFarAwayTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/RadioButtonsReallyFarAwayTest.java @@ -1,18 +1,15 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertNotDisplayed; import static com.adevinta.android.barista.interaction.BaristaRadioButtonInteractions.clickRadioButtonItem; import static com.adevinta.android.barista.interaction.BaristaRadioButtonInteractions.clickRadioButtonPosition; -@RunWith(AndroidJUnit4.class) public class RadioButtonsReallyFarAwayTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/RadioButtonsTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/RadioButtonsTest.java index d44c7dc5..93fa599b 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/RadioButtonsTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/RadioButtonsTest.java @@ -1,17 +1,14 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.interaction.BaristaRadioButtonInteractions.clickRadioButtonItem; import static com.adevinta.android.barista.interaction.BaristaRadioButtonInteractions.clickRadioButtonPosition; -@RunWith(AndroidJUnit4.class) public class RadioButtonsTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/RecyclerViewInsideViewPagerTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/RecyclerViewInsideViewPagerTest.java index 5cf4a081..7cb6046b 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/RecyclerViewInsideViewPagerTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/RecyclerViewInsideViewPagerTest.java @@ -1,18 +1,15 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.interaction.BaristaListInteractions.clickListItem; import static com.adevinta.android.barista.interaction.BaristaListInteractions.clickListItemChild; import static com.adevinta.android.barista.interaction.BaristaListInteractions.scrollListToPosition; -@RunWith(AndroidJUnit4.class) public class RecyclerViewInsideViewPagerTest { private static int POSITION_AT_LAST_PAGE = 60; diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/RecyclerViewWithDifferentDataInsideViewPagerTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/RecyclerViewWithDifferentDataInsideViewPagerTest.java index 39efadb4..1fbbde52 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/RecyclerViewWithDifferentDataInsideViewPagerTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/RecyclerViewWithDifferentDataInsideViewPagerTest.java @@ -1,18 +1,14 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; - import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaListAssertions.assertDisplayedAtPosition; import static com.adevinta.android.barista.interaction.BaristaSleepInteractions.sleep; import static com.adevinta.android.barista.interaction.BaristaViewPagerInteractions.swipeViewPagerBack; import static com.adevinta.android.barista.interaction.BaristaViewPagerInteractions.swipeViewPagerForward; -@RunWith(AndroidJUnit4.class) public class RecyclerViewWithDifferentDataInsideViewPagerTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ScrollsTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ScrollsTest.java index f0c41055..bfb3d180 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ScrollsTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ScrollsTest.java @@ -1,12 +1,10 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.internal.failurehandler.BaristaException; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static androidx.test.espresso.matcher.ViewMatchers.withId; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; @@ -14,7 +12,6 @@ import static com.adevinta.android.barista.interaction.BaristaScrollInteractions.safelyScrollTo; import static com.adevinta.android.barista.interaction.BaristaScrollInteractions.scrollTo; -@RunWith(AndroidJUnit4.class) public class ScrollsTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/SeekBarTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/SeekBarTest.java index b9f24694..d84c3f66 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/SeekBarTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/SeekBarTest.java @@ -1,11 +1,9 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.interaction.BaristaRatingBarInteractions.setRatingTo; @@ -15,7 +13,6 @@ import static com.adevinta.android.barista.interaction.BaristaSeekBarInteractions.setProgressToMax; import static com.adevinta.android.barista.interaction.BaristaSeekBarInteractions.setProgressToMin; -@RunWith(AndroidJUnit4.class) public class SeekBarTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/SleepTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/SleepTest.java index 2219199f..50774e4e 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/SleepTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/SleepTest.java @@ -1,17 +1,14 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.interaction.BaristaSleepInteractions; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import java.util.concurrent.TimeUnit; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static junit.framework.Assert.assertTrue; -@RunWith(AndroidJUnit4.class) public class SleepTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/SpinnerTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/SpinnerTest.java index 12007645..4078ca4a 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/SpinnerTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/SpinnerTest.java @@ -1,16 +1,13 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.interaction.BaristaSpinnerInteractions.clickSpinnerItem; -@RunWith(AndroidJUnit4.class) public class SpinnerTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/SwipeRefreshTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/SwipeRefreshTest.java index 06d6ace5..499a6db2 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/SwipeRefreshTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/SwipeRefreshTest.java @@ -1,15 +1,12 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.interaction.BaristaSwipeRefreshInteractions.refresh; -@RunWith(AndroidJUnit4.class) public class SwipeRefreshTest { @Rule public ActivityTestRule activityRule = diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ViewPagerTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ViewPagerTest.java index 3c128d20..e1a03bd2 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ViewPagerTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ViewPagerTest.java @@ -1,16 +1,13 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.interaction.BaristaViewPagerInteractions.swipeViewPagerBack; import static com.adevinta.android.barista.interaction.BaristaViewPagerInteractions.swipeViewPagerForward; -@RunWith(AndroidJUnit4.class) public class ViewPagerTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ViewPagerWithoutIdTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ViewPagerWithoutIdTest.java index c2ad34ce..747a42d8 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/ViewPagerWithoutIdTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/ViewPagerWithoutIdTest.java @@ -1,16 +1,13 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.interaction.BaristaViewPagerInteractions.swipeViewPagerBack; import static com.adevinta.android.barista.interaction.BaristaViewPagerInteractions.swipeViewPagerForward; -@RunWith(AndroidJUnit4.class) public class ViewPagerWithoutIdTest { @Rule diff --git a/sample/src/androidTest/java/com/adevinta/android/barista/sample/WrappedEditTextWriteTest.java b/sample/src/androidTest/java/com/adevinta/android/barista/sample/WrappedEditTextWriteTest.java index 2fb5a38b..398853fa 100644 --- a/sample/src/androidTest/java/com/adevinta/android/barista/sample/WrappedEditTextWriteTest.java +++ b/sample/src/androidTest/java/com/adevinta/android/barista/sample/WrappedEditTextWriteTest.java @@ -1,17 +1,14 @@ package com.adevinta.android.barista.sample; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import com.adevinta.android.barista.sample.util.FailureHandlerValidatorRule; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; import static com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed; import static com.adevinta.android.barista.interaction.BaristaAutoCompleteTextViewInteractions.writeToAutoComplete; import static com.adevinta.android.barista.interaction.BaristaEditTextInteractions.writeTo; -@RunWith(AndroidJUnit4.class) public class WrappedEditTextWriteTest { @Rule 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 760d3ffb..8386a756 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 @@ -52,20 +52,27 @@ public void checkNotDisplayed_withGoneView() { public void checkDisplayedViews_failsWhenInvisible() { Throwable thrown1 = catchThrowable(() -> assertDisplayed(R.id.invisible_view)); assertThat(thrown1).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)"); + .hasMessage("View (view.getId() is <" + R.id.invisible_view + "/com.adevinta.android.barista.sample:id/invisible_view>) " + + "didn't match condition ((view has effective visibility and view.getGlobalVisibleRect()" + + " to return non-empty rectangle))"); Throwable thrown2 = catchThrowable(() -> assertDisplayed(R.string.im_invisible)); // test fails assertThat(thrown2).isInstanceOf(BaristaException.class) - .hasMessageMatching("View \\(with string from resource id: <(\\d+)>\\[im_invisible\\] value: I'm invisible!\\) " - + "didn't match condition \\(is displayed on the screen to the user\\)"); + .hasMessage("View (an instance of android.widget.TextView and view.getText() equals string from" + + + " resource id: <" + + R.string.im_invisible + + "> [im_invisible] value: I'm invisible!) didn't match condition ((view has effective visibility and view.getGlobalVisibleRect() to return non-empty rectangle))"); Throwable thrown3 = catchThrowable(() -> assertDisplayed("I'm invisible!")); assertThat(thrown3).isInstanceOf(BaristaException.class) - .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)"); + .hasMessage("View ((an instance of android.widget.TextView and view.getText() with or" + + " without transformation to match: is \"I'm invisible!\" or (view.getParent()" + + " is assignable from class " + + " and (view is an instance of android.view.ViewGroup and has descendant matching an instance" + + " of android.widget.TextView and view.getText() with or without transformation to match: is \"I'm invisible!\")))) " + + "didn't match condition ((view has effective visibility and view.getGlobalVisibleRect()" + + " to return non-empty rectangle))"); spyFailureHandlerRule.assertEspressoFailures(3); } @@ -74,17 +81,20 @@ public void checkDisplayedViews_failsWhenInvisible() { public void checkDisplayed_failsWhenNotExists() { Throwable thrown = catchThrowable(() -> assertDisplayed(R.id.no)); assertThat(thrown).isInstanceOf(BaristaException.class) - .hasMessageContaining("No view matching (with id: com.adevinta.android.barista.sample:id/no) was found"); + .hasMessageContaining("No view matching (view.getId() is <" + R.id.no + "/com.adevinta.android.barista.sample:id/no>) was found"); Throwable thrown2 = catchThrowable(() -> assertDisplayed(R.string.not_exists)); assertThat(thrown2).isInstanceOf(BaristaException.class) - .hasMessageMatching("No view matching \\(with string from resource id: <(\\d+)>\\[not_exists\\] value: Not exists\\) was found"); + .hasMessage("No view matching (an instance of android.widget.TextView and view.getText() " + + "equals string from resource id: <" + R.string.not_exists + "> [not_exists] value: Not exists) was found"); Throwable thrown3 = catchThrowable(() -> assertDisplayed("Not exists")); assertThat(thrown3).isInstanceOf(BaristaException.class) - .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"); + .hasMessage("No view matching ((an instance of android.widget.TextView and view.getText()" + + " with or without transformation to match: is \"Not exists\" or" + + " (view.getParent() is assignable from class " + + " and (view is an instance of android.view.ViewGroup and has descendant matching an instance of android.widget.TextView" + + " and view.getText() with or without transformation to match: is \"Not exists\")))) was found"); spyFailureHandlerRule.assertEspressoFailures(3); } @@ -101,16 +111,26 @@ public void checkDisplayedIdAndText() { public void checkDisplayedIdAndText_failsWhenTextIsNotTheExpected() { Throwable thrown = catchThrowable(() -> assertDisplayed(R.id.visible_view, R.string.not_exists)); assertThat(thrown).isInstanceOf(BaristaException.class) - .hasMessageMatching("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 string from resource id: <(\\d+)>\\[not_exists\\] value: Not exists\\)\\)"); + .hasMessage("View (view.getId() is <" + + R.id.visible_view + + "/com.adevinta.android.barista.sample:id/visible_view>) didn't match condition (((view has effective visibility " + + + " and view.getGlobalVisibleRect() to return non-empty rectangle) and an instance of android.widget.TextView and view.getText()" + + + " equals string from resource id: <" + + R.string.not_exists + + "> [not_exists] value: Not exists))"); 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\" " - + "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\"))))"); + .hasMessage("View (view.getId() is <" + R.id.visible_view + "/com.adevinta.android.barista.sample:id/visible_view>)" + + " didn't match condition (((view has effective visibility and view.getGlobalVisibleRect()" + + " to return non-empty rectangle) and (an instance of android.widget.TextView and view.getText()" + + " with or without transformation to match: is \"This is not the text you are looking for\"" + + " or (view.getParent() is assignable from class " + + " and (view is an instance of android.view.ViewGroup and has descendant matching an " + + "instance of android.widget.TextView and view.getText() with or without transformation to match:" + + " is \"This is not the text you are looking for\")))))"); spyFailureHandlerRule.assertEspressoFailures(2); } @@ -119,15 +139,20 @@ public void checkDisplayedIdAndText_failsWhenTextIsNotTheExpected() { public void checkDisplayedIdAndText_failsWhenInvisible() { Throwable thrown = catchThrowable(() -> assertDisplayed(R.id.invisible_view, R.string.im_invisible)); assertThat(thrown).isInstanceOf(BaristaException.class) - .hasMessageMatching("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 string from resource id: <(\\d+)>\\)\\)"); + .hasMessage("View (view.getId() is <" + R.id.invisible_view + "/com.adevinta.android.barista.sample:id/invisible_view>)" + + " didn't match condition (((view has effective visibility and view.getGlobalVisibleRect()" + + " to return non-empty rectangle) and an instance of android.widget.TextView and view.getText() " + + "equals string from resource id: <" + R.string.im_invisible + ">))"); 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!\" " - + "or (has parent matching: is assignable from class: class com.google.android.material.textfield.TextInputLayout " - + "and has descendant: with text: is \"I'm invisible!\"))))"); + .hasMessage("View (view.getId() is <" + R.id.invisible_view + "/com.adevinta.android.barista.sample:id/invisible_view>)" + + " didn't match condition (((view has effective visibility and view.getGlobalVisibleRect()" + + " to return non-empty rectangle) and (an instance of android.widget.TextView and view.getText()" + + " with or without transformation to match: is \"I'm invisible!\"" + + " or (view.getParent() is assignable from class " + + " and (view is an instance of android.view.ViewGroup and has descendant matching an instance" + + " of android.widget.TextView and view.getText() with or without transformation to match: is \"I'm invisible!\")))))"); spyFailureHandlerRule.assertEspressoFailures(2); } @@ -136,11 +161,13 @@ public void checkDisplayedIdAndText_failsWhenInvisible() { public void checkDisplayedIdAndText_failsWhenViewDoesNotExist() { Throwable thrown = catchThrowable(() -> assertDisplayed(R.id.not_exists, R.string.im_invisible)); assertThat(thrown).isInstanceOf(BaristaException.class) - .hasMessage("No view matching (with id: com.adevinta.android.barista.sample:id/not_exists) was found"); + .hasMessage("No view matching (view.getId() is <" + R.id.not_exists + + "/com.adevinta.android.barista.sample:id/not_exists>) was found"); Throwable thrown2 = catchThrowable(() -> assertDisplayed(R.id.not_exists, "This is not the text you are looking for")); assertThat(thrown2).isInstanceOf(BaristaException.class) - .hasMessage("No view matching (with id: com.adevinta.android.barista.sample:id/not_exists) was found"); + .hasMessage( + "No view matching (view.getId() is <" + R.id.not_exists + "/com.adevinta.android.barista.sample:id/not_exists>) was found"); spyFailureHandlerRule.assertEspressoFailures(2); } @@ -169,10 +196,13 @@ 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!\" " - + "or (has parent matching: is assignable from class: class com.google.android.material.textfield.TextInputLayout " - + "and has descendant: with text: is \"Hello world!\"))))"); + .hasMessage("View (view.getId() is <" + R.id.visible_view + "/com.adevinta.android.barista.sample:id/visible_view>)" + + " didn't match condition (not ((view has effective visibility and view.getGlobalVisibleRect()" + + " to return non-empty rectangle) and (an instance of android.widget.TextView and view.getText()" + + " with or without transformation to match: is \"Hello world!\" or" + + " (view.getParent() is assignable from class " + + " and (view is an instance of android.view.ViewGroup and has descendant matching an instance of" + + " android.widget.TextView and view.getText() with or without transformation to match: is \"Hello world!\")))))"); } @Test @@ -181,8 +211,9 @@ public void checkNotDisplayed_failsWhenVisible() { 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)"); + .hasMessage("View (view.getId() is <" + R.id.visible_view + "/com.adevinta.android.barista.sample:id/visible_view>)" + + " didn't match condition (not (view has effective visibility and view.getGlobalVisibleRect()" + + " to return non-empty rectangle))"); } @Test @@ -211,7 +242,7 @@ public void assertVisibleWithCustomMatcher_Fails_WhenTheMatcherDoesNotFindTheGiv spyFailureHandlerRule.assertEspressoFailures(1); assertThat(thrown).isInstanceOf(BaristaException.class) - .hasMessage("No view matching (with tag value: is \"notPresentTagValue\") was found"); + .hasMessage("No view matching (view.getTag() is \"notPresentTagValue\") was found"); } @Test @@ -222,7 +253,8 @@ public void assertVisibleWithCustomMatcher_Fails_WhenTheMatcherDoesFindTheGivenP spyFailureHandlerRule.assertEspressoFailures(1); assertThat(thrown).isInstanceOf(BaristaException.class) - .hasMessage("View (with tag value: is \"presentTagValueHidden\") didn't match condition (is displayed on the screen to the user)"); + .hasMessage( + "View (view.getTag() is \"presentTagValueHidden\") didn't match condition ((view has effective visibility and view.getGlobalVisibleRect() to return non-empty rectangle))"); } @Test @@ -243,7 +275,7 @@ public void assertNotVisibleWithCustomMatcher_Fails_WhenTheMatcherDoesNotFindThe spyFailureHandlerRule.assertEspressoFailures(1); assertThat(thrown).isInstanceOf(BaristaException.class) - .hasMessage("No view matching (with tag value: is \"notPresentTagValue\") was found"); + .hasMessage("No view matching (view.getTag() is \"notPresentTagValue\") was found"); } @Test @@ -264,7 +296,8 @@ public void assertVisibleWithCustomMatcher_Fails_WhenTheMatcherMatchesAViewThatI spyFailureHandlerRule.assertEspressoFailures(1); String expectedMessage = - "View (with tag value: is \"presentTagValue\") didn't match condition (not is displayed on the screen to the user)"; + "View (view.getTag() is \"presentTagValue\") didn't match condition" + + " (not (view has effective visibility and view.getGlobalVisibleRect() to return non-empty rectangle))"; assertThat(thrown).isInstanceOf(BaristaException.class).hasMessage(expectedMessage); } } diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/ListViewsWithDifferentDataInsideViewPagerActivity.java b/sample/src/main/java/com/adevinta/android/barista/sample/ListViewsWithDifferentDataInsideViewPagerActivity.java index c62c6577..d3633d53 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/ListViewsWithDifferentDataInsideViewPagerActivity.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/ListViewsWithDifferentDataInsideViewPagerActivity.java @@ -7,7 +7,6 @@ import android.widget.ArrayAdapter; import android.widget.LinearLayout; import android.widget.ListView; - import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; @@ -25,15 +24,18 @@ public class ListViewsWithDifferentDataInsideViewPagerActivity extends AppCompat "Cranberry", "Cucumber", "Custardapple", "Damson", "Date", "Dragonfruit", "Durian", "Elderberry", "Feijoa", "Fig", "Gojiberry", "Gooseberry", "Grape", "Raisin", "Grapefruit", "Guava", "Honeyberry", "Huckleberry", "Jabuticaba", "Jackfruit", "Jambul", "Jujube", - "Juniperberry", "Kiwifruit", "Kumquat", "Lemon", "Lime", "Loquat", "Longan", "Lychee"}; + "Juniperberry", "Kiwifruit", "Kumquat", "Lemon", "Lime", "Loquat", "Longan", "Lychee" + }; - private static final String[] FRUIT_LIST_TWO = {"Mango", "Marionberry", "Melon", "Cantaloupe", "Honeydew", "Watermelon", "Miraclefruit", + private static final String[] FRUIT_LIST_TWO = { + "Mango", "Marionberry", "Melon", "Cantaloupe", "Honeydew", "Watermelon", "Miraclefruit", "Mulberry", "Nectarine", "Nance", "Olive", "Orange", "Bloodorange", "Clementine", "Mandarine", "Tangerine", "Papaya", "Passionfruit", "Peach", "Pear", "Persimmon", "Physalis", "Plantain", "Plum", "Prune(driedplum)", "Pineapple", "Plumcot(orPluot)", "Pomegranate", "Pomelo", "Purplemangosteen", "Quince", "Raspberry", "Salmonberry", "Rambutan", "Redcurrant", "Salalberry", "Salak", "Satsuma", "Starfruit", "Solanumquitoense", "Strawberry", "Tamarillo", - "Tamarind", "Uglifruit", "Yuzu"}; + "Tamarind", "Uglifruit", "Yuzu" + }; @Override protected void onCreate(Bundle savedInstanceState) { diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/RecyclerViewsWithDifferentDataInsideViewPagerActivity.java b/sample/src/main/java/com/adevinta/android/barista/sample/RecyclerViewsWithDifferentDataInsideViewPagerActivity.java index 9911a140..a20b9d78 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/RecyclerViewsWithDifferentDataInsideViewPagerActivity.java +++ b/sample/src/main/java/com/adevinta/android/barista/sample/RecyclerViewsWithDifferentDataInsideViewPagerActivity.java @@ -7,7 +7,6 @@ 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; @@ -27,15 +26,18 @@ public class RecyclerViewsWithDifferentDataInsideViewPagerActivity extends AppCo "Cranberry", "Cucumber", "Custardapple", "Damson", "Date", "Dragonfruit", "Durian", "Elderberry", "Feijoa", "Fig", "Gojiberry", "Gooseberry", "Grape", "Raisin", "Grapefruit", "Guava", "Honeyberry", "Huckleberry", "Jabuticaba", "Jackfruit", "Jambul", "Jujube", - "Juniperberry", "Kiwifruit", "Kumquat", "Lemon", "Lime", "Loquat", "Longan", "Lychee"}; + "Juniperberry", "Kiwifruit", "Kumquat", "Lemon", "Lime", "Loquat", "Longan", "Lychee" + }; - private static final String[] FRUIT_LIST_TWO = {"Mango", "Marionberry", "Melon", "Cantaloupe", "Honeydew", "Watermelon", "Miraclefruit", + private static final String[] FRUIT_LIST_TWO = { + "Mango", "Marionberry", "Melon", "Cantaloupe", "Honeydew", "Watermelon", "Miraclefruit", "Mulberry", "Nectarine", "Nance", "Olive", "Orange", "Bloodorange", "Clementine", "Mandarine", "Tangerine", "Papaya", "Passionfruit", "Peach", "Pear", "Persimmon", "Physalis", "Plantain", "Plum", "Prune(driedplum)", "Pineapple", "Plumcot(orPluot)", "Pomegranate", "Pomelo", "Purplemangosteen", "Quince", "Raspberry", "Salmonberry", "Rambutan", "Redcurrant", "Salalberry", "Salak", "Satsuma", "Starfruit", "Solanumquitoense", "Strawberry", "Tamarillo", - "Tamarind", "Uglifruit", "Yuzu"}; + "Tamarind", "Uglifruit", "Yuzu" + }; @Override protected void onCreate(Bundle savedInstanceState) { @@ -73,7 +75,7 @@ public ScreenSlidePageFragment(int position) { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { + Bundle savedInstanceState) { ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.activity_recyclerview, container, false); diff --git a/sample/src/main/java/com/adevinta/android/barista/sample/widget/SampleCustomView.kt b/sample/src/main/java/com/adevinta/android/barista/sample/widget/SampleCustomView.kt index d7235363..f427b3b1 100644 --- a/sample/src/main/java/com/adevinta/android/barista/sample/widget/SampleCustomView.kt +++ b/sample/src/main/java/com/adevinta/android/barista/sample/widget/SampleCustomView.kt @@ -11,20 +11,20 @@ import kotlinx.android.synthetic.main.sample_custom_view.view.customTextView class SampleCustomView @JvmOverloads constructor( - context: Context, - attributeSet: AttributeSet? = null, - defStyleAttr: Int = R.attr.sampleCustomViewStyle, - defStyleRes: Int = R.style.SampleCustomStyle + context: Context, + attributeSet: AttributeSet? = null, + defStyleAttr: Int = R.attr.sampleCustomViewStyle, + defStyleRes: Int = R.style.SampleCustomStyle ) : LinearLayout(context, attributeSet, defStyleAttr) { private var customColor: Int = Color.GRAY init { context.withStyledAttributes( - attributeSet, - R.styleable.SampleCustomView, - defStyleAttr, - defStyleRes + attributeSet, + R.styleable.SampleCustomView, + defStyleAttr, + defStyleRes ) { customColor = getColor(R.styleable.SampleCustomView_customColor, customColor) }