private void synchroniseDirectory3() throws InterruptedException { navigation.gotoAdminSection("user_directories"); WebTable tblDirectoryList = new TableLocator(tester, "directory-list").getTable(); WebLink link = tblDirectoryList.getTableCell(3, 4).getLinkWith("Synchronise"); log("Attempting to synchronise Directory 3"); navigation.clickLink(link); // Synchronise is asynchronous, so we need to check until it is complete int attempts = 0; while (true) { Thread.sleep(1000); // refresh the page to get latest synchronised status navigation.gotoAdminSection("user_directories"); String cellText = new UserDirectoryTable(this).getTableCell(3, 4).asText(); if (cellText.contains("Synchronising for")) { // synch in progress attempts++; if (attempts > 10) { // Just in case... fail("Directory did not finish synchronising. Giving up after " + attempts + " retries."); } log("Still synchronising ..."); } else { assertions.getTextAssertions().assertTextNotPresent("Never synchronised"); break; } } }
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, ""); }
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, ""); }
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 testDeleteUserWithLoan() throws Exception { logger.info("Entered TC18 testDeleteUserWithLoan"); User user; String parameterUserName = "******" + System.currentTimeMillis(); String IsbnName = "testISBN" + System.currentTimeMillis(); user = new User("TestFirstName", "TestLastName", parameterUserName, "password", Role.STUDENT); String parameterBookName = "MyBook" + System.currentTimeMillis(); userService.saveOrUpdate(user); Book book = new Book(parameterBookName, IsbnName, 2); bookService.saveOrUpdate(book); session.refresh(book); logger.info("User added" + user.getUsername()); // now create loan for this user Calendar now = Calendar.getInstance(); now.add(Calendar.MINUTE, 5); logger.info("Book " + book.getBookid() + " user " + user.getUserId()); Loan loan = new Loan(user.getUserId(), book.getBookid(), now.getTime(), 0, 10, false); loandao.saveOrUpdate(loan); loanId = loan.getLoanId(); bookId = book.getBookid(); userId = user.getUserId(); logger.debug("Loan " + loan.getLoanId() + " created for user " + user.getUserId()); logger.info("Loan created: " + loan.getLoanId()); logger.info("trying to delete userID: " + user.getUserId()); WebConversation conversation = new WebConversation(); WebRequest requestDeleteUser = new GetMethodWebRequest(Constant.DELETE_USER_URL + user.getUserId()); WebResponse responseGetUser = conversation.getResponse(requestDeleteUser); WebTable bookListUpdatedTable = responseGetUser.getTableWithID("userListTable"); TableCell tableUpdatedCell = bookListUpdatedTable.getTableCellWithID(user.getUserId()); assertEquals(tableUpdatedCell.getText(), user.getUserId()); logger.info("Exited TC18 testDeleteUserWithLoan"); }
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")); }
/** * 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)); }
/** * 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/")); }
/* * 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, ""); }
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()); }
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, ""); }
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()); }
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 }
/** * 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)); }
/** * 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)); }
/** * 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 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); }
public void testSynchroniseDirectory() throws Exception { if (assertions.getUserAssertions().userExists("wilma")) { log("User wilma was found - attempting to clean up before running test."); deleteUser("wilma"); } assertions.getUserAssertions().assertUserDoesNotExist("wilma"); navigation.gotoAdminSection("user_directories"); assertions.getTextAssertions().assertTextNotPresent("Never synchronised"); // Add a second LDAP directory that actually points to the same LDAP tree. if (isActiveDirectory()) { log("Attempting to add an Active Directory LDAP User Directory..."); addActiveDirectory("LDAP Directory 2"); } else { log("Attempting to add an Open LDAP User Directory..."); addOpenLdap("LDAP Directory 2"); } // Confirm the directory setup: WebTable table = assertions.getTableAssertions().getWebTable("directory-list"); assertions.getTableAssertions().assertTableCellHasText(table, 1, 1, "LDAP Directory"); assertions.getTableAssertions().assertTableCellHasText(table, 2, 1, "JIRA Internal Directory"); assertions.getTableAssertions().assertTableCellHasText(table, 3, 1, "LDAP Directory 2"); assertions.getTextAssertions().assertTextPresent("Never synchronised"); // Do a Synchronise on LDAP 2: synchroniseDirectory3(); // Now add a new User - it will go to LDAP 1 // Add a User to the LDAP directory navigation.gotoAdminSection("user_browser"); tester.clickLink("create_user"); tester.setFormElement("username", "wilma"); tester.setFormElement("fullname", "Wilma Flintstone"); tester.setFormElement("password", "password"); tester.setFormElement("confirm", "password"); tester.setFormElement("email", "*****@*****.**"); tester.submit("Create"); assertions.getUserAssertions().assertUserExists("wilma"); assertions .getUserAssertions() .assertUserDetails("wilma", "Wilma Flintstone", "*****@*****.**", "LDAP Directory"); // Now lets disable the LDAP directory navigation.gotoAdminSection("user_directories"); tester.clickLinkWithText("Disable"); assertions.getTextAssertions().assertTextPresent("LDAP Directory <em>(inactive)</em>"); // Wilma should no longer exist assertions.getUserAssertions().assertUserDoesNotExist("wilma"); // Synchronise LDAP 2 to find the newly added user synchroniseDirectory3(); // Check that Wilma is now found for LDAP 2 assertions.getUserAssertions().assertUserExists("wilma"); assertions .getUserAssertions() .assertUserDetails("wilma", "Wilma Flintstone", "*****@*****.**", "LDAP Directory 2"); // Re-enable the LDAP directory navigation.gotoAdminSection("user_directories"); tester.clickLinkWithText("Enable"); assertions.getTextAssertions().assertTextNotPresent("LDAP Directory <em>(inactive)</em>"); // Wilma should be considered as belonging to LDAP 1 again assertions .getUserAssertions() .assertUserDetails("wilma", "Wilma Flintstone", "*****@*****.**", "LDAP Directory"); // Cleanup - remove LDAP 2 directory navigation.gotoAdminSection("user_directories"); WebTable tblDirectoryList = new TableLocator(tester, "directory-list").getTable(); WebLink link = tblDirectoryList.getTableCell(3, 4).getLinkWith("Disable"); navigation.clickLink(link); tblDirectoryList = new TableLocator(tester, "directory-list").getTable(); link = tblDirectoryList.getTableCell(3, 4).getLinkWith("Remove"); navigation.clickLink(link); // cleanup - delete the user deleteUser("wilma"); assertions.getUserAssertions().assertUserDoesNotExist("wilma"); }
/** * 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)); }
public void testEditLdapDirectory() { navigation.gotoAdminSection("user_directories"); text.assertTextPresent( "The table below shows the user directories currently configured for JIRA."); addDirectory(); WebTable tblDirectoryList = new TableLocator(tester, "directory-list").getTable(); WebLink link = tblDirectoryList.getTableCell(2, 4).getLinkWith("edit"); navigation.clickLink(link); text.assertTextPresent(new IdLocator(tester, "embcwd"), "Server Settings"); tester.setWorkingForm("configure-ldap-form"); tester.setFormElement("name", "First Ldap X"); tester.setFormElement("hostname", getLdapServer()); // For this test we can use AD read-only (no SSL) tester.setFormElement("port", "389"); tester.setFormElement("ldapBasedn", getBaseDn()); tester.setFormElement("ldapUserdn", getUserDn()); tester.setFormElement("ldapPassword", getPassword()); tester.setFormElement("ldapUserObjectclass", "inetorgpersonX"); tester.setFormElement("ldapUserFilter", "(objectclass=inetorgperson)X"); tester.setFormElement("ldapUserUsername", "cnX"); tester.setFormElement("ldapUserUsernameRdn", "cnX"); tester.setFormElement("ldapUserFirstname", "givenNameX"); tester.setFormElement("ldapUserLastname", "snX"); tester.setFormElement("ldapUserDisplayname", "displayNameX"); tester.setFormElement("ldapUserEmail", "mailX"); tester.setFormElement("ldapUserGroup", "memberOfX"); tester.setFormElement("ldapUserPassword", "userPasswordX"); tester.setFormElement("ldapGroupObjectclass", "groupOfUniqueNamesX"); tester.setFormElement("ldapGroupFilter", "(objectclass=groupOfUniqueNames)X"); tester.setFormElement("ldapGroupName", "cnX"); tester.setFormElement("ldapGroupDescription", "descriptionX"); tester.setFormElement("ldapGroupUsernames", "uniqueMemberX"); tester.submit("test"); tester.submit("save"); // Now we are forced to the "Extended test" page assertExtendedTestPageAndReturnToDirectoryList(); text.assertTextPresent( "The table below shows the user directories currently configured for JIRA."); // assert the new directory is added at the end UserDirectoryTable userDirectoryTable = new UserDirectoryTable(this); userDirectoryTable .assertRow(1) .contains("1", "JIRA Internal Directory", "Internal") .hasMoveUp(false) .hasMoveDown(true) .hasOnlyEditOperation(); userDirectoryTable .assertRow(2) .contains("10000", "First Ldap X", getTypeDisplayName() + " (Read Only)") .hasMoveUp(true) .hasMoveDown(false) .hasDisableEditSynchroniseOperations(); // Open the edit screen and check the values to make sure they are stored/retrieved correctly. tblDirectoryList = new TableLocator(tester, "directory-list").getTable(); link = tblDirectoryList.getTableCell(2, 4).getLinkWith("edit"); navigation.clickLink(link); text.assertTextPresent(new IdLocator(tester, "embcwd"), "Server Settings"); tester.setWorkingForm("configure-ldap-form"); assertEquals( "First Ldap X", tester.getDialog().getElement("configure-ldap-form-name").getAttribute("value")); assertEquals( getLdapServer(), tester.getDialog().getElement("configure-ldap-form-hostname").getAttribute("value")); assertEquals( "389", tester.getDialog().getElement("configure-ldap-form-port").getAttribute("value")); assertEquals( getBaseDn(), tester.getDialog().getElement("configure-ldap-form-ldapBasedn").getAttribute("value")); assertEquals( getUserDn(), tester.getDialog().getElement("configure-ldap-form-ldapUserdn").getAttribute("value")); assertEquals( getPassword(), tester.getDialog().getElement("configure-ldap-form-ldapPassword").getAttribute("value")); assertEquals( "inetorgpersonX", tester .getDialog() .getElement("configure-ldap-form-ldapUserObjectclass") .getAttribute("value")); assertEquals( "(objectclass=inetorgperson)X", tester.getDialog().getElement("configure-ldap-form-ldapUserFilter").getAttribute("value")); assertEquals( "cnX", tester .getDialog() .getElement("configure-ldap-form-ldapUserUsername") .getAttribute("value")); assertEquals( "cnX", tester .getDialog() .getElement("configure-ldap-form-ldapUserUsernameRdn") .getAttribute("value")); assertEquals( "givenNameX", tester .getDialog() .getElement("configure-ldap-form-ldapUserFirstname") .getAttribute("value")); assertEquals( "snX", tester .getDialog() .getElement("configure-ldap-form-ldapUserLastname") .getAttribute("value")); assertEquals( "displayNameX", tester .getDialog() .getElement("configure-ldap-form-ldapUserDisplayname") .getAttribute("value")); assertEquals( "mailX", tester.getDialog().getElement("configure-ldap-form-ldapUserEmail").getAttribute("value")); assertEquals( "memberOfX", tester.getDialog().getElement("configure-ldap-form-ldapUserGroup").getAttribute("value")); assertEquals( "userPasswordX", tester .getDialog() .getElement("configure-ldap-form-ldapUserPassword") .getAttribute("value")); assertEquals( "groupOfUniqueNamesX", tester .getDialog() .getElement("configure-ldap-form-ldapGroupObjectclass") .getAttribute("value")); assertEquals( "(objectclass=groupOfUniqueNames)X", tester.getDialog().getElement("configure-ldap-form-ldapGroupFilter").getAttribute("value")); assertEquals( "cnX", tester.getDialog().getElement("configure-ldap-form-ldapGroupName").getAttribute("value")); assertEquals( "descriptionX", tester .getDialog() .getElement("configure-ldap-form-ldapGroupDescription") .getAttribute("value")); assertEquals( "uniqueMemberX", tester .getDialog() .getElement("configure-ldap-form-ldapGroupUsernames") .getAttribute("value")); // Check for mandatory fields // Change the contents and save tester.setFormElement("name", ""); tester.setFormElement("hostname", ""); tester.setFormElement("port", ""); tester.setFormElement("ldapBasedn", ""); tester.setFormElement("ldapUserdn", ""); tester.setFormElement("ldapPassword", ""); tester.setFormElement("ldapUserObjectclass", ""); tester.setFormElement("ldapUserFilter", ""); tester.setFormElement("ldapUserUsername", ""); tester.setFormElement("ldapUserUsernameRdn", ""); tester.setFormElement("ldapUserFirstname", ""); tester.setFormElement("ldapUserLastname", ""); tester.setFormElement("ldapUserDisplayname", ""); tester.setFormElement("ldapUserEmail", ""); tester.setFormElement("ldapUserGroup", ""); tester.setFormElement("ldapUserPassword", ""); tester.setFormElement("ldapGroupObjectclass", ""); tester.setFormElement("ldapGroupFilter", ""); tester.setFormElement("ldapGroupName", ""); tester.setFormElement("ldapGroupDescription", ""); tester.setFormElement("ldapGroupUsernames", ""); tester.submit("test"); // Check for the errors text.assertTextPresent("Name is a required field."); text.assertTextPresent("Hostname is a required field."); text.assertTextPresent("Port is a required field."); // JRA-23819 // text.assertTextPresent("Username is a required field."); // text.assertTextPresent("Password is a required field."); text.assertTextPresent("User object class is a required field."); text.assertTextPresent("User object filter is a required field."); text.assertTextPresent("User name attribute is a required field."); text.assertTextPresent("First name attribute is a required field."); text.assertTextPresent("Last name attribute is a required field."); text.assertTextPresent("User display name attribute is a required field."); text.assertTextPresent("User email attribute is a required field."); text.assertTextPresent("User group attribute is a required field."); text.assertTextPresent("User password attribute is a required field."); text.assertTextPresent("Group object class is a required field."); text.assertTextPresent("Group object filter is a required field."); text.assertTextPresent("Group name attribute is a required field."); text.assertTextPresent("Group description attribute is a required field."); text.assertTextPresent("Group members attribute is a required field."); tester.clickLink("configure-ldap-form-cancel"); text.assertTextPresent( "The table below shows the user directories currently configured for JIRA."); // assert the new directory is added at the end userDirectoryTable = new UserDirectoryTable(this); userDirectoryTable .assertRow(1) .contains("1", "JIRA Internal Directory", "Internal") .hasMoveUp(false) .hasMoveDown(true) .hasOnlyEditOperation(); userDirectoryTable .assertRow(2) .contains("10000", "First Ldap X", getTypeDisplayName() + " (Read Only)") .hasMoveUp(true) .hasMoveDown(false) .hasDisableEditSynchroniseOperations(); // Open the edit screen and check the values to make sure they are stored/retrieved correctly. tblDirectoryList = new TableLocator(tester, "directory-list").getTable(); link = tblDirectoryList.getTableCell(2, 4).getLinkWith("edit"); navigation.clickLink(link); text.assertTextPresent(new IdLocator(tester, "embcwd"), "Server Settings"); tester.setWorkingForm("configure-ldap-form"); tester.submit("test"); tester.submit("save"); // Now we are forced to the "Extended test" page assertExtendedTestPageAndReturnToDirectoryList(); text.assertTextPresent( "The table below shows the user directories currently configured for JIRA."); // assert the new directory is at the end userDirectoryTable = new UserDirectoryTable(this); userDirectoryTable .assertRow(1) .contains("1", "JIRA Internal Directory", "Internal") .hasMoveUp(false) .hasMoveDown(true) .hasOnlyEditOperation(); userDirectoryTable .assertRow(2) .contains("10000", "First Ldap X", getTypeDisplayName() + " (Read Only)") .hasMoveUp(true) .hasMoveDown(false) .hasDisableEditSynchroniseOperations(); }