From 11f7364bdeba399521eb837e8bf0bd47027470f5 Mon Sep 17 00:00:00 2001 From: madrine Date: Wed, 4 Dec 2024 16:20:10 +0300 Subject: [PATCH] changes in class naming, added logout tests and Testrunner class --- .../anc/activity/anc/AdvancedSearchTests.java | 31 +++++++++++------- .../activity/anc/HomePageActivityTest.java | 32 ++++++++++++------- .../anc/activity/anc/LoginActivityTest.java | 20 ++++++++---- .../activity/anc/ProfileContainerTest.java | 26 +++++++++------ .../anc/activity/anc/ProfilePageTests.java | 22 ++++++------- .../anc/RegisterFamilyMemberPageTests.java | 18 +++-------- .../activity/anc/RemoveFamilyMemberTest.java | 6 ++-- .../anc/activity/anc/TestRunner.java | 28 ++++++++++++++++ .../anc/activity/utils/Utils.java | 10 ++++++ 9 files changed, 127 insertions(+), 66 deletions(-) create mode 100644 reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/TestRunner.java diff --git a/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/AdvancedSearchTests.java b/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/AdvancedSearchTests.java index 320874b8c..4ce0af00f 100644 --- a/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/AdvancedSearchTests.java +++ b/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/AdvancedSearchTests.java @@ -55,15 +55,17 @@ public class AdvancedSearchTests { @Rule public ActivityScenarioRule mActivityScenario = new ActivityScenarioRule<>(LoginActivity.class); - private final Utils utils = new Utils(); + Utils utils = new Utils(); + +// private final Utils utils = new Utils(); @Test - public void A_setUp() throws InterruptedException { + public void aSetUp() throws InterruptedException { utils.logIn(Constants.ancConstants.ancUsername, Constants.ancConstants.ancPassword); } @Test - public void userCanSearchOutsideAndInsideMyHealthFacilityByFirstName() throws InterruptedException { + public void bUserCanSearchOutsideAndInsideMyHealthFacilityByFirstName() throws InterruptedException { onView(withId(R.id.action_search)).perform(click()); Thread.sleep(2000); onView(withId(R.id.first_name)).perform(typeText(Configs.TestDataConfigs.firstNameA),ViewActions.closeSoftKeyboard()); @@ -74,7 +76,7 @@ public void userCanSearchOutsideAndInsideMyHealthFacilityByFirstName() throws In } @Test - public void userCanSearchOutsideAndInsideMyHealthFacilityByLastName() throws InterruptedException { + public void cUserCanSearchOutsideAndInsideMyHealthFacilityByLastName() throws InterruptedException { onView(withId(R.id.action_search)).perform(click()); Thread.sleep(2000); onView(withId(R.id.last_name)).perform(typeText(Configs.TestDataConfigs.lastNameA),ViewActions.closeSoftKeyboard()); @@ -86,7 +88,7 @@ public void userCanSearchOutsideAndInsideMyHealthFacilityByLastName() throws Int } @Test - public void userCanSearchOutsideAndInsideMyHealthFacilityByANCID() throws InterruptedException { + public void eUserCanSearchOutsideAndInsideMyHealthFacilityByANCID() throws InterruptedException { onView(withId(R.id.action_search)).perform(click()); Thread.sleep(2000); onView(allOf(withId(R.id.anc_id),isDescendantOfA(withId(R.id.nested_scroll_view)), withHint("ANC ID"))).perform(typeText(Configs.TestDataConfigs.clientID),ViewActions.closeSoftKeyboard()); @@ -98,7 +100,7 @@ public void userCanSearchOutsideAndInsideMyHealthFacilityByANCID() throws Interr } @Test - public void userCanSearchOutsideAndInsideMyHealthFacilityByExpectedDateOfDelivery() throws InterruptedException { + public void fUserCanSearchOutsideAndInsideMyHealthFacilityByExpectedDateOfDelivery() throws InterruptedException { onView(withId(R.id.action_search)).perform(click()); Thread.sleep(2000); onView(withHint("Expected date of delivery")).perform(click()); @@ -111,7 +113,7 @@ public void userCanSearchOutsideAndInsideMyHealthFacilityByExpectedDateOfDeliver } @Test - public void userCanSearchOutsideAndInsideMyHealthFacilityByDateOfBirth() throws InterruptedException{ + public void gUserCanSearchOutsideAndInsideMyHealthFacilityByDateOfBirth() throws InterruptedException{ onView(withId(R.id.action_search)).perform(click()); Thread.sleep(2000); onView(withHint("Expected date of delivery")).perform(swipeUp()); @@ -125,7 +127,7 @@ public void userCanSearchOutsideAndInsideMyHealthFacilityByDateOfBirth() throws } @Test - public void userCanSearchOutsideAndInsideMyHealthFacilityByPhoneNumber() throws InterruptedException{ + public void hUserCanSearchOutsideAndInsideMyHealthFacilityByPhoneNumber() throws InterruptedException{ onView(withId(R.id.action_search)).perform(click()); Thread.sleep(2000); onView(withHint("Expected date of delivery")).perform(swipeUp()); @@ -138,7 +140,7 @@ public void userCanSearchOutsideAndInsideMyHealthFacilityByPhoneNumber() throws } @Test - public void userCanSearchOutsideAndInsideMyHealthFacilityByAlternateName()throws InterruptedException { + public void iUserCanSearchOutsideAndInsideMyHealthFacilityByAlternateName()throws InterruptedException { onView(withId(R.id.action_search)).perform(click()); Thread.sleep(2000); onView(withHint("Expected date of delivery")).perform(swipeUp()); @@ -152,18 +154,23 @@ public void userCanSearchOutsideAndInsideMyHealthFacilityByAlternateName()throws onView(allOf(withId(R.id.recycler_view), withParent(parentMatcher))).perform(RecyclerViewActions.scrollTo(ViewMatchers.hasDescendant(withText(Configs.TestDataConfigs.clientName2)))).check(matches(isDisplayed())); } @Test - public void userCanSearchOutsideAndInsideMyHealthFacilityByScanningAQRCOde() throws InterruptedException{ + public void jUserCanSearchOutsideAndInsideMyHealthFacilityByScanningAQRCOde() throws InterruptedException{ onView(withId(R.id.action_search)).perform(click()); Thread.sleep(2000); onView(withId(R.id.qrCodeButton)).perform(click()); onView(withText("Scan QR Code")).check(matches(isDisplayed())); } @Test - public void userCanSearchInMyHealthFacilityByFirstName () { + public void kUserCanSearchInMyHealthFacilityByFirstName () { onView(withId(R.id.action_search)).perform(click()); onView(withId(R.id.my_catchment)).perform(click()); onView(withId(R.id.first_name)).perform(typeText(Configs.TestDataConfigs.firstNameA),ViewActions.closeSoftKeyboard()); onView(withId(R.id.search)).perform(click()); } -} \ No newline at end of file + @Test + public void lLogOut() throws InterruptedException { + utils.logOut(); + + } +} 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 24a36756f..3d667ab09 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 @@ -48,18 +48,18 @@ public class HomePageActivityTest { private Utils utils = new Utils(); @Test - public void A_setUp() throws InterruptedException { + public void asetUp() throws InterruptedException { utils.logIn(Constants.ancConstants.ancUsername, Constants.ancConstants.ancPassword); } @Test - public void B_SearchBarPresent() { + public void bSearchBarPresent() { onView(withId(R.id.search_bar_layout)).check(matches(isDisplayed())); } @Test - public void C_SearchPatientByName() throws InterruptedException { + public void cSearchPatientByName() throws InterruptedException { onView(withId(R.id.edt_search)).perform(typeText(Configs.TestDataConfigs.clientName), ViewActions.closeSoftKeyboard()); onView(withId(R.id.patient_name)).check(matches(isDisplayed())); @@ -68,7 +68,7 @@ public void C_SearchPatientByName() throws InterruptedException { } @Test - public void C_SearchPatientByID() throws InterruptedException { + public void cSearchPatientByID() throws InterruptedException { onView(withId(R.id.edt_search)).perform(typeText(Configs.TestDataConfigs.clientID), ViewActions.closeSoftKeyboard()); onView(withId(R.id.patient_name)).check(matches(isDisplayed())); @@ -77,7 +77,7 @@ public void C_SearchPatientByID() throws InterruptedException { } @Test - public void D_AdvancedSearch() throws InterruptedException { + public void dAdvancedSearch() throws InterruptedException { onView(withId(R.id.action_search)).perform(click()); onView(withId(R.id.qrCodeButton)).check(matches(isDisplayed())); Thread.sleep(1000); @@ -87,29 +87,31 @@ public void D_AdvancedSearch() throws InterruptedException { } @Test - public void E_OpenLibrary() throws InterruptedException { + public void eOpenLibrary() throws InterruptedException { onView(withId(R.id.action_library)).perform(click()); onView(withId(R.id.library_toolbar_title)).check(matches(isDisplayed())); - Thread.sleep(1000); + Thread.sleep(1000); onView(withId(R.id.action_clients)).perform(click()); } + @Test - public void userCanAccessANCRegistrationForm() throws InterruptedException { + public void fUserCanAccessANCRegistrationForm() 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 { + public void gUserCanAccessProfile() throws InterruptedException { onView(withContentDescription("Me")).perform(click()); Thread.sleep(1500); onView(withId(R.id.locationImageView)).check(matches(isDisplayed())); } @Test - public void userCanClickOnAPatient() throws InterruptedException { + public void hUserCanClickOnAPatient() throws InterruptedException { onView(allOf(withId(R.id.recycler_view), isDisplayed())) .perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); Thread.sleep(2000); @@ -117,7 +119,7 @@ public void userCanClickOnAPatient() throws InterruptedException { } @Test - public void userCanClickOnNextButtonOnRegister() throws InterruptedException { + public void iUserCanClickOnNextButtonOnRegister() throws InterruptedException { Thread.sleep(2000); onView(allOf(withId(R.id.recycler_view), isDisplayed())) .perform(RecyclerViewActions.scrollToPosition(20)); @@ -125,8 +127,9 @@ public void userCanClickOnNextButtonOnRegister() throws InterruptedException { onView(withId(R.id.btn_next_page)).perform(click()); onView(withId(R.id.btn_previous_page)).check(matches(isDisplayed())); } + @Test - public void userCanClickOnThePreviousBtnOnRegister() throws InterruptedException { + public void jUserCanClickOnThePreviousBtnOnRegister() throws InterruptedException { Thread.sleep(2000); onView(allOf(withId(R.id.recycler_view), isDisplayed())) .perform(RecyclerViewActions.scrollToPosition(20)); @@ -137,6 +140,11 @@ public void userCanClickOnThePreviousBtnOnRegister() throws InterruptedException Thread.sleep(2000); onView(withText("Page 1 of 9")).perform(scrollTo()).check(matches(isDisplayed())); } + + @Test + public void kLogOut() throws InterruptedException { + utils.logOut(); + } } diff --git a/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/LoginActivityTest.java b/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/LoginActivityTest.java index dde034ccb..5977e5f05 100644 --- a/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/LoginActivityTest.java +++ b/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/LoginActivityTest.java @@ -48,10 +48,13 @@ public class LoginActivityTest { public ActivityScenarioRule mActivityScenario = new ActivityScenarioRule<>(LoginActivity.class); public String correctPassword = "Amani123"; + Utils utils = new Utils(); + + @Test - public void E_testShowPassword(){ + public void eTestShowPassword(){ onView(withId(R.id.login_password_edit_text)).perform(typeText(correctPassword),closeSoftKeyboard()); onView(withId(R.id.login_show_password_checkbox)).perform(click(),closeSoftKeyboard()); onView(withId(R.id.login_password_edit_text)).check(matches(withText(correctPassword))); @@ -59,7 +62,7 @@ public void E_testShowPassword(){ } @Test - public void F_testSuccessfulLogin() throws InterruptedException { + public void fTestSuccessfulLogin() throws InterruptedException { onView(withId(R.id.login_user_name_edit_text)).perform(typeText("demo"), closeSoftKeyboard()); onView(withId(R.id.login_password_edit_text)).perform(typeText(correctPassword), closeSoftKeyboard()); onView(withId(R.id.login_login_btn)).perform(click()); @@ -70,7 +73,7 @@ public void F_testSuccessfulLogin() throws InterruptedException { } @Test - public void C_testIncorrectUsername() throws InterruptedException { + public void cTestIncorrectUsername() throws InterruptedException { onView(withId(R.id.login_user_name_edit_text)).perform(typeText("Beba"),closeSoftKeyboard()); onView(withId(R.id.login_password_edit_text)).perform(typeText(correctPassword),closeSoftKeyboard()); onView(withId(R.id.login_login_btn)).perform(click()); @@ -83,7 +86,7 @@ public void C_testIncorrectUsername() throws InterruptedException { @Test - public void D_testIncorrectPassword() throws InterruptedException { + public void dTestIncorrectPassword() throws InterruptedException { onView(withId(R.id.login_user_name_edit_text)).perform(typeText("demo"),closeSoftKeyboard()); onView(withId(R.id.login_password_edit_text)).perform(typeText("mani"),closeSoftKeyboard()); onView(withId(R.id.login_login_btn)).perform(click()); @@ -94,7 +97,7 @@ public void D_testIncorrectPassword() throws InterruptedException { } @Test - public void A_testEmptyUsername() throws InterruptedException { + public void aTestEmptyUsername() throws InterruptedException { onView(withId(R.id.login_user_name_edit_text)).perform(typeText(" "),closeSoftKeyboard()); onView(withId(R.id.login_password_edit_text)).perform(typeText(correctPassword),closeSoftKeyboard()); onView(withId(R.id.login_login_btn)).perform(click()); @@ -105,7 +108,7 @@ public void A_testEmptyUsername() throws InterruptedException { } @Test - public void B_testEmptyPassword() throws InterruptedException { + public void bTestEmptyPassword() throws InterruptedException { onView(withId(R.id.login_user_name_edit_text)).perform(typeText("Beba"),closeSoftKeyboard()); onView(withId(R.id.login_password_edit_text)).perform(typeText(" "),closeSoftKeyboard()); onView(withId(R.id.login_login_btn)).perform(click()); @@ -114,4 +117,9 @@ public void B_testEmptyPassword() throws InterruptedException { } + + @Test + public void gLogOut() throws InterruptedException { + utils.logOut(); + } } 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 47bf8bfbb..70612b706 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 @@ -49,14 +49,14 @@ public class ProfileContainerTest { private Utils utils = new Utils(); - @Before - public void A_setUp() throws InterruptedException { + @Test + public void aSetUp() throws InterruptedException { utils.logIn(Constants.ancConstants.ancUsername, Constants.ancConstants.ancPassword); Thread.sleep(1000); } @Test - public void B_StartContactVisitAndNavigateToProfile() throws Throwable { + public void bStartContactVisitAndNavigateToProfile() throws Throwable { onView(withId(R.id.edt_search)).perform(typeText(Configs.TestDataConfigs.clientName), ViewActions.closeSoftKeyboard()); onView(withId(R.id.patient_name)).check(matches(isDisplayed())); @@ -164,11 +164,17 @@ public void B_StartContactVisitAndNavigateToProfile() throws Throwable { Thread.sleep(2000); } - @AfterClass - public static void tearDown() throws InterruptedException { - 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())); - } +// @AfterClass +// public static void tearDown() throws InterruptedException { +// 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())); +// } +@Test +public void mLogOut() throws InterruptedException { + utils.logOut(); +} + + } diff --git a/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/ProfilePageTests.java b/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/ProfilePageTests.java index e18deb469..669a918bd 100644 --- a/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/ProfilePageTests.java +++ b/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/ProfilePageTests.java @@ -51,12 +51,12 @@ public class ProfilePageTests { Utils utils = new Utils(); @Test - public void A_SetUp() throws InterruptedException { + public void aSetUp() throws InterruptedException { utils.logIn(Constants.ancConstants.ancUsername, Constants.ancConstants.ancPassword); } @Test - public void B_UserLocationIsDisplayed() { + public void bUserLocationIsDisplayed() { onView(withContentDescription("Me")).perform(click()); onView(withId(R.id.facility_selection)).perform(click()); onView(withId(R.id.locations_lv)).check(matches(isDisplayed())); @@ -66,7 +66,7 @@ public void B_UserLocationIsDisplayed() { @Test - public void C_ChangeLanguageToBahasa() throws InterruptedException { + public void cChangeLanguageToBahasa() throws InterruptedException { onView(withContentDescription("Me")).perform(click()); onView(withId(R.id.language_switcher_text)).perform(click()); onView(withText("Bahasa (Indonesia)")).perform(click()); @@ -77,7 +77,7 @@ public void C_ChangeLanguageToBahasa() throws InterruptedException { @Test - public void E_ChangeLanguageToFrench() throws InterruptedException { + public void eChangeLanguageToFrench() throws InterruptedException { onView(withContentDescription("Me")).perform(click()); onView(withId(R.id.language_switcher_text)).perform(click()); onView(withText("French")).perform(click()); @@ -87,7 +87,7 @@ public void E_ChangeLanguageToFrench() throws InterruptedException { } @Test - public void F_ChangeLanguageToPortuguese() throws InterruptedException { + public void fChangeLanguageToPortuguese() throws InterruptedException { onView(withContentDescription("Moi")).perform(click()); onView(withId(R.id.language_switcher_text)).perform(click()); onView(withText("Portuguese (Brazil)")).perform(click()); @@ -97,7 +97,7 @@ public void F_ChangeLanguageToPortuguese() throws InterruptedException { } @Test - public void G_ChangeLanguageToEnglish() throws InterruptedException { + public void gChangeLanguageToEnglish() throws InterruptedException { onView(withContentDescription("Eu")).perform(click()); onView(withId(R.id.language_switcher_text)).perform(click()); onView(withText("English")).perform(click()); @@ -106,7 +106,7 @@ public void G_ChangeLanguageToEnglish() throws InterruptedException { Thread.sleep(1000); } @Test - public void H_LoadPopulationXstics() throws InterruptedException { + public void hLoadPopulationXstics() throws InterruptedException { onView(withContentDescription("Me")).perform(click()); onView(withId(R.id.pop_characteristics_text)).perform(click()); onView(withId(R.id.characteristics_toolbar_title)).check(matches(isDisplayed())); @@ -115,7 +115,7 @@ public void H_LoadPopulationXstics() throws InterruptedException { } @Test - public void I_PopulationXsticScrollDown() { + public void iPopulationXsticScrollDown() { onView(withContentDescription("Me")).perform(click()); onView(withId(R.id.pop_characteristics_text)).perform(click()); onView(withId(R.id.population_characteristics)).perform(RecyclerViewActions.scrollTo(hasDescendant(withText("Syphilis prevalence 5% or higher")))).check(matches(isDisplayed())); @@ -128,7 +128,7 @@ public void I_PopulationXsticScrollDown() { @Test - public void J_LoadSiteXstics() { + public void jLoadSiteXstics() { onView(withContentDescription("Me")).perform(click()); onView(withId(R.id.site_characteristics_text)).perform(click()); onView(withId(R.id.characteristics_toolbar_title)).check(matches(isDisplayed())); @@ -136,7 +136,7 @@ public void J_LoadSiteXstics() { } @Test - public void K_EditSiteXstics() throws InterruptedException { + public void kEditSiteXstics() throws InterruptedException { onView(withContentDescription("Me")).perform(click()); onView(withId(R.id.site_characteristics_text)).perform(click()); onView(withId(R.id.characteristics_toolbar_edit)).perform(click()); @@ -150,7 +150,7 @@ public void K_EditSiteXstics() throws InterruptedException { //Device to device sync tests skipped because module is not implemented @Test - public void L_LogOut() throws InterruptedException { + public void lLogOut() throws InterruptedException { onView(withContentDescription("Me")).perform(click()); onView(withId(R.id.logout_text)).perform(click()); Thread.sleep(1500); diff --git a/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/RegisterFamilyMemberPageTests.java b/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/RegisterFamilyMemberPageTests.java index 915ca6169..3bdb2a01f 100644 --- a/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/RegisterFamilyMemberPageTests.java +++ b/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/RegisterFamilyMemberPageTests.java @@ -44,7 +44,6 @@ public class RegisterFamilyMemberPageTests { Utils utils = new Utils(); - @Test public void aSetUp() throws InterruptedException { utils.logIn(Constants.ancConstants.ancUsername, Constants.ancConstants.ancPassword); @@ -82,7 +81,7 @@ public void dAddMemberWithMissingMandatoryFields() throws Throwable { onView(withId(Utils.getViewId((JsonFormActivity) activity, "step1:first_name"))).perform(typeText(Configs.TestDataConfigs.firstName), closeSoftKeyboard()); onView(withId(Utils.getViewId((JsonFormActivity) activity, "step1:last_name"))).perform(typeText(Configs.TestDataConfigs.lastName), closeSoftKeyboard()); onView(withId(Utils.getViewId((JsonFormActivity) activity, "step1:dob_unknown"))).perform(click()); - onView(withId(Utils.getViewId((JsonFormActivity) activity, "step1:age_entered"))).perform(typeText(Configs.TestDataConfigs.clientAge),closeSoftKeyboard()); + onView(withId(Utils.getViewId((JsonFormActivity) activity, "step1:age_entered"))).perform(typeText(Configs.TestDataConfigs.clientAge), closeSoftKeyboard()); onView(withId(Utils.getViewId((JsonFormActivity) activity, "step1:home_address"))).perform(typeText(Configs.TestDataConfigs.clientAddress), closeSoftKeyboard()); onView(withId(Utils.getViewId((JsonFormActivity) activity, "step1:phone_number"))).perform(typeText(Configs.TestDataConfigs.phoneNumber), closeSoftKeyboard()); onView(withId(Utils.getViewId((JsonFormActivity) activity, "step1:reminders"))).perform(click()); @@ -92,17 +91,10 @@ public void dAddMemberWithMissingMandatoryFields() throws Throwable { } + @Test + public void eLogOut() throws InterruptedException { + utils.logOut(); - - - - - - - - - - - + } } \ No newline at end of file diff --git a/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/RemoveFamilyMemberTest.java b/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/RemoveFamilyMemberTest.java index c7a09aee3..f4b2a2a0e 100644 --- a/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/RemoveFamilyMemberTest.java +++ b/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/RemoveFamilyMemberTest.java @@ -246,9 +246,11 @@ public void lRemoveByWrongEntry() throws Throwable { } + @Test + public void mLogOut() throws InterruptedException { + utils.logOut(); - - + } } \ No newline at end of file diff --git a/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/TestRunner.java b/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/TestRunner.java new file mode 100644 index 000000000..7179638c0 --- /dev/null +++ b/reference-app/src/androidTest/java/org/smartregister/anc/activity/anc/TestRunner.java @@ -0,0 +1,28 @@ +package org.smartregister.anc.activity.anc; + + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( + { + LoginActivityTest.class, + HomePageActivityTest.class, + ProfilePageTests.class, + RegisterFamilyMemberPageTests.class, + RemoveFamilyMemberTest.class, + ContactsActivityTest.class, + ProfileContainerTest.class, + AdvancedSearchTests.class + + } +) + + + + +public class TestRunner { + + +} diff --git a/reference-app/src/androidTest/java/org/smartregister/anc/activity/utils/Utils.java b/reference-app/src/androidTest/java/org/smartregister/anc/activity/utils/Utils.java index ca6bb9653..a46d468f2 100644 --- a/reference-app/src/androidTest/java/org/smartregister/anc/activity/utils/Utils.java +++ b/reference-app/src/androidTest/java/org/smartregister/anc/activity/utils/Utils.java @@ -6,6 +6,7 @@ import static androidx.test.espresso.action.ViewActions.typeText; import static androidx.test.espresso.assertion.ViewAssertions.matches; 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.withInputType; import static androidx.test.espresso.matcher.ViewMatchers.withSubstring; @@ -23,6 +24,7 @@ import com.vijay.jsonwizard.activities.JsonFormActivity; +import org.junit.Test; import org.smartregister.anc.R; @@ -74,6 +76,14 @@ public void addAFamilyMember() throws Throwable { } + public void logOut() throws InterruptedException { + 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())); + + } + }