[ADD] Location Detail Fragment Test
This commit is contained in:
@@ -30,14 +30,14 @@ public class CouponFragmentTest {
|
|||||||
@Test
|
@Test
|
||||||
public void clickBackButton() throws Exception{
|
public void clickBackButton() throws Exception{
|
||||||
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new CouponFragment()).commit();
|
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new CouponFragment()).commit();
|
||||||
onView(withId(R.id.couponBackButton)).perform(click());
|
onView(withId(R.id.coupon_back_button)).perform(click());
|
||||||
onView(withId(R.id.statisticsFragment)).check(matches(isDisplayed()));
|
onView(withId(R.id.statisticsFragment)).check(matches(isDisplayed()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void clickDetailButton() throws Exception{
|
public void clickDetailButton() throws Exception{
|
||||||
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new CouponFragment()).commit();
|
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new CouponFragment()).commit();
|
||||||
onView(withId(R.id.couponRecyclerView)).perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
|
onView(withId(R.id.coupon_recyclerview)).perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
|
||||||
onView(withText("activeren")).inRoot(RootMatchers.isDialog()).perform(click());
|
onView(withText("activeren")).inRoot(RootMatchers.isDialog()).perform(click());
|
||||||
onView(withText("Klaar")).inRoot(RootMatchers.isDialog()).check(matches(isDisplayed()));
|
onView(withText("Klaar")).inRoot(RootMatchers.isDialog()).check(matches(isDisplayed()));
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
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{
|
||||||
|
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()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,7 +25,7 @@ public class LocationFragmentTest {
|
|||||||
@Test
|
@Test
|
||||||
public void clickBackButton() throws Exception{
|
public void clickBackButton() throws Exception{
|
||||||
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new LocationFragment()).commit();
|
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new LocationFragment()).commit();
|
||||||
onView(withId(R.id.locationBackButton)).perform(click());
|
onView(withId(R.id.location_back_button)).perform(click());
|
||||||
onView(withId(R.id.homeFragment)).check(matches(isDisplayed()));
|
onView(withId(R.id.homeFragment)).check(matches(isDisplayed()));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ public class LocationFragmentTest {
|
|||||||
@Test
|
@Test
|
||||||
public void clickDetailButton() throws Exception{
|
public void clickDetailButton() throws Exception{
|
||||||
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new LocationFragment()).commit();
|
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new LocationFragment()).commit();
|
||||||
onView(withId(R.id.locationRecyclerView)).perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
|
onView(withId(R.id.location_recyclerview)).perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
|
||||||
onView(withId(R.id.locationDetailFragment)).check(matches(isDisplayed()));
|
onView(withId(R.id.locationDetailFragment)).check(matches(isDisplayed()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user