Ejemplo n.º 1
0
  /**
   * Tests restore version.
   *
   * @param docPage the current doc page
   * @return the current doc page
   */
  protected DocumentBasePage testRestoreVersion(DocumentBasePage docPage) {

    // Go to archived versions sub tab
    ArchivedVersionsSubPage archivedVersionsPage =
        docPage.getHistoryTab().getArchivedVersionsSubTab();

    // Restore version 1.0 and check its title
    DocumentBasePage restoredVersionPage = archivedVersionsPage.restoreVersion("1.0");
    restoredVersionPage.checkDocTitle("Test file: modif 1");

    // Return doc
    return restoredVersionPage;
  }
Ejemplo n.º 2
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);
  }
Ejemplo n.º 3
0
  /**
   * Tests delete versions.
   *
   * @param docPage the current doc page
   * @return the current doc page
   */
  protected DocumentBasePage testDeleteVersions(DocumentBasePage docPage) {

    // Go to archived versions sub tab
    ArchivedVersionsSubPage archivedVersionsPage =
        docPage.getHistoryTab().getArchivedVersionsSubTab();

    // Check cannot delete versions since none is selected
    archivedVersionsPage.checkCanRemoveSelectedVersions(false);

    // Select version 1.0
    archivedVersionsPage = archivedVersionsPage.selectVersion("1.0");

    // Check can delete versions since one is selected
    archivedVersionsPage.checkCanRemoveSelectedVersions(true);

    // Select version 2.0
    archivedVersionsPage = archivedVersionsPage.selectVersion("2.0");

    // Check can delete versions since two are selected
    archivedVersionsPage.checkCanRemoveSelectedVersions(true);

    // Delete selected versions
    archivedVersionsPage = archivedVersionsPage.removeSelectedVersions();

    // Check version labels, there should be none
    List<String> versionLabels = archivedVersionsPage.getVersionLabels();
    assertEquals(0, versionLabels.size());

    // Go back to doc and return it
    return archivedVersionsPage.goToDocumentByBreadcrumb("Test file: modif 1");
  }
Ejemplo n.º 4
0
  /**
   * Tests view versions.
   *
   * @param docPage the current doc page
   * @return the current doc page
   */
  protected DocumentBasePage testViewVersions(DocumentBasePage docPage) {

    // Go to archived versions sub tab
    ArchivedVersionsSubPage archivedVersionsPage =
        docPage.getHistoryTab().getArchivedVersionsSubTab();

    // Check version labels
    List<String> versionLabels = archivedVersionsPage.getVersionLabels();
    List<String> expectedVersionLabels = new ArrayList<String>();
    expectedVersionLabels.add("1.0");
    expectedVersionLabels.add("2.0");
    assertEquals(expectedVersionLabels, versionLabels);

    // View version 1.0 and check its title
    DocumentBasePage versionPage = archivedVersionsPage.viewVersion("1.0");
    versionPage.checkDocTitle("Test file: modif 1 (Version 1.0)");

    // Go back to doc
    docPage = versionPage.goToDocumentByBreadcrumb("Test file: modif 2");

    // Go to archived versions sub tab
    archivedVersionsPage = docPage.getHistoryTab().getArchivedVersionsSubTab();

    // View version 2.0 and check its title
    versionPage = archivedVersionsPage.viewVersion("2.0");
    versionPage.checkDocTitle("Test file: modif 2 (Version 2.0)");

    // Go back to doc and return it
    return versionPage.goToDocumentByBreadcrumb("Test file: modif 2");
  }
Ejemplo n.º 5
0
 protected DocumentBasePage startDefaultSerialWorkflow(
     DocumentBasePage filePage, final String username) {
   // start workflow
   SummaryTabSubPage summaryTabPage = filePage.getSummaryTab();
   summaryTabPage.startDefaultWorkflow();
   assertTrue(
       summaryTabPage
           .workflowTasksForm
           .getText()
           .contains("Please select some participants for the review"));
   // click on the workflow tab
   WorkflowTabSubPage workflowTab = filePage.getWorkflow();
   workflowTab.showGraphView();
   workflowTab.closeGraphView();
   workflowTab.addWorkflowReviewer(username);
   workflowTab.startWorkflow();
   summaryTabPage = filePage.getSummaryTab();
   assertTrue(summaryTabPage.workflowAlreadyStarted());
   return filePage;
 }
Ejemplo n.º 6
0
  protected DocumentBasePage startDefaultParallelWorkflow(DocumentBasePage filePage) {
    // start workflow
    SummaryTabSubPage summaryTabPage = filePage.getSummaryTab();
    summaryTabPage.startDefaultParallelWorkflow();
    assertTrue(
        summaryTabPage
            .workflowTasksForm
            .getText()
            .contains("Please select some participants for the review"));
    // click on the workflow tab
    WorkflowTabSubPage workflowTab = filePage.getWorkflow();
    workflowTab.showGraphView();
    workflowTab.closeGraphView();
    workflowTab.addParallelWorkflowReviewer(USER_JDOE);
    workflowTab.addParallelWorkflowReviewer(USER_JSMITH);
    workflowTab.addParallelWorkflowEndDate();
    workflowTab.startWorkflow();

    summaryTabPage = filePage.getSummaryTab();
    assertTrue(summaryTabPage.workflowAlreadyStarted());
    return filePage;
  }
Ejemplo n.º 7
0
  /**
   * Copy and paste a simple file.
   *
   * @since 5.8
   */
  @Test
  public void testSimpleCopyAndPaste()
      throws UserNotConnectedException, IOException, ParseException {
    // NXP-18344, to be removed once upgraded to more recent webdriver lib
    doNotRunOnWindowsWithFF26();

    prepare();

    DocumentBasePage documentBasePage;

    // Log as test user and edit the created workspace
    documentBasePage =
        loginAsTestUser()
            .getContentTab()
            .goToDocument("Workspaces")
            .getContentTab()
            .goToDocument(WORKSPACE1_TITLE);

    ContentTabSubPage contentTabSubPage = documentBasePage.getContentTab();

    contentTabSubPage.copyByTitle(FILE1_NAME);

    documentBasePage =
        contentTabSubPage.getHeaderLinks().getNavigationSubPage().goToDocument(WORKSPACE2_TITLE);

    contentTabSubPage = documentBasePage.getContentTab();

    contentTabSubPage = contentTabSubPage.paste();

    List<WebElement> docs = contentTabSubPage.getChildDocumentRows();

    assertNotNull(docs);
    assertEquals(docs.size(), 1);
    assertNotNull(docs.get(0).findElement(By.linkText(FILE1_NAME)));

    restoreSate();
  }
  @Test
  public void testModifyWsDescription() throws Exception {

    // As an administrator, check that jsmith is created and has rights
    UsersGroupsBasePage usergroupPage = login().getAdminCenter().getUsersGroupsHomePage();
    UsersTabSubPage page = usergroupPage.getUsersTab().searchUser(TEST_USERNAME);
    if (!page.isUserFound(TEST_USERNAME)) {
      usergroupPage =
          page.getUserCreatePage()
              .createUser(
                  TEST_USERNAME,
                  "John",
                  "Smith",
                  "Nuxeo",
                  "*****@*****.**",
                  TEST_PASSWORD,
                  "members");
    }

    DocumentBasePage documentBasePage =
        usergroupPage
            .exitAdminCenter()
            .getHeaderLinks()
            .getNavigationSubPage()
            .goToDocument("Workspaces");
    PermissionsSubPage permissionsSubPage = documentBasePage.getPermissionsTab();
    // Need WriteSecurity (so in practice Manage everything) to edit a
    // Workspace
    if (!permissionsSubPage.hasPermissionForUser("Manage everything", TEST_USERNAME)) {
      permissionsSubPage.grantPermissionForUser("Manage everything", TEST_USERNAME);
    }

    logout();

    // Starting the test for real
    documentBasePage =
        login(TEST_USERNAME, TEST_PASSWORD).getContentTab().goToDocument("Workspaces");

    // Create a new workspace named 'WorkspaceDescriptionModify_{current
    // time}'
    DocumentBasePage workspacePage =
        createWorkspace(documentBasePage, WORKSPACE_TITLE, "A workspace description");

    // Modify Workspace description
    String descriptionModified = "Description modified";
    workspacePage = workspacePage.getEditTab().edit(null, descriptionModified, null);

    assertEquals(descriptionModified, workspacePage.getCurrentFolderishDescription());
    assertEquals(WORKSPACE_TITLE, workspacePage.getCurrentDocumentTitle());

    // Clean up repository
    restoreState();

    // Logout
    logout();
  }
Ejemplo n.º 9
0
  private void prepare() throws UserNotConnectedException, IOException {
    DocumentBasePage documentBasePage;
    DocumentBasePage s = login();

    // Create a new user if not exist
    UsersGroupsBasePage page;
    UsersTabSubPage usersTab = s.getAdminCenter().getUsersGroupsHomePage().getUsersTab();
    usersTab = usersTab.searchUser(TEST_USERNAME);
    if (!usersTab.isUserFound(TEST_USERNAME)) {
      page =
          usersTab
              .getUserCreatePage()
              .createUser(
                  TEST_USERNAME,
                  TEST_USERNAME,
                  null,
                  null,
                  TEST_USERNAME,
                  TEST_PASSWORD,
                  "members");
      usersTab = page.getUsersTab(true);
    } // search user usersTab =
    usersTab.searchUser(TEST_USERNAME);
    assertTrue(usersTab.isUserFound(TEST_USERNAME));

    // create a wokspace1 and grant all rights to the test user
    documentBasePage =
        usersTab
            .exitAdminCenter()
            .getHeaderLinks()
            .getNavigationSubPage()
            .goToDocument("Workspaces");
    DocumentBasePage workspacePage = createWorkspace(documentBasePage, WORKSPACE1_TITLE, null);
    PermissionsSubPage permissionsSubPage = workspacePage.getPermissionsTab();
    // Need Read
    if (!permissionsSubPage.hasPermissionForUser("Read", TEST_USERNAME)) {
      permissionsSubPage.grantPermissionForUser("Read", TEST_USERNAME);
    }
    // Create test File 1
    createFile(workspacePage, FILE1_NAME, null, false, null, null, null);

    workspacePage.getHeaderLinks().getNavigationSubPage().goToDocument("Workspaces");
    workspacePage = createWorkspace(documentBasePage, WORKSPACE2_TITLE, null);
    permissionsSubPage = workspacePage.getPermissionsTab();
    if (!permissionsSubPage.hasPermissionForUser("Manage everything", TEST_USERNAME)) {
      permissionsSubPage.grantPermissionForUser("Manage everything", TEST_USERNAME);
    }

    logout();
  }
Ejemplo n.º 10
0
  /**
   * Test trash management.
   *
   * @since 7.1
   */
  @Test
  public void testTrashPurge() throws UserNotConnectedException, IOException {
    DocumentBasePage documentBasePage = login();

    // Create a file under workspace.
    DocumentBasePage workspacePage = documentBasePage.createWorkspace(WORKSPACE_TITLE, null);
    DocumentBasePage filePage =
        workspacePage.createFile(TEST_FILE_TITLE, null, false, null, null, null);

    // Copy/paste it to get 5 files.
    ContentTabSubPage content =
        filePage
            .getHeaderLinks()
            .getNavigationSubPage()
            .goToDocument(WORKSPACE_TITLE)
            .getContentTab()
            .copyByTitle(TEST_FILE_TITLE)
            .paste()
            .paste()
            .paste()
            .paste();

    List<WebElement> docs = content.getChildDocumentRows();
    assertNotNull(docs);
    assertEquals(5, docs.size());
    // Select all files and remove them.
    docs = content.removeAllDocuments().getChildDocumentRows();
    assertNotNull(docs);
    assertEquals(0, docs.size());

    // Go to trash page.
    TrashSubPage trashSubPage = asPage(DocumentBasePage.class).getManageTab().getTrashSubTab();
    docs = trashSubPage.getChildDocumentRows();
    assertNotNull(docs);
    assertEquals(5, docs.size());

    // Empty the trash.
    docs = trashSubPage.emptyTrash().getChildDocumentRows();
    assertNotNull(docs);
    assertEquals(0, docs.size());

    // cleanup workspace
    asPage(DocumentBasePage.class).getNavigationSubPage().goToDocument("Workspaces");
    asPage(ContentTabSubPage.class).removeDocument(WORKSPACE_TITLE);
  }
Ejemplo n.º 11
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);
  }
Ejemplo n.º 12
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);
  }