예제 #1
0
  // verify contact tagged with tag and toasted message
  private void Verify(ContactItem contactItem, String tagName) throws HarnessException {
    // Make sure the tag was created on the server (get the tag ID)
    app.zGetActiveAccount().soapSend("<GetTagRequest xmlns='urn:zimbraMail'/>");
    ;
    String tagID =
        app.zGetActiveAccount()
            .soapSelectValue("//mail:GetTagResponse//mail:tag[@name='" + tagName + "']", "id");

    // Make sure the tag was applied to the contact
    app.zGetActiveAccount()
        .soapSend(
            "<GetContactsRequest xmlns='urn:zimbraMail'>"
                + "<cn id='"
                + contactItem.getId()
                + "'/>"
                + "</GetContactsRequest>");

    String contactTags =
        app.zGetActiveAccount().soapSelectValue("//mail:GetContactsResponse//mail:cn", "t");

    // if multi-tagged
    if (contactTags.contains(",")) {
      ZAssert.assertStringContains(
          contactTags, tagID, "Verify the tag appears on the contact id=" + contactItem.getId());
    } else {
      ZAssert.assertEquals(
          contactTags, tagID, "Verify the tag appears on the contact id=" + contactItem.getId());
    }
    // verify toasted message '1 contact tagged ...'
    Toaster toast = app.zPageMain.zGetToaster();
    String toastMsg = toast.zGetToastMessage();
    ZAssert.assertStringContains(
        toastMsg,
        "1 contact tagged \"" + tagName + "\"",
        "Verify toast message '" + "1 contact tagged \"" + tagName + "\"'");
  }