@Test(
      description = "Double tag a contact ",
      groups = {"functional"})
  public void DoubleTag() throws HarnessException {
    // Create a new tag
    TagItem tagItem = TagItem.CreateUsingSoap(app);

    // Create a contact via Soap then select
    ContactItem contactItem =
        app.zPageAddressbook.createUsingSOAPSelectContact(app, Action.A_LEFTCLICK);

    // select the tag
    app.zPageAddressbook.zToolbarPressPulldown(Button.B_TAG, tagItem);

    Verify(contactItem, tagItem.getName());

    // create a new tag name
    String tagName = "tag" + ZimbraSeleniumProperties.getUniqueString();

    // click Tag Contact->New Tag
    DialogTag dialogTag =
        (DialogTag)
            app.zPageAddressbook.zListItem(
                Action.A_RIGHTCLICK, Button.B_TAG, Button.O_TAG_NEWTAG, contactItem.fileAs);
    dialogTag.zSetTagName(tagName);
    dialogTag.zClickButton(Button.B_OK);

    Verify(contactItem, tagName);
  }
  @Test(
      description = "Tag a contact by dnd on an existing tag",
      groups = {"functional"})
  public void DnDOnExistingTag() throws HarnessException {

    // Create a contact via Soap then select
    ContactItem contactItem =
        app.zPageAddressbook.createUsingSOAPSelectContact(app, Action.A_LEFTCLICK);

    // Create a new tag via soap
    TagItem tagItem = TagItem.CreateUsingSoap(app);

    // Refresh to display the new tag
    app.zPageMain.zToolbarPressButton(Button.B_REFRESH);

    // Dnd on the new tag
    app.zPageAddressbook.zDragAndDrop(
        "css=td#zlif__CNS-main__"
            + contactItem.getId()
            + "__fileas:contains("
            + contactItem.fileAs
            + ")",
        "css=div[id=main_Contacts-parent-TAG] div[id=ztih__main_Contacts__TAG] td[id^=zti__main_Contacts__][id$=_textCell]:contains("
            + tagItem.getName()
            + ")");

    Verify(contactItem, tagItem.getName());
  }
  @Test(
      description = "Right click then click Tag Contact->a tag name",
      groups = {"functional"})
  public void ClickContextMenuTagContactExistingTag() throws HarnessException {
    // Create a tag
    TagItem tagItem = TagItem.CreateUsingSoap(app);

    // Create a contact via Soap then select
    ContactItem contactItem =
        app.zPageAddressbook.createUsingSOAPSelectContact(app, Action.A_LEFTCLICK);

    // click Tag Contact->the tag name
    app.zPageAddressbook.zListItem(Action.A_RIGHTCLICK, Button.B_TAG, tagItem, contactItem.fileAs);

    Verify(contactItem, tagItem.getName());
  }
  @Test(
      description = "click pulldown menu Tag->A tag name",
      groups = {"smoke"})
  public void ClickPulldownMenuTagExistingTag() throws HarnessException {
    // Create a contact via Soap then select
    ContactItem contactItem =
        app.zPageAddressbook.createUsingSOAPSelectContact(app, Action.A_LEFTCLICK);

    // Create a tag
    TagItem tagItem = TagItem.CreateUsingSoap(app);

    // select the tag
    app.zPageAddressbook.zToolbarPressPulldown(Button.B_TAG, tagItem);

    Verify(contactItem, tagItem.getName());
  }