Skip to content

Correction on the function names, added logout tests and TestRunner class #1012

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: qa-branch
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,17 @@ public class AdvancedSearchTests {
@Rule
public ActivityScenarioRule<LoginActivity> 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());
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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());
}

}
@Test
public void lLogOut() throws InterruptedException {
utils.logOut();

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand All @@ -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()));
Expand All @@ -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);
Expand All @@ -87,46 +87,49 @@ 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);
onView(withId(R.id.btn_profile_registration_info)).check(matches(isDisplayed()));
}

@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));
Thread.sleep(2000);
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));
Expand All @@ -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();
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,21 @@ public class LoginActivityTest {
public ActivityScenarioRule<LoginActivity> 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)));

}

@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());
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -114,4 +117,9 @@ public void B_testEmptyPassword() throws InterruptedException {


}

@Test
public void gLogOut() throws InterruptedException {
utils.logOut();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down Expand Up @@ -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();
}


}
Loading