/** * 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>")); }
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()); }
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, ""); }
/** * 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 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, ""); }
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 }
/** * 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)); }
/** * 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 }
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, ""); }