/** Qmetry: ID 67006 -- Case No 034 / ID 001 -- Copy/Paste a Category to a Category -- */
  @Test
  public void test01_CopyPasteACategoryToACategory() {
    info("-- Step 1: Create a Category --");

    String categoryTreeName = "CategoryAction01";

    nav.goToContentAdministration();

    // Add category tree
    String[] form1 = {categoryTreeName, categoryWorkspace, nodeHomePath};
    String[] form2 = {groupID, "*"};
    String[] form3 = {actionName, optionLifeCycle, nodeTargetPath};
    boolean[] setPermission = {true, false, false};
    magCa.addNewCategoryTree(form1, false, true, form2, DATA_USER1, setPermission, form3);
    waitForTextPresent(categoryTreeName);

    info("-- Step 2: Copy a Category --");
    magCa.addChildCategory(categoryTreeName, categoryName);
    ecms.clickUpLevel();
    magCa.addChildCategory(categoryTreeName, newCategoryName, true);

    info("-- Step 3: Paste a copied Category --");
    magCa.copyAndPasteCategory(categoryName, newCategoryName);
    info("-- Restore original data --");
    button.close();
    magCa.deleteCategory(categoryTreeName);

    info("-- Sign Out --");
    // magAcc.signOut();
  }
  /** Qmetry: ID 66793 -- Case No 040 / ID 007 -- Cut a Category and paste into itself -- */
  @Test
  public void test07_CutACategoryAndPasteIntoItself() {
    info("-- Step 1: Create a Category --");

    String categoryTreeName = "categoryAction07";

    nav.goToContentAdministration();

    // Add category tree
    String[] form1 = {categoryTreeName, categoryWorkspace, nodeHomePath};
    String[] form2 = {groupID, "*"};
    String[] form3 = {actionName, optionLifeCycle, nodeTargetPath};
    boolean[] setPermission = {true, false, false};
    magCa.addNewCategoryTree(form1, false, true, form2, DATA_USER1, setPermission, form3);
    waitForTextPresent(categoryTreeName);

    info("-- Step 2: Cut a Category --");
    magCa.addChildCategory(categoryTreeName, categoryName);
    click(magCa.ELEMENT_CUT_CATEGORY_ICON.replace("${categoryName}", categoryName));

    info("-- Step 3: Paste cut Category into itself --");
    click(magCa.ELEMENT_PASTE_TO_CATEGORY_ICON.replace("${categoryName}", categoryName));
    alert.verifyAlertMessage(
        magCa.MESSAGE_INFO_CUT_TO_CATEGORY.replace(
            "${pathCategory}", "/sites/intranet/" + categoryTreeName + "/" + categoryName + ""));

    info("-- Restore original data --");
    button.close();
    magCa.deleteCategory(categoryTreeName);

    info("-- Sign Out --");
    // signOut();
  }
  /** Qmetry: ID 66909 -- Case No 036 / ID 003 -- Copy a Category and paste into itself -- */
  @Test
  public void test03_CopyACategoryAndPasteIntoItself() {
    By ELEMENT_SELECTED_CATEGORY_NAME =
        By.xpath(cMenu.ELEMENT_FILE_TITLE.replace("${titleOfFile}", categoryName));

    info("-- Step 1: Create a Category --");

    String categoryTreeName = "categoryAction03";

    nav.goToContentAdministration();

    // Add category tree
    String[] form1 = {categoryTreeName, categoryWorkspace, nodeHomePath};
    String[] form2 = {"", ""};
    String[] form3 = {actionName, optionLifeCycle, nodeTargetPath};
    boolean[] setPermission = {true, false, false};
    magCa.addNewCategoryTree(form1, true, false, form2, DATA_USER1, setPermission, form3);
    waitForTextPresent(categoryTreeName);

    info("-- Step 2: Copy a Category --");
    magCa.addChildCategory(categoryTreeName, categoryName);
    click(magCa.ELEMENT_COPY_CATEGORY_ICON.replace("${categoryName}", categoryName));

    info("-- Step 3: Paste copied Category into itself --");
    click(magCa.ELEMENT_PASTE_TO_CATEGORY_ICON.replace("${categoryName}", categoryName));
    click(ELEMENT_SELECTED_CATEGORY_NAME);
    waitForTextPresent(categoryName);

    info("-- Restore original data --");
    button.close();
    magCa.deleteCategory(categoryTreeName);

    info("-- Sign Out --");
    // signOut();
  }
  /** Qmetry: ID 66856 Delete Category Tree */
  @Test
  public void test11_DeleteCategoryTree() {
    info("-- Step 1: Create a Category --");

    String categoryTreeName = "categoryAction11";

    nav.goToContentAdministration();

    // Add category tree
    String[] form1 = {categoryTreeName, categoryWorkspace, nodeHomePath};
    String[] form2 = {groupID, "*"};
    String[] form3 = {actionName, optionLifeCycle, nodeTargetPath};
    boolean[] setPermission = {true, false, false};
    magCa.addNewCategoryTree(form1, false, true, form2, DATA_USER1, setPermission, form3);

    info("-- Step 2: Delete a Category --");
    magCa.deleteCategory(categoryTreeName);
  }
  /** Qmetry: ID 66792 -- Case No 039 / ID 006 -- Cut a Category and paste into its child node -- */
  @Test
  public void test06_CutACategoryAndPasteIntoItsChildNode() {
    By ELEMENT_SELECTED_CATEGORY_NAME =
        By.xpath(cMenu.ELEMENT_FILE_TITLE.replace("${titleOfFile}", categoryName));

    info("-- Step 1: Create a Category --");

    String categoryTreeName = "categoryAction06";

    nav.goToContentAdministration();

    // Add category tree
    String[] form1 = {categoryTreeName, categoryWorkspace, nodeHomePath};
    String[] form2 = {groupID, "*"};
    String[] form3 = {actionName, optionLifeCycle, nodeTargetPath};
    boolean[] setPermission = {true, false, false};
    magCa.addNewCategoryTree(form1, false, true, form2, DATA_USER1, setPermission, form3);
    waitForTextPresent(categoryTreeName);

    info("-- Step 2: Cut a Category --");
    magCa.addChildCategory(categoryTreeName, categoryName);
    magCa.addChildCategory(categoryName, newCategoryName, true);
    ecms.clickUpLevel();
    click(magCa.ELEMENT_CUT_CATEGORY_ICON.replace("${categoryName}", categoryName));

    info("-- Step 3: Paste a cut Category into its child node --");
    click(ELEMENT_SELECTED_CATEGORY_NAME);
    click(magCa.ELEMENT_PASTE_TO_CATEGORY_ICON.replace("${categoryName}", newCategoryName));
    waitForMessage(magCa.MESSAGE_INFO_PASTE_TO_CATEGORY);
    // dialog.closeMessageDialog();
    click(button.ELEMENT_OK_BUTTON);

    info("-- Restore original data --");
    button.close();
    magCa.deleteCategory(categoryTreeName);

    info("-- Sign Out --");
    // signOut();
  }
  /** Qmetry: ID 67007 -- Case No 037 / ID 004 -- Copy/Paste a deleted Category -- */
  @Test
  public void test04_CopyPasteADeletedCategory() {
    info("-- Step 1: Create a Category --");
    String categoryTreeName = "categoryAction04";

    nav.goToContentAdministration();

    // Add category tree
    String[] form1 = {categoryTreeName, categoryWorkspace, nodeHomePath};
    String[] form2 = {groupID, "*"};
    String[] form3 = {actionName, optionLifeCycle, nodeTargetPath};
    boolean[] setPermission = {true, false, false};
    magCa.addNewCategoryTree(form1, false, true, form2, DATA_USER1, setPermission, form3);
    waitForTextPresent(categoryTreeName);

    info("-- Step 2: Copy a Category --");
    magCa.addChildCategory(categoryTreeName, categoryName);
    ecms.clickUpLevel();
    magCa.addChildCategory(categoryTreeName, newCategoryName);

    click(magCa.ELEMENT_COPY_CATEGORY_ICON.replace("${categoryName}", newCategoryName));

    info("-- Step 3: Delete Category --");
    magCa.deleteCategory(newCategoryName);

    info("-- Step 4: Paste deleted Category --");
    click(magCa.ELEMENT_PASTE_TO_CATEGORY_ICON.replace("${categoryName}", categoryName));
    waitForMessage(magCa.MESSAGE_INFO_PASTE_TO_CATEGORY);
    // dialog.closeMessageDialog();
    click(button.ELEMENT_OK_BUTTON);

    info("-- Restore original data --");
    button.close();

    magCa.deleteCategory(categoryTreeName);

    info("-- Sign Out --");
    // signOut();
  }