public void testChangePassword_Invalid_Length() throws Exception {
    // Patient1 logs into iTrust
    WebConversation wc = login("1", "pw");
    WebResponse wr = wc.getCurrentPage();
    assertEquals("iTrust - Patient Home", wr.getTitle());

    // User goes to change password
    wr = wr.getLinkWith("Change Password").click();

    // User types in their current, new, and confirm passwords
    WebForm wf = wr.getFormWithID("mainForm");
    wf.setParameter("oldPass", "pw");
    wf.setParameter("newPass", "pas1");
    wf.setParameter("confirmPass", "pas1");

    // User submits password change. Change logged
    wf.submit(wf.getSubmitButtons()[0]);
    wr = wc.getCurrentPage();
    assertTrue(wr.getText().contains("Invalid password"));
    assertLogged(TransactionType.PASSWORD_CHANGE_FAILED, 1L, 0, "");

    // User logs out
    wr = wr.getLinkWith("Logout").click();

    // User can log in with old password, but can't with new one
    wc = login("1", "pas1");
    assertEquals("iTrust - Login", wc.getCurrentPage().getTitle());
    wc = login("1", "pw");
    assertEquals("iTrust - Patient Home", wc.getCurrentPage().getTitle());
  }
예제 #2
0
  public void testViewAccessLogByRole() throws Exception {
    gen.transactionLog3();
    WebConversation wc = login("1", "pw");
    WebResponse wr = wc.getCurrentPage();
    assertEquals("iTrust - Patient Home", wr.getTitle());
    assertLogged(TransactionType.HOME_VIEW, 1L, 0L, "");

    wr = wr.getLinkWith("Access Log").click();
    assertFalse(wr.getText().contains("Exception"));

    WebForm form = wr.getForms()[0];
    form.setParameter("startDate", "02/01/2008");
    form.setParameter("endDate", "09/22/2009");
    form.getSubmitButtons()[0].click();
    form.getScriptableObject().setParameterValue("sortBy", "role");
    wr = form.submit();

    WebTable table = wr.getTableStartingWithPrefix("Date");
    assertTrue(table.getCellAsText(1, 2).contains("Emergency Responder"));
    assertTrue(table.getCellAsText(2, 2).contains("LHCP"));
    assertTrue(table.getCellAsText(3, 2).contains("LHCP"));
    assertTrue(table.getCellAsText(4, 2).contains("LHCP"));
    assertTrue(table.getCellAsText(5, 2).contains("Personal Health Representative"));
    assertTrue(table.getCellAsText(6, 2).contains("UAP"));

    assertLogged(TransactionType.ACCESS_LOG_VIEW, 1L, 0L, "");
  }
예제 #3
0
  public void testViewAccessLogByDate() throws Exception {
    gen.transactionLog2();
    WebConversation wc = login("2", "pw");
    WebResponse wr = wc.getCurrentPage();
    assertEquals("iTrust - Patient Home", wr.getTitle());
    assertLogged(TransactionType.HOME_VIEW, 2L, 0L, "");

    wr = wr.getLinkWith("Access Log").click();
    assertFalse(wr.getText().contains("Exception"));

    WebForm form = wr.getForms()[0];
    form.setParameter("startDate", "03/01/2008");
    form.setParameter("endDate", "12/01/2008");
    form.getSubmitButtons()[0].click();

    wr = wr.getLinkWith("Date").click();
    /*
    WebTable table = wr.getTableStartingWithPrefix("Date");
    assertTrue(table.getCellAsText(1, 3).contains("View emergency report"));
    assertTrue(table.getCellAsText(2, 3).contains("Edit Office Visits"));
    assertTrue(table.getCellAsText(3, 3).contains("View prescription report"));
    assertTrue(table.getCellAsText(4, 3).contains("View risk factors"));
    assertLogged(TransactionType.ACCESS_LOG_VIEW, 2L, 0L, "");
    */

  }
예제 #4
0
  /*
   * @author Jay Patel
   * HCP 9000000000 has viewed PHR of patient 2 on 11/11/2007.
   * Authenticate Patient
   * MID: 2
   * Password: pw
   * Choose option View Access Log
   * Choose date range 11/12/2015 through 11/11/2015
   * Invalid format in use yyyy/mm/dd
   */
  public void testViewAccessLogDateOrder() throws Exception {
    // clear operational profile
    gen.transactionLog();
    // login patient 2
    WebConversation wc = login("2", "pw");
    WebResponse wr = wc.getCurrentPage();
    assertEquals("iTrust - Patient Home", wr.getTitle());
    assertLogged(TransactionType.HOME_VIEW, 2L, 0L, "");

    // click on View Access Log
    wr = wr.getLinkWith("Access Log").click();
    // select the date range and submit
    WebForm form = wr.getForms()[0];
    form.setParameter("startDate", "11/12/2015");
    form.setParameter("endDate", "11/11/2015");
    form.getSubmitButtons()[0].click();
    WebResponse add = wc.getCurrentPage();

    // Since we are using a invalid format for dates putting
    // the format yyyy/mm/dd should return an "Information not valid"
    // response on the page

    assertFalse(add.getText().contains("Exception"));
    assertTrue(add.getText().contains("Information not valid"));
  }
예제 #5
0
  /*
   * HCP 9000000000 has viewed PHR of patient 2 on 11/11/2007.
   * Authenticate Patient
   * MID: 2
   * Password: pw
   * Choose option View Access Log
   * Choose date range 6/22/2000 through 6/23/2000
   */
  public void testViewAccessLog2() throws Exception {
    // clear operational profile
    gen.transactionLog();
    // login patient 2
    WebConversation wc = login("2", "pw");
    WebResponse wr = wc.getCurrentPage();
    assertEquals("iTrust - Patient Home", wr.getTitle());
    assertLogged(TransactionType.HOME_VIEW, 2L, 0L, "");

    // click on View Access Log
    wr = wr.getLinkWith("Access Log").click();
    // select the date range and submit
    WebForm form = wr.getForms()[0];
    form.setParameter("startDate", "06/22/2000");
    form.setParameter("endDate", "06/23/2000");
    form.getSubmitButtons()[0].click();
    WebResponse add = wc.getCurrentPage();
    assertFalse(add.getText().contains("Exception"));
    assertLogged(TransactionType.ACCESS_LOG_VIEW, 2L, 0L, "");
  }
예제 #6
0
  public void testEditAppt() throws Exception {
    // login hcp
    WebConversation wc = login("9000000000", "pw");
    WebResponse wr = wc.getCurrentPage();
    assertEquals("iTrust - HCP Home", wr.getTitle());
    assertLogged(TransactionType.HOME_VIEW, 9000000000L, 0L, "");

    wr = wr.getLinkWith("View My Appointments").click();
    assertLogged(TransactionType.APPOINTMENT_ALL_VIEW, 9000000000L, 0L, "");

    WebTable table = wr.getTables()[0];
    wr = table.getTableCell(table.getRowCount() - 1, 5).getLinkWith("Edit/Remove").click();
    assertTrue(wr.getText().contains("Andy Programmer"));
    WebForm wf = wr.getFormWithID("mainForm");
    wf.setParameter("comment", "New comment!");

    SubmitButton[] buttons = wf.getSubmitButtons();
    wr = wf.submit(buttons[0]); // Submit as "Change"
    assertTrue(wr.getText().contains("Success: Appointment changed"));
    assertLogged(TransactionType.APPOINTMENT_EDIT, 9000000000L, 2L, "");
  }