@Test public void testDefaultSerialWorkflow() throws Exception { createTestUser(USER_JDOE, USER_JDOE); // create a file doc DocumentBasePage defaultDomainPage = login(); DocumentBasePage filePage = initRepository(defaultDomainPage); // start the default serial workflow and choose jdoe_workflow as // reviewer filePage = startDefaultSerialWorkflow(filePage, USER_JDOE); logout(); filePage = login(USER_JDOE, USER_JDOE); UserHomePage homePage = filePage.getUserHome(); // check that jdoe_workflow has an open task on his tasks dashboard WorkflowHomePage workflowHomePage = homePage.getWorkflowHomePage(); assertTrue(workflowHomePage.taskExistsOnTasksDashboard("Validate the document")); workflowHomePage.processFirstTask(); SummaryTabSubPage summaryTabPage = workflowHomePage.redirectToTask("Test file"); // check that the open task is displayed on the summary page assertTrue(summaryTabPage.workflowAlreadyStarted()); assertTrue(summaryTabPage.openTaskForCurrentUser()); // switch to workflow tab and validate task WorkflowTabSubPage workflowTab = summaryTabPage.getWorkflow(); WebElement taskLayoutDiv = workflowTab.getTaskLayoutNode(); // get value for Participants on the review that were set on the // previous step // the value is stored in a global workflow variable String participantsOnTheReview = taskLayoutDiv.findElement(By.className("user")).getText(); assertEquals("jdoe_workflow lastname1", participantsOnTheReview); workflowTab.endTask("Validate"); summaryTabPage = workflowTab.getSummaryTab(); homePage = filePage.getUserHome(); // check that jdoe_workflow doesn't have the task on his workflow tasks // dashboard workflowHomePage = homePage.getWorkflowHomePage(); assertTrue(workflowHomePage.isTasksDashboardEmpty()); // cleanup file doc and user logout(); login(); cleanRepository(filePage); logout(); deleteTestUser(USER_JDOE); }
@Test public void testTaskReassignmentAndDelegation() throws Exception { createTestUser(USER_JDOE, USER_JDOE); createTestUser(USER_BREE, USER_BREE); createTestUser(USER_JSMITH, USER_JSMITH); createTestUser(USER_LINNET, USER_LINNET); // create a file doc DocumentBasePage defaultDomainPage = login(); DocumentBasePage filePage = initRepository(defaultDomainPage); // start the default parallel workflow and choose jdoe_workflow and // jsmith_workflow as // reviewers filePage = startDefaultParallelWorkflow(filePage); logout(); filePage = login(USER_JDOE, USER_JDOE); UserHomePage homePage = filePage.getUserHome(); // check that jdoe_workflow has an open task on his tasks dashboard WorkflowHomePage workflowHomePage = homePage.getWorkflowHomePage(); assertTrue(workflowHomePage.taskExistsOnTasksDashboard("Give your opinion")); workflowHomePage.processFirstTask(); // reassign task to bree_workflow workflowHomePage.reassignTask("Give your opinion", USER_BREE); // check that jdoe_workflow has no longer the task assertTrue(workflowHomePage.isTasksDashboardEmpty()); // login with bree_workflow to process this task filePage = login(USER_BREE, USER_BREE); homePage = filePage.getUserHome(); workflowHomePage = homePage.getWorkflowHomePage(); assertTrue(workflowHomePage.taskExistsOnTasksDashboard("Give your opinion")); workflowHomePage.processFirstTask(); SummaryTabSubPage summaryTabPage = workflowHomePage.redirectToTask("Test file"); // check that the open task is displayed on the summary page assertTrue(summaryTabPage.workflowAlreadyStarted()); assertTrue(summaryTabPage.parallelOpenTaskForCurrentUser()); WorkflowTabSubPage workflowTab = summaryTabPage.getWorkflow(); workflowTab.endTask("Approve", "Approve comment"); // check that jsmith_workflow has an open task on his dashboard filePage = login(USER_JSMITH, USER_JSMITH); homePage = filePage.getUserHome(); workflowHomePage = homePage.getWorkflowHomePage(); assertTrue(workflowHomePage.taskExistsOnTasksDashboard("Give your opinion")); workflowHomePage.processFirstTask(); // delegate his task to linnet_workflow workflowHomePage.delegateTask("Give your opinion", USER_LINNET); // test that jsmith_workflow can still see the task assertTrue(workflowHomePage.taskExistsOnTasksDashboard("Give your opinion")); // login with linnet_workflow to process the task filePage = login(USER_LINNET, USER_LINNET); homePage = filePage.getUserHome(); workflowHomePage = homePage.getWorkflowHomePage(); assertTrue(workflowHomePage.taskExistsOnTasksDashboard("Give your opinion")); workflowHomePage.processFirstTask(); summaryTabPage = workflowHomePage.redirectToTask("Test file"); // check that the open task is displayed on the summary page assertTrue(summaryTabPage.workflowAlreadyStarted()); assertTrue(summaryTabPage.parallelOpenTaskForCurrentUser()); // switch to workflow tab and validate task workflowTab = summaryTabPage.getWorkflow(); workflowTab.endTask("Reject", "Reject comment"); // login with Administrator. the workflow initiator to check the final // task filePage = login(); homePage = filePage.getUserHome(); workflowHomePage = homePage.getWorkflowHomePage(); assertTrue(workflowHomePage.taskExistsOnTasksDashboard("Consolidate the review")); workflowHomePage.processFirstTask(); summaryTabPage = workflowHomePage.redirectToTask("Test file"); assertTrue(summaryTabPage.workflowAlreadyStarted()); // check the consultation wrap-up workflowTab = summaryTabPage.getWorkflow(); WebElement taskLayoutDiv = workflowTab.getTaskLayoutNode(); String parallelConsultationWrapUp = taskLayoutDiv.findElement(By.xpath("//span[contains(@id, 'nxw_review_result')]")).getText(); assertTrue( parallelConsultationWrapUp.contains( "bree_workflow lastname1 bree_workflow OK Approve comment")); assertTrue( parallelConsultationWrapUp.contains( "linnet_workflow lastname1 linnet_workflow KO Reject comment")); // end the last task workflowTab.endTask("Approve"); summaryTabPage = workflowTab.getSummaryTab(); assertEquals("Approved", summaryTabPage.getCurrentLifeCycleState()); homePage = filePage.getUserHome(); // check that Administrator doesn't have the task on his workflow tasks // dashboard workflowHomePage = homePage.getWorkflowHomePage(); assertTrue(workflowHomePage.isTasksDashboardEmpty()); // cleanup file doc and user logout(); login(); cleanRepository(filePage); logout(); deleteTestUser(USER_JDOE); deleteTestUser(USER_JSMITH); deleteTestUser(USER_BREE); deleteTestUser(USER_LINNET); }