Example #1
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, "");
    */

  }
Example #2
0
  public void testRemoveAppt() throws Exception {
    // login hcp
    gen.uc22();
    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];
    int row = 0;
    for (int i = 0; i < table.getRowCount(); i++) {
      if (table.getCellAsText(i, 0).equals("Anakin Skywalker")) {
        row = i;
        break;
      }
    }

    wr = table.getTableCell(row, 5).getLinkWith("Edit/Remove").click();
    assertTrue(wr.getText().contains("Anakin Skywalker"));
    WebForm wf = wr.getFormWithID("mainForm");

    wf.getSubmitButtonWithID("removeButton").click();
    wr = wc.getCurrentPage();

    assertTrue(wr.getText().contains("Success: Appointment removed"));
    assertLogged(TransactionType.APPOINTMENT_REMOVE, 9000000000L, 100L, "");
  }
Example #3
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"));
  }
Example #4
0
  public void testSetPassedDate() throws Exception {
    // login hcp
    gen.uc22();
    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];
    int row = 0;
    for (int i = 0; i < table.getRowCount(); i++) {
      if (table.getCellAsText(i, 0).equals("Anakin Skywalker")) {
        row = i;
        break;
      }
    }

    wr = table.getTableCell(row, 5).getLinkWith("Edit/Remove").click();
    assertTrue(wr.getText().contains("Anakin Skywalker"));
    WebForm wf = wr.getFormWithID("mainForm");
    wf.setParameter("schedDate", "10/10/2009");

    wf.getSubmitButtonWithID("changeButton").click();
    wr = wc.getCurrentPage();

    assertTrue(wr.getText().contains("The scheduled date of this appointment"));
    assertTrue(wr.getText().contains("has already passed."));
    assertNotLogged(TransactionType.APPOINTMENT_EDIT, 9000000000L, 100L, "");
  }
Example #5
0
  /**
   * Verifies that a representative is able to view the access log of a representee.
   *
   * @throws Exception
   */
  public void testViewAccessLogRepresentativeView() throws Exception {
    gen.clearAllTables();
    gen.standardData();

    WebConversation wc = login("24", "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());

    // select Dare Devil from the dropdown menu
    WebForm representeeSelectForm = wr.getFormWithID("logMIDSelectionForm");
    representeeSelectForm.setParameter("logMID", "23");
    representeeSelectForm.submit();

    wr = wc.getCurrentPage();

    assertFalse(wr.getText().contains("Beaker Beaker"));
    assertTrue(wr.getText().contains("<td >2007-06-23 06:55:59.0</td>"));

    wr = wr.getLinkWith("Role").click();
    assertEquals("iTrust - View My Access Log", wr.getTitle());
    assertFalse(wr.getText().contains("Beaker Beaker"));
    assertTrue(wr.getText().contains("<td >2007-06-23 06:55:59.0</td>"));

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

    assertFalse(wr.getText().contains("Kelly Doctor"));
    assertTrue(wr.getText().contains("<td >2007-06-25 06:54:59.0</td>"));
  }
Example #6
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;
  }
Example #7
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, "");
  }
Example #8
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 #9
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, "");
  }
Example #10
0
  /**
   * testLabProcedureInTransitToReceived
   *
   * @throws Exception
   */
  public void testLabProcedureInTransitToReceived() throws Exception {
    gen.clearAllTables();
    gen.standardData();
    WebConversation wc = login("5000000001", "pw");

    WebResponse wr = wc.getCurrentPage();
    assertEquals("iTrust - Lab Tech Home", wr.getTitle());

    wr = wr.getLinkWith("All Lab Procedures").click();
    assertEquals("iTrust - View Laboratory Procedures", wr.getTitle());

    // Ensure the table of received lab procedures has only one entry
    WebTable tbl = wr.getTableWithID("receivedTable");
    assertEquals(3, tbl.getRowCount());
    assertEquals("Beaker Beaker", tbl.getCellAsText(2, 4));

    // Check table of in-transit lab procedures
    tbl = wr.getTableWithID("inTransitTable");
    assertEquals(20, tbl.getRowCount());
    String labProcID = tbl.getCellAsText(2, 0); // lab proc id is auto-assigned
    // Click "Set to Received" on Lab Procedure
    WebForm form = wr.getFormWithID("inTransitForm");
    Button receivedButton = form.getButtons()[0];
    assertEquals("Set to Received", receivedButton.getText());
    receivedButton.click();

    wr = wc.getCurrentPage();
    assertEquals("iTrust - View Laboratory Procedures", wr.getTitle());

    // Ensure the table of received lab procedures contains the modified lab procedure.
    tbl = wr.getTableWithID("receivedTable");
    assertEquals(4, tbl.getRowCount());
    // assertFalse(tbl.getCellAsText(2, 0).contains("There are no received lab procedures"));
    assertEquals(labProcID, tbl.getCellAsText(2, 0)); // check that the lab proc is now here

    // Check that table of in-transit lab procedures has no lab procedures
    tbl = wr.getTableWithID("inTransitTable");
    assertEquals(19, tbl.getRowCount());
    // assertTrue(tbl.getCellAsText(2, 0).contains("There are no lab procedures in transit"));  //
    // lab procedure ID
  }
Example #11
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, "");
  }
Example #12
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, "");
  }
Example #13
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."));
  }
  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());
  }
Example #15
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 #16
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>"));
    */
  }
Example #17
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));
  }
 public void testSimpleUser() throws Exception {
   WebConversation connection = new WebConversation();
   WebResponse loginPage = connection.getResponse(buildUrl("silverpeas/"));
   assertNotNull(loginPage);
   WebForm loginForm = loginPage.getFormWithName("EDform");
   assertNotNull(loginForm);
   loginForm.setParameter("Login", "SilverAdmin");
   loginForm.setParameter("Password", "SilverAdmin");
   HttpUnitOptions.setScriptingEnabled(false);
   WebResponse welcomePage = loginForm.submit();
   assertNotNull(welcomePage);
   String[] frameNames = welcomePage.getFrameNames();
   assertEquals(5, frameNames.length);
   WebResponse navigationFrame = connection.getFrameContents("bottomFrame");
   assertNotNull(navigationFrame);
   navigationFrame = connection.getFrameContents("SpacesBar");
   assertNotNull(navigationFrame);
   WebLink mailingListLink = navigationFrame.getLinkWith("Liste de diffusion");
   assertNotNull(mailingListLink);
   HttpUnitOptions.setScriptingEnabled(false);
   WebResponse activityPage = connection.getResponse(buildUrl(mailingListLink.getURLString()));
   assertNotNull(activityPage);
   WebTable browseBar = activityPage.getTableWithID("browseBar");
   assertNotNull(browseBar);
   assertEquals("MGI Coutier > Liste de diffusion > Activité", browseBar.getCellAsText(0, 0));
   assertEquals(
       "Main", browseBar.getTableCell(0, 0).getLinkWith("Liste de diffusion").getURLString());
   WebTable tableDescription = activityPage.getTableWithID("description");
   assertNotNull(tableDescription);
   String description = tableDescription.getCellAsText(1, 0);
   assertEquals("Liste de diffusion de test", description);
   WebTable tableAddress = activityPage.getTableWithID("subscribedAddress");
   assertNotNull(tableAddress);
   String subscribedAddress = tableAddress.getCellAsText(1, 0);
   assertEquals("*****@*****.**", subscribedAddress);
   WebTable tableHistory = activityPage.getTableWithID("activities");
   assertNotNull(tableHistory);
   assertEquals("Historique des Messages", tableHistory.getCellAsText(0, 0));
   assertEquals("2007", tableHistory.getCellAsText(2, 0));
   assertEquals("", tableHistory.getCellAsText(2, 1));
   assertEquals("", tableHistory.getCellAsText(2, 2));
   assertEquals("", tableHistory.getCellAsText(2, 3));
   assertEquals("", tableHistory.getCellAsText(2, 4));
   assertEquals("", tableHistory.getCellAsText(2, 5));
   assertEquals("", tableHistory.getCellAsText(2, 6));
   assertEquals("", tableHistory.getCellAsText(2, 7));
   assertEquals("", tableHistory.getCellAsText(2, 8));
   assertEquals("", tableHistory.getCellAsText(2, 9));
   assertEquals("", tableHistory.getCellAsText(2, 10));
   assertEquals("2", tableHistory.getCellAsText(2, 11));
   assertEquals("2", tableHistory.getCellAsText(2, 12));
   assertEquals("1", tableHistory.getCellAsText(3, 1));
   assertEquals("3", tableHistory.getCellAsText(3, 2));
   assertEquals("3", tableHistory.getCellAsText(3, 3));
   assertEquals("", tableHistory.getCellAsText(3, 4));
   assertEquals("", tableHistory.getCellAsText(3, 5));
   assertEquals("", tableHistory.getCellAsText(3, 6));
   assertEquals("", tableHistory.getCellAsText(3, 7));
   assertEquals("", tableHistory.getCellAsText(3, 8));
   assertEquals("", tableHistory.getCellAsText(3, 9));
   assertEquals("", tableHistory.getCellAsText(3, 10));
   assertEquals("", tableHistory.getCellAsText(3, 11));
   assertEquals("", tableHistory.getCellAsText(3, 12));
   assertEquals(
       "list/mailinglist45/currentYear/2007/currentMonth/11",
       tableHistory.getTableCell(2, 12).getLinkWith("2").getURLString());
   assertEquals(
       "list/mailinglist45/currentYear/2008/currentMonth/2",
       tableHistory.getTableCell(3, 3).getLinkWith("3").getURLString());
   WebTable tableMessages = activityPage.getTableWithID("messages");
   assertNotNull(tableMessages);
   assertEquals("Message récents", tableMessages.getCellAsText(0, 0));
   assertEquals("Simple database message 3", tableMessages.getCellAsText(1, 0));
   assertEquals(
       MESSAGE_BASE + 3,
       tableMessages.getTableCell(1, 0).getLinkWith("Simple database message 3").getURLString());
   assertEquals(
       "[email protected] - 02/03/2008 10:34:15", tableMessages.getCellAsText(2, 0));
   assertEquals(
       "Bonjour famille Simpson, j\'espère que vous allez bien. Ici "
           + "tout se passe bien et Krusty est très sympathique. Surtout depuis que "
           + "Tahiti Bob est retourné en prison. Je dois remplacer l\'homme canon "
           + "dans ...",
       tableMessages.getCellAsText(3, 0));
   assertEquals(MESSAGE_BASE + 3, tableMessages.getTableCell(3, 0).getLinks()[0].getURLString());
   assertEquals("Simple database message 4", tableMessages.getCellAsText(4, 0));
   assertEquals(
       MESSAGE_BASE + 4,
       tableMessages.getTableCell(4, 0).getLinkWith("Simple database message 4").getURLString());
   assertEquals(
       "[email protected] - 02/03/2008 10:12:15", tableMessages.getCellAsText(5, 0));
   assertEquals(
       "Bonjour famille Simpson, j\'espère que vous allez bien. Ici "
           + "tout se passe bien et Krusty est très sympathique. Surtout depuis que "
           + "Tahiti Bob est retourné en prison. Je dois remplacer l\'homme canon "
           + "dans ...",
       tableMessages.getCellAsText(6, 0));
   assertEquals(MESSAGE_BASE + 4, tableMessages.getTableCell(6, 0).getLinks()[0].getURLString());
   assertEquals("Simple database message 1", tableMessages.getCellAsText(7, 0));
   assertEquals(
       MESSAGE_BASE + 1,
       tableMessages.getTableCell(7, 0).getLinkWith("Simple database message 1").getURLString());
   assertEquals(
       "[email protected] - 01/03/2008 10:34:15", tableMessages.getCellAsText(8, 0));
   assertEquals(
       "Bonjour famille Simpson, j\'espère que vous allez bien. Ici "
           + "tout se passe bien et Krusty est très sympathique. Surtout depuis que "
           + "Tahiti Bob est retourné en prison. Je dois remplacer l\'homme canon "
           + "dans ...",
       tableMessages.getCellAsText(9, 0));
   assertEquals(MESSAGE_BASE + 1, tableMessages.getTableCell(9, 0).getLinks()[0].getURLString());
   assertEquals("Simple database message 11", tableMessages.getCellAsText(10, 0));
   assertEquals(
       MESSAGE_BASE + 11,
       tableMessages.getTableCell(10, 0).getLinkWith("Simple database message 11").getURLString());
   assertEquals(
       "[email protected] - 21/02/2008 10:34:15", tableMessages.getCellAsText(11, 0));
   assertEquals(
       "Bonjour famille Simpson, j\'espère que vous allez bien. Ici "
           + "tout se passe bien et Krusty est très sympathique. Surtout depuis que "
           + "Tahiti Bob est retourné en prison. Je dois remplacer l\'homme canon "
           + "dans ...",
       tableMessages.getCellAsText(12, 0));
   assertEquals(MESSAGE_BASE + 11, tableMessages.getTableCell(12, 0).getLinks()[0].getURLString());
   WebTable tableTabbedPane = activityPage.getTableWithID("tabbedPane");
   assertNotNull(tableTabbedPane);
   tableTabbedPane = tableTabbedPane.getTableCell(0, 0).getTables()[0];
   assertNotNull(tableTabbedPane);
   assertEquals("Activité", tableTabbedPane.getCellAsText(0, 2));
   assertEquals("Liste des Messages", tableTabbedPane.getCellAsText(0, 5));
   assertFalse(activityPage.getText().indexOf("Modération") > 0);
   assertFalse(activityPage.getText().indexOf("Abonnés Extérieurs") > 0);
 }
Example #19
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"));
  }