Skip to content

Commit

Permalink
Fix broken TrackList UI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lmarz authored and dennisguse committed Sep 26, 2023
1 parent b5e88b3 commit f4cec0a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
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;
Expand Down Expand Up @@ -49,7 +51,7 @@ public void 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
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;
Expand Down Expand Up @@ -95,6 +97,6 @@ public void record_move_through_tabs() {
@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());
}
}

0 comments on commit f4cec0a

Please sign in to comment.