From 77a6226c1d98a13ff0e563a3bce6193700f289c0 Mon Sep 17 00:00:00 2001 From: Robin Koedood Date: Tue, 5 Jan 2021 13:32:44 +0100 Subject: [PATCH] [ADD] Comments --- .../java/com/a1/nextlocation/CouponFragmentTest.java | 3 +++ .../java/com/a1/nextlocation/LocationDetailFragment.java | 1 + .../java/com/a1/nextlocation/LocationFragmentTest.java | 2 ++ .../java/com/a1/nextlocation/RouteFragmentTest.java | 2 ++ 4 files changed, 8 insertions(+) diff --git a/app/src/androidTest/java/com/a1/nextlocation/CouponFragmentTest.java b/app/src/androidTest/java/com/a1/nextlocation/CouponFragmentTest.java index e5d4342..49b7ee5 100644 --- a/app/src/androidTest/java/com/a1/nextlocation/CouponFragmentTest.java +++ b/app/src/androidTest/java/com/a1/nextlocation/CouponFragmentTest.java @@ -29,6 +29,7 @@ public class CouponFragmentTest { @Test public void clickBackButton() throws Exception{ + //Here we click the back button and then we check if the statisticsFragment is shown mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new CouponFragment()).commit(); onView(withId(R.id.coupon_back_button)).perform(click()); onView(withId(R.id.statisticsFragment)).check(matches(isDisplayed())); @@ -36,6 +37,8 @@ public class CouponFragmentTest { @Test public void clickDetailButton() throws Exception{ + //Here we click a coupon and then a popup dialog shows, we press the "activeren" button in it and if the next dialog with the code and with + //the button "Klaar" is shown then the test works mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new CouponFragment()).commit(); onView(withId(R.id.coupon_recyclerview)).perform(RecyclerViewActions.actionOnItemAtPosition(1, click())); onView(withText("activeren")).inRoot(RootMatchers.isDialog()).perform(click()); diff --git a/app/src/androidTest/java/com/a1/nextlocation/LocationDetailFragment.java b/app/src/androidTest/java/com/a1/nextlocation/LocationDetailFragment.java index aae88e4..3942ba0 100644 --- a/app/src/androidTest/java/com/a1/nextlocation/LocationDetailFragment.java +++ b/app/src/androidTest/java/com/a1/nextlocation/LocationDetailFragment.java @@ -19,6 +19,7 @@ public class LocationDetailFragment { @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())); diff --git a/app/src/androidTest/java/com/a1/nextlocation/LocationFragmentTest.java b/app/src/androidTest/java/com/a1/nextlocation/LocationFragmentTest.java index 19dedd2..5f13c79 100644 --- a/app/src/androidTest/java/com/a1/nextlocation/LocationFragmentTest.java +++ b/app/src/androidTest/java/com/a1/nextlocation/LocationFragmentTest.java @@ -24,6 +24,7 @@ public class LocationFragmentTest { @Test public void clickBackButton() throws Exception{ + //Here we click the back button and then we check if the homeFragment is shown mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new LocationFragment()).commit(); onView(withId(R.id.location_back_button)).perform(click()); onView(withId(R.id.homeFragment)).check(matches(isDisplayed())); @@ -32,6 +33,7 @@ public class LocationFragmentTest { @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 LocationFragment()).commit(); onView(withId(R.id.location_recyclerview)).perform(RecyclerViewActions.actionOnItemAtPosition(1, click())); onView(withId(R.id.locationDetailFragment)).check(matches(isDisplayed())); diff --git a/app/src/androidTest/java/com/a1/nextlocation/RouteFragmentTest.java b/app/src/androidTest/java/com/a1/nextlocation/RouteFragmentTest.java index 49e9e61..c42c59f 100644 --- a/app/src/androidTest/java/com/a1/nextlocation/RouteFragmentTest.java +++ b/app/src/androidTest/java/com/a1/nextlocation/RouteFragmentTest.java @@ -21,6 +21,7 @@ public class RouteFragmentTest { @Test public void clickBackButton() throws Exception{ + //Here we click the back button and then we check if the homeFragment is shown mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new RouteFragment()).commit(); onView(withId(R.id.route_back_button)).perform(click()); onView(withId(R.id.homeFragment)).check(matches(isDisplayed())); @@ -29,6 +30,7 @@ public class RouteFragmentTest { @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()));