Skip to content
Snippets Groups Projects
Commit e68a3a44 authored by adityab3's avatar adityab3
Browse files

Added additional edge case tests

parent b69e3458
No related branches found
No related tags found
1 merge request!6Uc91v2
......@@ -117,7 +117,7 @@ public class PreRegisterPatientTest extends iTrustSeleniumTest {
assertTrue(driver.findElement(By.xpath("//body")).getText().contains("This form has not been validated correctly"));
}
public void testInvalidEmail() {
public void testInvalidEmailFormException() {
goToPreRegister();
driver.findElement(By.xpath("//input[@name='firstName']")).sendKeys("fname");
......@@ -166,4 +166,29 @@ public class PreRegisterPatientTest extends iTrustSeleniumTest {
assertEquals("iTrust - Pre-Registered Patient Home", driver.getTitle());
}
public void testDuplicateEmailITrustException() {
// Add a user with name@email.com
goToPreRegister();
driver.findElement(By.xpath("//input[@name='firstName']")).sendKeys("fname");
driver.findElement(By.xpath("//input[@name='lastName']")).sendKeys("lname");
driver.findElement(By.xpath("//input[@name='email']")).sendKeys("name@email.com");
driver.findElement(By.xpath("//input[@name='password']")).sendKeys("Password123");
driver.findElement(By.xpath("//input[@name='verifyPassword']")).sendKeys("Password123");
driver.findElement(By.id("submit_preregister")).click();
goToPreRegister();
// Fill the form
driver.findElement(By.xpath("//input[@name='firstName']")).sendKeys("otherfname");
driver.findElement(By.xpath("//input[@name='lastName']")).sendKeys("otherlname");
driver.findElement(By.xpath("//input[@name='email']")).sendKeys("name@email.com");
driver.findElement(By.xpath("//input[@name='password']")).sendKeys("Password123");
driver.findElement(By.xpath("//input[@name='verifyPassword']")).sendKeys("Password123");
// Submit
driver.findElement(By.id("submit_preregister")).click();
assertTrue(driver.findElement(By.xpath("//body")).getText().contains("This email is already in use. Please use another email address."));
}
}
\ No newline at end of file
......@@ -108,7 +108,6 @@ public class AddPreRegisterPatientActionTest extends TestCase {
p.setEmail("1234");
p.setPassword("password");
// maybe not needed
try {
action.addPatient(p, defaultHRF);
fail("Invalid email");
......@@ -117,6 +116,40 @@ public class AddPreRegisterPatientActionTest extends TestCase {
}
}
/**
* Ensure that invalid heights and weights are not allowed
*/
public void testPreRegisterPatientInvalidHeightWeight() throws Exception {
PatientBean p = new PatientBean();
p.setFirstName("Jiminy");
p.setLastName("Cricket");
p.setEmail("email@email.com");
p.setPassword("password");
HealthRecordForm h = new HealthRecordForm();
h = new HealthRecordForm();
h.setIsSmoker("0");
h.setHeight("abc");
h.setWeight("100");
try {
action.addPatient(p, h);
fail("Expected exception");
} catch (FormValidationException e) {
}
h.setHeight("100");
h.setWeight("abc");
try {
action.addPatient(p, h);
fail("Expected exception");
} catch (FormValidationException e) {
}
}
/**
* Ensure that duplicate emails are not allowed
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment