From 68a8fcca6a69f4be6868f77f279878860914d203 Mon Sep 17 00:00:00 2001 From: Naima-Bashir Date: Fri, 2 Aug 2024 16:04:18 +0300 Subject: [PATCH] Tests on the Current Pregnancy --- .../activity/anc/ProfileContainerTest.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/ProfileContainerTest.java b/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/ProfileContainerTest.java index ac45a29dc..670705c95 100644 --- a/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/ProfileContainerTest.java +++ b/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/ProfileContainerTest.java @@ -22,6 +22,7 @@ import com.vijay.jsonwizard.activities.JsonFormActivity; +import org.junit.AfterClass; import org.junit.FixMethodOrder; import org.junit.Rule; import org.junit.Test; @@ -64,7 +65,32 @@ public void B_StartContactVisitAndNavigateToProfile() throws Throwable { onView(withText("Primary")).perform(click()); onView(withText("Married or living together")).perform(scrollTo(), click()); onView(withText("Formal employment")).perform(scrollTo(), click()); + onView(withText("NEXT")).perform(scrollTo(), click()); + + onView(withText("Current Pregnancy")).check(matches(isDisplayed())); + onView(withId(Utils.getViewId((JsonFormActivity) activity, "step1:lmp_known"))); + onView(withSubstring("Yes")).perform(click()); + onView(withText("08-03-2024")).perform(click()); + + onView(withId(Utils.getViewId((JsonFormActivity) activity, "step2:ultrasound_done"))); + onView(withSubstring("Yes")).perform(scrollTo(), click()); + onView(withText("22-04-2024")).perform(click()); + + onView(withSubstring("GA from ultrasound-weeks")).perform(scrollTo(), typeText("6"), ViewActions.closeSoftKeyboard()); + onView(withSubstring("GA from ultrasound-days")).perform(scrollTo(), typeText("3"), ViewActions.closeSoftKeyboard()); + + onView(withText("Select preferred gestational age")).check(matches(isDisplayed())); + onView(withSubstring("Using LMP")).perform(scrollTo(), click()); + onView(withText("NEXT")).perform(scrollTo(), click()); Thread.sleep(2000); } + @AfterClass + public static void tearDown() throws InterruptedException { + // Perform logout + onView(withContentDescription("Me")).perform(click()); + onView(withId(R.id.logout_text)).perform(click()); + Thread.sleep(1500); + onView(withId(R.id.login_login_btn)).check(matches(isDisplayed())); + } }