Example #1
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."));
  }
Example #2
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, "");
  }
Example #3
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
  }
Example #4
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));
  }