示例#1
0
  @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);
  }
示例#2
0
  @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);
  }
示例#3
0
  @Test
  public void testDefaultParallelWorkflow() throws Exception {
    createTestUser(USER_JDOE, USER_JDOE);
    createTestUser(USER_JSMITH, USER_JSMITH);

    // 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();
    SummaryTabSubPage 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
    WorkflowTabSubPage workflowTab = summaryTabPage.getWorkflow();

    workflowTab.endTask("Approve");

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

    // 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());

    // switch to workflow tab and validate task
    workflowTab = summaryTabPage.getWorkflow();

    workflowTab.endTask("Approve");

    // check that the workflow was ended but jdoe_workflow doesn't have the
    // right to
    // start another workflow
    summaryTabPage = workflowTab.getSummaryTab();

    assertEquals("Approved", summaryTabPage.getCurrentLifeCycleState());

    // Check that the wf selector and the start button are no longer visible since we can't start a
    // default workflow
    // on a document on which the current lifecycle state is 'approved'
    try {
      driver.findElement(By.xpath(SummaryTabSubPage.WORKFLOW_SELECTOR_XPATH));
      fail("Default workflow should not be started on 'Approved' documents");
    } catch (NoSuchElementException e) {
      // expected
    }
    try {
      driver.findElement(By.xpath(SummaryTabSubPage.WORKFLOW_START_BUTTON_XPATH));
      fail("Default workflow should not be started on 'Approved' documents");
    } catch (NoSuchElementException e) {
      // expected
    }

    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);
  }