From 7e06f6d1228e0a867d3b4a051d9f6ba155c3f5c3 Mon Sep 17 00:00:00 2001 From: Grzegorz Orczykowski Date: Fri, 3 Feb 2023 19:51:14 +0100 Subject: [PATCH] Fixed IntentGroupTest --- .../collect/android/feature/formentry/IntentGroupTest.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/collect_app/src/androidTest/java/org/odk/collect/android/feature/formentry/IntentGroupTest.java b/collect_app/src/androidTest/java/org/odk/collect/android/feature/formentry/IntentGroupTest.java index b9ce5e55e40..98ec789beed 100644 --- a/collect_app/src/androidTest/java/org/odk/collect/android/feature/formentry/IntentGroupTest.java +++ b/collect_app/src/androidTest/java/org/odk/collect/android/feature/formentry/IntentGroupTest.java @@ -26,9 +26,11 @@ import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; import static androidx.test.espresso.matcher.ViewMatchers.isEnabled; import static androidx.test.espresso.matcher.ViewMatchers.withClassName; +import static androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility; import static androidx.test.espresso.matcher.ViewMatchers.withId; import static androidx.test.espresso.matcher.ViewMatchers.withTagValue; import static androidx.test.espresso.matcher.ViewMatchers.withText; +import static org.hamcrest.CoreMatchers.allOf; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.Matchers.is; import static org.hamcrest.core.StringEndsWith.endsWith; @@ -47,6 +49,7 @@ import androidx.core.content.FileProvider; import androidx.test.core.app.ApplicationProvider; +import androidx.test.espresso.matcher.ViewMatchers; import org.junit.Rule; import org.junit.Test; @@ -204,7 +207,7 @@ public void collect_shouldNotCrashWhenAnyErrorIsThrownWhileReceivingAnswer() { } private void assertImageWidgetWithoutAnswer() { - onView(withTagValue(is("ImageView"))).check(doesNotExist()); + onView(allOf(withTagValue(is("ImageView")), withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))).check(doesNotExist()); onView(withId(R.id.capture_image)).check(doesNotExist()); onView(withId(R.id.choose_image)).check(doesNotExist()); } @@ -223,7 +226,7 @@ private void assertFileWidgetWithoutAnswer() { } private void assertImageWidgetWithAnswer() { - onView(withTagValue(is("ImageView"))).perform(scrollTo()).check(matches(isDisplayed())); + onView(allOf(withTagValue(is("ImageView")), withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))).check(matches(not(doesNotExist()))); onView(withId(R.id.capture_image)).check(doesNotExist()); onView(withId(R.id.choose_image)).check(doesNotExist()); }