Fix broken TrackList UI tests

This commit is contained in:
Leon Marz
2023-09-24 12:47:36 +02:00
committed by Dennis Guse
parent b5e88b3e05
commit f4cec0a8b2
2 changed files with 6 additions and 2 deletions
@@ -8,6 +8,8 @@ import static androidx.test.espresso.action.ViewActions.longClick;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withContentDescription;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withParent;
import static androidx.test.espresso.matcher.ViewMatchers.withParentIndex;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.anything;
@@ -49,7 +51,7 @@ public class EspressoDeleteTrackTest {
onView(withId(R.id.finish_button)).perform(click());
// select track
onData(anything()).inAdapterView(withId(R.id.track_list)).atPosition(0).perform(longClick());
onView(allOf(withParent(withId(R.id.track_list)), withParentIndex(0))).perform(longClick());
// open menu and delete selected track
//TODO openActionBarOverflowOrOptionsMenu(); doesn't work
@@ -8,6 +8,8 @@ import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.isClickable;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withParent;
import static androidx.test.espresso.matcher.ViewMatchers.withParentIndex;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.anything;
import static de.dennisguse.opentracks.util.EspressoUtils.selectTabAtIndex;
@@ -95,6 +97,6 @@ public class EspressoUITest {
@Test
public void selectAndDeleteTrack() {
onView(withId(R.id.track_list)).check(matches(isDisplayed()));
onData(anything()).inAdapterView(withId(R.id.track_list)).atPosition(0).perform(longClick());
onView(allOf(withParent(withId(R.id.track_list)), withParentIndex(0))).perform(longClick());
}
}