[FIXED] tests things
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
package com.a1.nextlocation;
|
||||
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
|
||||
import com.a1.nextlocation.fragments.CouponFragment;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.action.ViewActions.click;
|
||||
import static androidx.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
|
||||
public class LocationDetailFragment {
|
||||
@Rule
|
||||
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class);
|
||||
|
||||
@Test
|
||||
public void clickBackButton() throws Exception{
|
||||
//Here we click the back button and then we check if the locationFragment is shown
|
||||
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new com.a1.nextlocation.fragments.LocationDetailFragment()).commit();
|
||||
onView(withId(R.id.detail_location_back_button)).perform(click());
|
||||
onView(withId(R.id.locationFragment)).check(matches(isDisplayed()));
|
||||
}
|
||||
}
|
||||
@@ -27,13 +27,4 @@ public class RouteFragmentTest {
|
||||
onView(withId(R.id.homeFragment)).check(matches(isDisplayed()));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void clickDetailButton() throws Exception{
|
||||
//Here we click an item in the recyclerview and then check if the routeDetailFragment is called
|
||||
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new RouteFragment()).commit();
|
||||
onView(withId(R.id.route_recyclerview)).perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
|
||||
onView(withId(R.id.routeDetailFragment)).check(matches(isDisplayed()));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user