예제 #1
0
  public void testSubmitAndEditConsultation() throws Exception {

    WebConversation wc = login("9000000000", "pw");
    WebResponse wr = wc.getCurrentPage();
    assertEquals("iTrust - HCP Home", wr.getTitle());

    wr = wr.getLinkWith("Consultations").click();
    assertTrue(wr.getText().contains("HCP Consultations"));

    wr.getForms()[0].getButtons()[0].click();

    wr = wc.getCurrentPage();

    assertTrue(wr.getText().contains("Send a Consultation"));

    wr.getForms()[0].setParameter("patient", "5");
    wr.getForms()[0].setParameter("hcp", "9000000003");
    wr = wr.getForms()[0].submit();

    assertTrue(wr.getText().contains("Consultation Form"));

    wr.getForms()[0].setParameter("msg", "Test1");
    wr = wr.getForms()[0].submit();

    assertTrue(wr.getText().contains("Thank you, your Consultation Request was sent."));

    assertTrue(wr.getText().contains("Test1"));

    wr = wr.getLinkWith("Consultations").click();
    assertTrue(wr.getText().contains("HCP Consultations"));

    wr.getForms()[0].getButtons()[1].click();

    wr = wc.getCurrentPage();

    assertTrue(wr.getText().contains("View Pending Consultations"));

    assertTrue(wr.getText().contains("Baby Programmer (5)"));

    wr = wr.getLinkWith("edit").click();

    WebTable wt = wr.getTableStartingWith("Patient:");

    assertEquals("Baby Programmer", wt.getCellAsText(0, 1));
    assertEquals("Kelly Doctor", wt.getCellAsText(1, 1));
    assertEquals("Gandalf Stormcrow", wt.getCellAsText(2, 1));

    wr.getForms()[0].setParameter("refDetails", "Test2");
    wr = wr.getForms()[0].submit();

    assertTrue(wr.getText().contains("Consultation updated"));

    wr = wr.getLinkWith("Consultations").click();
    wr.getForms()[0].getButtons()[1].click();
    wr = wc.getCurrentPage();
    wr = wr.getLinkWith("edit").click();

    assertTrue(wr.getText().contains("Test2"));
  }
예제 #2
0
  /**
   * Verifies that the access log correctly handle bad date inputs
   *
   * @throws Exception
   */
  public void testViewAccessLogBadDateHandling() throws Exception {
    gen.clearAllTables();
    gen.standardData();

    WebConversation wc = login("23", "pw");
    WebResponse wr = wc.getCurrentPage();
    assertEquals("iTrust - Patient Home", wr.getTitle());

    wr = wr.getLinkWith("Access Log").click();
    assertEquals("iTrust - View My Access Log", wr.getTitle());

    WebForm dateForm = wr.getForms()[0];
    dateForm.setParameter("startDate", "6/22/2007");
    dateForm.setParameter("endDate", "6/21/2007");
    dateForm.submit();

    wr = wc.getCurrentPage();
    assertEquals("iTrust - View My Access Log", wr.getTitle());
    assertTrue(
        wr.getText()
            .contains(
                "<h2>Information not valid</h2><div class=\"errorList\">Start date must be before end date!<br /></div>"));

    dateForm = wr.getForms()[0];
    dateForm.setParameter("startDate", "June 22nd, 2007");
    dateForm.setParameter("endDate", "6/23/2007");
    dateForm.submit();

    wr = wc.getCurrentPage();
    assertEquals("iTrust - View My Access Log", wr.getTitle());
    assertTrue(
        wr.getText()
            .contains(
                "<h2>Information not valid</h2><div class=\"errorList\">Enter dates in MM/dd/yyyy<br /></div>"));

    // This test is currently commented out because the bug is due to "functionality" in the
    // SimpleDataFormat class which assumes that month 13 === 1
    /*
    dateForm = wr.getForms()[0];
    dateForm.setParameter("startDate", "13/01/2010");
    dateForm.setParameter("endDate", "6/24/2011");
    dateForm.submit();

    wr = wc.getCurrentPage();
    assertEquals("iTrust - View My Access Log", wr.getTitle());
    assertTrue(wr.getText().contains("<h2>Information not valid</h2><div class=\"errorList\">Enter dates in MM/dd/yyyy<br /></div>"));
    */
  }
예제 #3
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, "");
  }
예제 #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
  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, "");
    */

  }
예제 #6
0
  /**
   * Tests adding a lab procedure with no lab tech selected. Verifies that an error message is
   * displayed.
   *
   * @throws Exception
   */
  public void testAddLabProcedureWithoutLabTech() throws Exception {
    gen.clearAllTables();
    gen.standardData();

    WebConversation wc = login("9000000000", "pw");
    WebResponse wr = wc.getCurrentPage();
    assertEquals("iTrust - HCP Home", wr.getTitle());
    // click Document Office Visit
    wr = wr.getLinkWith("Document Office Visit").click();

    // select the patient
    WebForm form = wr.getForms()[0];
    form.getScriptableObject().setParameterValue("UID_PATIENTID", "2");
    form.getButtons()[1].click();
    wr = wc.getCurrentPage();
    assertEquals(ADDRESS + "auth/hcp-uap/documentOfficeVisit.jsp", wr.getURL().toString());
    // Select the office visit from specific date
    wr.getLinkWith("6/10/2007").click();

    wr = wc.getCurrentPage();
    assertEquals("iTrust - Document Office Visit", wr.getTitle());

    form = wr.getFormWithID("labProcedureForm");
    form.setParameter("loinc", "10666-6");
    form.setParameter("labProcPriority", "1");
    form.getButtonWithID("add_labProcedure").click();

    // check updated page
    wr = wc.getCurrentPage();
    assertTrue(
        wr.getText().contains("A lab tech must be selected before adding a laboratory procedure."));
  }
예제 #7
0
 /** Verifies that the HTTP header of a diagram incites the browser to cache it. */
 public void testInvalidUrl() throws Exception {
   WebConversation conversation = new WebConversation();
   // Try to proxify an invalid address
   WebRequest request = new GetMethodWebRequest(getServerUrl() + "proxy/invalidURL");
   WebResponse response = conversation.getResource(request);
   // Analyze response, it must be the empty form
   // Verifies the Content-Type header
   assertEquals("Response content type is not HTML", "text/html", response.getContentType());
   WebForm[] forms = response.getForms();
   assertEquals(2, forms.length);
 }
예제 #8
0
  public void testAddLabProcedureWithLabTech() throws Exception {
    gen.clearAllTables();
    gen.standardData();

    WebConversation wc = login("9000000000", "pw");
    WebResponse wr = wc.getCurrentPage();
    assertEquals("iTrust - HCP Home", wr.getTitle());
    // click Document Office Visit
    wr = wr.getLinkWith("Document Office Visit").click();

    // select the patient
    WebForm form = wr.getForms()[0];
    form.getScriptableObject().setParameterValue("UID_PATIENTID", "2");
    form.getButtons()[1].click();
    wr = wc.getCurrentPage();
    assertEquals(ADDRESS + "auth/hcp-uap/documentOfficeVisit.jsp", wr.getURL().toString());
    // Select the office visit from specific date
    wr.getLinkWith("6/10/2007").click();

    wr = wc.getCurrentPage();
    assertEquals("iTrust - Document Office Visit", wr.getTitle());

    form = wr.getFormWithID("labProcedureForm");
    form.setParameter("loinc", "10666-6");
    form.setParameter("labTech", "5000000001");
    form.setParameter("labProcPriority", "1");
    form.getButtonWithID("add_labProcedure").click();

    // check updated page
    wr = wc.getCurrentPage();
    assertTrue(wr.getText().contains("Lab Procedure information successfully updated."));
    assertLogged(TransactionType.LAB_PROCEDURE_ADD, 9000000000L, 2L, "");

    // Get row containing procedure.
    WebTable tbl = wr.getTableWithID("labProceduresTable");
    TableRow[] rows = tbl.getRows();
    int rowi = 0;
    for (; rowi < rows.length; rowi++) {
      if (rows[rowi].getText().startsWith("| 10666-6")) {
        break;
      }
    }
    assertTrue(rowi < rows.length);
    // Verify data in table
    assertEquals("Lab Dude", tbl.getCellAsText(rowi, 1));
    assertEquals("In Transit", tbl.getCellAsText(rowi, 2)); // status
    assertEquals("", tbl.getCellAsText(rowi, 5)); // commentary
    assertEquals("", tbl.getCellAsText(rowi, 6)); // numerical results
    assertEquals("", tbl.getCellAsText(rowi, 7)); // lower bound
    assertEquals("", tbl.getCellAsText(rowi, 8)); // upper bound
    assertTrue(tbl.getCellAsText(rowi, 10).contains("Remove")); // action
    assertTrue(tbl.getCellAsText(rowi, 10).contains("Reassign")); // action
  }
예제 #9
0
  public WebResponse loginForm(String username, String password) throws Exception {
    WebConversation conversation = new WebConversation();
    HttpUnitOptions.setScriptingEnabled(false);
    HttpUnitOptions.setExceptionsThrownOnScriptError(false);
    WebRequest request = new GetMethodWebRequest("http://localhost:8084/LeaveApp/index.jsp");
    WebResponse response = conversation.getResponse(request);
    WebForm loginform = response.getForms()[0];
    loginform.setParameter("username", username);
    loginform.setParameter("password", password);
    request = loginform.getRequest("submitbutton");
    response = conversation.getResponse(request);

    return response;
  }
예제 #10
0
  /**
   * testReassignLabProcedure
   *
   * @throws Exception
   */
  public void testReassignLabProcedure() throws Exception {
    gen.clearAllTables();
    gen.standardData();

    WebConversation wc = login("9000000000", "pw");
    WebResponse wr = wc.getCurrentPage();
    assertEquals("iTrust - HCP Home", wr.getTitle());
    // click Document Office Visit
    wr = wr.getLinkWith("Document Office Visit").click();

    // select the patient
    WebForm form = wr.getForms()[0];
    form.getScriptableObject().setParameterValue("UID_PATIENTID", "2");
    form.getButtons()[1].click();
    wr = wc.getCurrentPage();
    assertEquals(ADDRESS + "auth/hcp-uap/documentOfficeVisit.jsp", wr.getURL().toString());
    // Select the office visit from specific date
    wr.getLinkWith("6/10/2007").click();

    wr = wc.getCurrentPage();
    assertEquals("iTrust - Document Office Visit", wr.getTitle());

    // Click the Reassign link.
    WebTable tbl = wr.getTableWithID("labProceduresTable");
    assertEquals("Nice Guy", tbl.getCellAsText(2, 1));
    assertTrue(tbl.getCellAsText(2, 10).contains("Reassign"));
    wr = tbl.getTableCell(2, 10).getLinkWith("Reassign").click();

    wr = wc.getCurrentPage();
    assertEquals("iTrust - Reassign Lab Procedure", wr.getTitle());

    // Change the currently-assigned lab tech
    form = wr.getFormWithID("reassignLabProcedureForm");
    form.setParameter("newLabTech", "5000000001");
    form.setParameter("labProcPriority", "1");
    form.getButtonWithID("setLabTech").click();

    assertLogged(TransactionType.LAB_RESULTS_REASSIGN, 9000000000L, 2L, "");
    wr = wc.getCurrentPage();
    assertEquals("iTrust - Document Office Visit", wr.getTitle());

    // Ensure the lab tech has been changed
    tbl = wr.getTableWithID("labProceduresTable");
    assertEquals("Lab Dude", tbl.getCellAsText(2, 1));
  }
예제 #11
0
  /**
   * testHcpLabProc
   *
   * @throws Exception
   */
  public void testHcpLabProc() 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, "");

    // click on Edit ND Codes
    wr = wr.getLinkWith("Laboratory Procedures").click();
    // choose patient 1
    WebForm patientForm = wr.getForms()[0];
    patientForm.getScriptableObject().setParameterValue("UID_PATIENTID", "2");
    patientForm.getButtons()[1].click();
    wr = wc.getCurrentPage();
    // add the codes and description
    assertEquals("iTrust - View Laboratory Procedures", wr.getTitle());
    wr = wr.getLinkWith("Allow/Disallow Viewing").click();
    assertLogged(TransactionType.LAB_RESULTS_VIEW, 9000000000L, 2L, "");
  }
예제 #12
0
  /*
   * HCP 9000000000 has viewed PHR of patient 2.
   * Authenticate Patient
   * MID: 2
   * Password: pw
   * Choose option View Access Log
   */
  public void testViewAccessLog1() throws Exception {
    // clear operational profile
    gen.transactionLog();
    // hcp views phr of patient 2
    // login hcp
    WebConversation wc = login("9000000000", "pw");
    WebResponse wr = wc.getCurrentPage();
    assertEquals("iTrust - HCP Home", wr.getTitle());
    assertLogged(TransactionType.HOME_VIEW, 9000000000L, 0L, "");

    // click Edit PHR
    wr = wr.getLinkWith("PHR Information").click();
    assertEquals(
        ADDRESS + "auth/getPatientID.jsp?forward=hcp-uap/editPHR.jsp", wr.getURL().toString());
    // choose patient 2
    WebForm patientForm = wr.getForms()[0];
    patientForm.getScriptableObject().setParameterValue("UID_PATIENTID", "2");
    patientForm.getButtons()[1].click();
    wr = wc.getCurrentPage();
    assertEquals(ADDRESS + "auth/hcp-uap/editPHR.jsp", wr.getURL().toString());
    assertLogged(TransactionType.PATIENT_HEALTH_INFORMATION_VIEW, 9000000000L, 2L, "");

    // login patient 2
    wc = login("2", "pw");
    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();
    // check the table that displays the access log

    WebTable table = wr.getTableStartingWithPrefix("Date");

    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    java.util.Date date = new java.util.Date();

    assertTrue(table.getCellAsText(1, 0).contains(dateFormat.format(date)));
    assertEquals("Kelly Doctor", table.getCellAsText(1, 1));
    assertTrue(table.getCellAsText(1, 3).contains("View personal health information"));
    assertLogged(TransactionType.ACCESS_LOG_VIEW, 2L, 0L, "");
  }
예제 #13
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, "");
  }
예제 #14
0
  /**
   * Verifies that DLHCP information is correctly hidden in the Access Log for a non-representative.
   *
   * @throws Exception
   */
  public void testViewAccessLogNonRepresentativeView2() throws Exception {
    gen.clearAllTables();
    gen.standardData();

    WebConversation wc = login("9000000007", "pw");
    WebResponse wr = wc.getCurrentPage();
    assertEquals("iTrust - HCP Home", wr.getTitle());

    wr = wr.getLinkWith("Patient Information").click();
    assertEquals("iTrust - Please Select a Patient", wr.getTitle());

    WebForm patientForm = wr.getForms()[0];
    patientForm.getScriptableObject().setParameterValue("UID_PATIENTID", "5");
    patientForm.getButtons()[1].click();
    wr = wc.getCurrentPage();
    assertEquals("iTrust - Edit Patient", wr.getTitle());

    wr = wr.getLinkWith("Basic Health Information").click();
    assertEquals("iTrust - Edit Basic Health Record", wr.getTitle());

    wr = wr.getLinkWith("Logout").click();
    assertEquals("iTrust - Login", wr.getTitle());

    wc = login("9000000000", "pw");
    wr = wc.getCurrentPage();
    assertEquals("iTrust - HCP Home", wr.getTitle());

    wr = wr.getLinkWith("Patient Information").click();
    assertEquals("iTrust - Please Select a Patient", wr.getTitle());

    patientForm = wr.getForms()[0];
    patientForm.getScriptableObject().setParameterValue("UID_PATIENTID", "5");
    patientForm.getButtons()[1].click();
    wr = wc.getCurrentPage();
    assertEquals("iTrust - Edit Patient", wr.getTitle());

    wr = wr.getLinkWith("PHR Information").click();
    assertEquals("iTrust - Edit Personal Health Record", wr.getTitle());

    wr = wr.getLinkWith("Logout").click();
    assertEquals("iTrust - Login", wr.getTitle());

    wc = login("9000000000", "pw");
    wr = wc.getCurrentPage();
    assertEquals("iTrust - HCP Home", wr.getTitle());

    wr = wr.getLinkWith("Patient Information").click();
    assertEquals("iTrust - Please Select a Patient", wr.getTitle());

    patientForm = wr.getForms()[0];
    patientForm.getScriptableObject().setParameterValue("UID_PATIENTID", "5");
    patientForm.getButtons()[1].click();
    wr = wc.getCurrentPage();
    assertEquals("iTrust - Edit Patient", wr.getTitle());

    wr = wr.getLinkWith("Basic Health Information").click();
    assertEquals("iTrust - Edit Basic Health Record", wr.getTitle());

    wr = wr.getLinkWith("Patient Information").click();
    assertEquals("iTrust - Edit Patient", wr.getTitle());

    wr = wr.getLinkWith("PHR Information").click();
    assertEquals("iTrust - Edit Personal Health Record", wr.getTitle());

    wr = wr.getLinkWith("Logout").click();
    assertEquals("iTrust - Login", wr.getTitle());

    wc = login("5", "pw");
    wr = wc.getCurrentPage();
    assertEquals("iTrust - Patient Home", wr.getTitle());

    wr = wr.getLinkWith("Access Log").click();
    assertEquals("iTrust - View My Access Log", wr.getTitle());

    assertFalse(wr.getText().contains("Kelly Doctor"));
    assertTrue(wr.getText().contains("Beaker Beaker"));
  }