@Test(
      description = "Edit a folder, change the color (Context menu -> Edit)",
      groups = {"functional"})
  public void ChangeColorOfSystemFolders() throws HarnessException {

    // -- Data

    FolderItem contacts = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Contacts);

    // -- GUI

    // Refresh
    app.zPageAddressbook.zRefresh();

    // Change the folder's color using context menu
    DialogEditFolder dialog =
        (DialogEditFolder)
            app.zTreeContacts.zTreeItem(Action.A_RIGHTCLICK, Button.B_TREE_EDIT, contacts);
    ZAssert.assertNotNull(dialog, "Verify the dialog opened");

    dialog.zSetNewColor(FolderColor.Green);
    dialog.zClickButton(Button.B_OK);

    // -- Verification

    // Get the folder again
    FolderItem actual = FolderItem.importFromSOAP(app.zGetActiveAccount(), contacts.getName());

    ZAssert.assertEquals(
        actual.getColor(), "3", "Verify the color of the folder is set to green (3)");
  }
  @Test(
      description = "Edit a subfolder, change name and color Context menu -> Edit)",
      groups = {"functional"})
  public void ChangeNameColorOfSubFolder() throws HarnessException {

    // -- Data

    FolderItem contacts = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Contacts);

    // Create a folder
    String name = "ab" + ZimbraSeleniumProperties.getUniqueString();
    String newname = "ab" + ZimbraSeleniumProperties.getUniqueString();

    app.zGetActiveAccount()
        .soapSend(
            "<CreateFolderRequest xmlns='urn:zimbraMail'>"
                + "<folder name='"
                + name
                + "' view='contact' l='"
                + contacts.getId()
                + "'/>"
                + "</CreateFolderRequest>");
    FolderItem folderItem = FolderItem.importFromSOAP(app.zGetActiveAccount(), name);

    // -- GUI

    // Refresh
    app.zPageAddressbook.zRefresh();

    // Change the folder's color using context menu
    DialogEditFolder dialog =
        (DialogEditFolder)
            app.zTreeContacts.zTreeItem(Action.A_RIGHTCLICK, Button.B_TREE_EDIT, folderItem);
    ZAssert.assertNotNull(dialog, "Verify the dialog opened");

    dialog.zSetNewColor(FolderColor.Orange);
    dialog.zSetNewName(newname);
    dialog.zClickButton(Button.B_OK);

    // -- Verification

    // Get the folder again
    FolderItem actual = FolderItem.importFromSOAP(app.zGetActiveAccount(), name);
    ZAssert.assertNull(actual, "Verify the old addressbook does not exist");

    actual = FolderItem.importFromSOAP(app.zGetActiveAccount(), newname);
    ZAssert.assertNotNull(actual, "Verify the new addressbook exists");
    ZAssert.assertEquals(
        actual.getColor(), "9", "Verify the color of the folder is set to orange (9)");
  }