From fd62e1ec68c9c16dd608d73d3d5c15a1e6b0d087 Mon Sep 17 00:00:00 2001 From: Karina Brian Date: Wed, 26 Jun 2024 17:43:54 +0300 Subject: [PATCH] added tests to access anc registration form and user profile --- .../activity/anc/HomePageActivityTest.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/HomePageActivityTest.java b/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/HomePageActivityTest.java index dcaafc060..4512d83ed 100644 --- a/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/HomePageActivityTest.java +++ b/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/HomePageActivityTest.java @@ -7,6 +7,7 @@ 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.withContentDescription; import static androidx.test.espresso.matcher.ViewMatchers.withId; import static androidx.test.espresso.matcher.ViewMatchers.withSubstring; @@ -46,6 +47,7 @@ public void B_SearchBarPresent() { onView(withId(R.id.search_bar_layout)).check(matches(isDisplayed())); } + @Test public void C_SearchPatientByName() throws InterruptedException { @@ -53,15 +55,16 @@ public void C_SearchPatientByName() throws InterruptedException { onView(withId(R.id.patient_name)).check(matches(isDisplayed())); Thread.sleep(1000); onView(withId(R.id.btn_search_cancel)).perform(click()); - } - @Test + } + + @Test public void C_SearchPatientByID() throws InterruptedException { onView(withId(R.id.edt_search)).perform(typeText(Configs.TestDataConfigs.clientID), ViewActions.closeSoftKeyboard()); onView(withId(R.id.patient_name)).check(matches(isDisplayed())); Thread.sleep(1000); onView(withId(R.id.btn_search_cancel)).perform(click()); - } + } @Test public void D_AdvancedSearch() throws InterruptedException { @@ -78,12 +81,25 @@ public void D_AdvancedSearch() throws InterruptedException { public void E_OpenLibrary() throws InterruptedException { onView(withId(R.id.action_library)).perform(click()); Thread.sleep(2000); - // onView(withId(R.id.library_item_layout)).atPosition(1).perform(click()); + // onView(withId(R.id.library_item_layout)).atPosition(1).perform(click()); Thread.sleep(2000); onView(withId(R.id.library_toolbar_title)).check(matches(isDisplayed())); onView(withId(R.id.action_clients)).perform(click()); } + @Test + public void userCanAccessANCRegistrationForm() throws InterruptedException { + onView(withContentDescription("Register")).perform(click()); + Thread.sleep(1500); + onView(withId(R.id.scan_button)).check(matches(isDisplayed())); + } + @Test + public void userCanAccessProfile() throws InterruptedException { + onView(withContentDescription("Me")).perform(click()); + Thread.sleep(1500); + onView(withId(R.id.locationImageView)).check(matches(isDisplayed())); + } } +