Exemplo n.º 1
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, "");
  }
Exemplo n.º 2
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, "");
  }
  protected void _testCreateAndDeleteDraftWorkflow(int operationColumn) throws SAXException {
    gotoWorkFlow();
    WebTable table = getDialog().getResponse().getTableWithID("workflows_table");
    assertEquals(5, table.getRowCount());
    // Assert that 'Workflow1' is Active and we have an "edit" link in order to create a draft.
    assertTableCellHasText("workflows_table", 2, 0, "Workflow1");
    assertTableCellHasText("workflows_table", 2, 2, "Active");

    assertTableCellHasText("workflows_table", 2, operationColumn, "Create Draft");
    assertTextNotInColumn("workflows_table", 2, "Draft");

    // lets create a draft
    clickLink("createDraft_Workflow1");
    clickLinkWithText("workflows.");

    // check that the workflows table now has a draft workflow.
    // Assert that 'Workflow1' is Active and we do not have a "edit" link
    assertTableCellHasText("workflows_table", 2, 0, "Workflow1");
    assertTableCellHasText("workflows_table", 2, 2, "Active");
    assertTableCellHasNotText("workflows_table", 2, operationColumn, "Create Draft");
    table = getDialog().getResponse().getTableWithID("workflows_table");
    assertEquals(6, table.getRowCount());

    assertTableCellHasText("workflows_table", 3, 0, "Workflow1");
    assertTableCellHasText("workflows_table", 3, 2, "Draft");
    assertTableCellHasText("workflows_table", 3, operationColumn, "Delete");
    assertTableCellHasText("workflows_table", 3, operationColumn, "Publish");

    // now lets try to delete the draft workflow!
    clickLink("del_Workflow1");
    assertTextPresent("Delete Draft Workflow");
    assertTextPresent(
        "Confirm that you want to delete the draft workflow <strong>Workflow1</strong>.");
    submit("Delete");

    assertTableCellHasText("workflows_table", 2, 0, "Workflow1");
    assertTableCellHasText("workflows_table", 2, 2, "Active");
    assertTableCellHasText("workflows_table", 2, operationColumn, "Create Draft");
    assertTextNotInColumn("workflows_table", 2, "Draft");
    table = getDialog().getResponse().getTableWithID("workflows_table");
    assertEquals(5, table.getRowCount());
  }
Exemplo n.º 4
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
  }
  public void testPublishDraftWithoutBackup() throws SAXException {
    gotoWorkFlow();

    // lets create draft workflow first.
    clickLink("createDraft_Workflow1");

    clickLink("workflows");

    // check we have 6 rows in the table.
    WebTable table = getDialog().getResponse().getTableWithID("workflows_table");
    assertEquals(6, table.getRowCount());

    // publish the draft without creating a backup.
    clickLink("publishDraft_Workflow1");
    // set the enableBackup radio button.
    checkCheckbox("enableBackup", "false");
    submit("Publish");

    // there should now be one less row in the table.
    table = getDialog().getResponse().getTableWithID("workflows_table");
    assertEquals(5, table.getRowCount());
  }
Exemplo n.º 6
0
  /**
   * testPatientViewLabProcedureResults
   *
   * @throws Exception
   */
  public void testPatientViewLabProcedureResults() throws Exception {
    gen.clearAllTables();
    gen.standardData();

    WebConversation wc = login("22", "pw");
    WebResponse wr = wc.getCurrentPage();
    assertEquals("iTrust - Patient Home", wr.getTitle());
    wr = wr.getLinkWith("My Lab Procedures").click();

    assertEquals("iTrust - View Lab Procedures", wr.getTitle());
    WebTable tbl = wr.getTableWithID("labProceduresTable");
    assertEquals(51, tbl.getRowCount());

    int numericalColumn = 5;
    assertEquals("", tbl.getCellAsText(13, numericalColumn));
    assertEquals("", tbl.getCellAsText(12, numericalColumn));
    assertEquals("", tbl.getCellAsText(11, numericalColumn));

    assertEquals("7", tbl.getCellAsText(10, numericalColumn));
    assertEquals("", tbl.getCellAsText(9, numericalColumn));
    assertEquals("", tbl.getCellAsText(8, numericalColumn));

    assertEquals("", tbl.getCellAsText(7, numericalColumn));
    assertEquals("5.23", tbl.getCellAsText(6, numericalColumn));
    assertEquals("", tbl.getCellAsText(5, numericalColumn));

    assertEquals("", tbl.getCellAsText(4, numericalColumn));
    assertEquals("", tbl.getCellAsText(3, numericalColumn));
    assertEquals("18", tbl.getCellAsText(2, numericalColumn));

    int statusColumn = 3;
    assertEquals("In Transit", tbl.getCellAsText(13, statusColumn));
    assertEquals("Received", tbl.getCellAsText(12, statusColumn));
    assertEquals("Pending", tbl.getCellAsText(11, statusColumn));

    assertEquals("Completed", tbl.getCellAsText(10, statusColumn));
    assertEquals("In Transit", tbl.getCellAsText(9, statusColumn));
    assertEquals("Received", tbl.getCellAsText(8, statusColumn));

    assertEquals("Pending", tbl.getCellAsText(7, statusColumn));
    assertEquals("Completed", tbl.getCellAsText(6, statusColumn));
    assertEquals("In Transit", tbl.getCellAsText(5, statusColumn));

    assertEquals("Received", tbl.getCellAsText(4, statusColumn));
    assertEquals("Pending", tbl.getCellAsText(3, statusColumn));
    assertEquals("Completed", tbl.getCellAsText(2, statusColumn));
  }
Exemplo n.º 7
0
  /**
   * testPatient_LabProcedureViewChart
   *
   * @throws Exception
   */
  public void testPatient_LabProcedureViewChart() throws Exception {
    gen.clearAllTables();
    gen.standardData();
    gen.patientLabProcedures();

    WebConversation wc = login("21", "pw");
    WebResponse wr = wc.getCurrentPage();
    assertEquals("iTrust - Patient Home", wr.getTitle());
    wr = wr.getLinkWith("My Lab Procedures").click();

    assertEquals("iTrust - View Lab Procedures", wr.getTitle());
    WebTable tbl = wr.getTableWithID("labProceduresTable");
    assertEquals(5, tbl.getRowCount());

    wr = wr.getLinkWithID("viewResultsChart").click();
    assertEquals("Lab Procedure Results Chart", wr.getTitle());
    // assertTrue(wr.getText().contains("src=\"/iTrust/charts/"));
  }
Exemplo n.º 8
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, "");
  }
Exemplo n.º 9
0
  /**
   * testPatient_LabProcedureView2
   *
   * @throws Exception
   */
  public void testPatient_LabProcedureView2() throws Exception {
    gen.clearAllTables();
    gen.standardData();
    gen.patientLabProcedures();

    WebConversation wc = login("1", "pw");
    WebResponse wr = wc.getCurrentPage();
    assertEquals("iTrust - Patient Home", wr.getTitle());
    wr = wr.getLinkWith("My Lab Procedures").click();

    assertEquals("iTrust - View Lab Procedures", wr.getTitle());
    WebTable tbl = wr.getTableWithID("labProceduresTable");
    assertEquals(5, tbl.getRowCount());

    assertEquals("Kelly Doctor", tbl.getCellAsText(2, 0));
    assertEquals("10/20/2011", tbl.getCellAsText(2, 1));
    assertEquals("Specimen volume", tbl.getCellAsText(2, 2));
    assertEquals("Completed", tbl.getCellAsText(2, 3));

    assertEquals("", tbl.getCellAsText(2, 4));
    assertEquals("79", tbl.getCellAsText(2, 5));
    assertEquals("ml", tbl.getCellAsText(2, 6));
    assertEquals("Abnormal", tbl.getCellAsText(2, 7));
  }
Exemplo n.º 10
0
  /**
   * testPatient_LabProcedureView
   *
   * @throws Exception
   */
  public void testPatient_LabProcedureView() throws Exception {
    gen.clearAllTables();
    gen.standardData();
    gen.patientLabProcedures();

    WebConversation wc = login("2", "pw");
    WebResponse wr = wc.getCurrentPage();
    assertEquals("iTrust - Patient Home", wr.getTitle());
    wr = wr.getLinkWith("My Lab Procedures").click();

    assertEquals("iTrust - View Lab Procedures", wr.getTitle());
    WebTable tbl = wr.getTableWithID("labProceduresTable");
    assertEquals(4, tbl.getRowCount());

    assertEquals("Kelly Doctor", tbl.getCellAsText(2, 0));
    assertEquals("11/20/2011", tbl.getCellAsText(2, 1));
    assertEquals("Microscopic Observation", tbl.getCellAsText(2, 2));
    assertEquals("Completed", tbl.getCellAsText(2, 3));

    assertEquals("Its all done", tbl.getCellAsText(2, 4));
    assertEquals("85", tbl.getCellAsText(2, 5));
    assertEquals("grams", tbl.getCellAsText(2, 6));
    assertEquals("Normal", tbl.getCellAsText(2, 7));
  }