Ejemplo n.º 1
0
  @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 = "D1 Enhancement : Add a contact to an existing group",
      groups = {"smoke", "matt"})
  public void Add1ContactToExistingGroup() throws HarnessException {

    // -- Data

    // Create a contact
    ContactItem contact = ContactItem.createContactItem(app.zGetActiveAccount());

    // Create a contact group
    ContactGroupItem group = ContactGroupItem.createContactGroupItem(app.zGetActiveAccount());

    // -- GUI

    // Refresh
    app.zPageAddressbook.zRefresh();

    // Right click on the contact -> Group -> Existing Group Name
    app.zPageAddressbook.zListItem(
        Action.A_RIGHTCLICK, Button.B_CONTACTGROUP, group, contact.getName());

    // -- Verification

    // Verify the contact group is created
    ContactGroupItem actual =
        ContactGroupItem.importFromSOAP(app.zGetActiveAccount(), group.getName());
    ZAssert.assertNotNull(actual, "Verify the contact group is created");

    // Verify the contact group contains the contact
    ZAssert.assertContains(
        actual.getMemberList(),
        new ContactGroupItem.MemberItemContact(contact),
        "Verify the contact group conatins the contact");
  }
  @Test(
      description = "D1 Enhancement : Create a contact group with 3 contacts",
      groups = {"functional"})
  public void CreateContactGroupWith3Contacts() throws HarnessException {

    // -- Data

    // Create a contact
    ContactItem contact1 = ContactItem.createContactItem(app.zGetActiveAccount());
    ContactItem contact2 = ContactItem.createContactItem(app.zGetActiveAccount());
    ContactItem contact3 = ContactItem.createContactItem(app.zGetActiveAccount());

    // Create a contact group
    String groupname = "group" + ZimbraSeleniumProperties.getUniqueString();

    // -- GUI

    // Refresh
    app.zPageAddressbook.zRefresh();

    // Check 3 contact items
    app.zPageAddressbook.zListItem(Action.A_CHECKBOX, contact1.getName());
    app.zPageAddressbook.zListItem(Action.A_CHECKBOX, contact2.getName());
    app.zPageAddressbook.zListItem(Action.A_CHECKBOX, contact3.getName());

    // Right click on one contact -> Group -> Existing Group Name
    DialogNewContactGroup dialog =
        (DialogNewContactGroup)
            app.zPageAddressbook.zListItem(
                Action.A_RIGHTCLICK,
                Button.B_CONTACTGROUP,
                Button.O_NEW_CONTACTGROUP,
                contact1.getName());

    dialog.zEnterGroupName(groupname);
    dialog.zClickButton(Button.B_OK);

    // -- Verification

    // Verify the contact group is created
    ContactGroupItem actual = ContactGroupItem.importFromSOAP(app.zGetActiveAccount(), groupname);
    ZAssert.assertNotNull(actual, "Verify the contact group is created");

    // Verify the contact group contains the contact
    ZAssert.assertContains(
        actual.getMemberList(),
        new ContactGroupItem.MemberItemContact(contact1),
        "Verify the contact group conatins the contact");

    ZAssert.assertContains(
        actual.getMemberList(),
        new ContactGroupItem.MemberItemContact(contact2),
        "Verify the contact group conatins the contact");

    ZAssert.assertContains(
        actual.getMemberList(),
        new ContactGroupItem.MemberItemContact(contact3),
        "Verify the contact group conatins the contact");
  }
Ejemplo n.º 4
0
  @Test(
      description = "Delete contact + contact group at once",
      groups = {"functional"})
  public void DeleteMixOfContactAndGroup() throws HarnessException {

    // Create a contact group via Soap
    ContactGroupItem group = ContactGroupItem.createContactGroupItem(app.zGetActiveAccount());

    group.setId(
        app.zGetActiveAccount().soapSelectValue("//mail:CreateContactResponse/mail:cn", "id"));
    String[] dlist =
        app.zGetActiveAccount()
            .soapSelectValue("//mail:CreateContactResponse/mail:cn/mail:a[@n='dlist']", null)
            .split(","); // a[2]
    for (int i = 0; i < dlist.length; i++) {
      group.addDListMember(dlist[i]);
    }

    // Create a contact via Soap
    ContactItem contactItem = ContactItem.createContactItem(app.zGetActiveAccount());
    contactItem.setId(
        app.zGetActiveAccount().soapSelectValue("//mail:CreateContactResponse/mail:cn", "id"));

    GeneralUtility.syncDesktopToZcsWithSoap(app.zGetActiveAccount());
    app.zPageAddressbook.zWaitForDesktopLoadingSpinner(5000);

    // Refresh the view, to pick up the newly created ones
    FolderItem contactFolder = FolderItem.importFromSOAP(app.zGetActiveAccount(), "Contacts");
    app.zTreeContacts.zTreeItem(Action.A_LEFTCLICK, contactFolder);

    // Select the items
    app.zPageAddressbook.zListItem(Action.A_CHECKBOX, group.fileAs);
    app.zPageAddressbook.zListItem(Action.A_CHECKBOX, contactItem.fileAs);

    // delete contact + group by click Delete button on toolbar
    app.zPageAddressbook.zToolbarPressButton(Button.B_DELETE);

    // verify toasted message 2 contacts moved to Trash
    String expectedMsg = "2 contacts moved to Trash";
    ZAssert.assertStringContains(
        app.zPageMain.zGetToaster().zGetToastMessage(),
        expectedMsg,
        "Verify toast message '" + expectedMsg + "'");

    // verify deleted contact + group not displayed
    List<ContactItem> contacts = app.zPageAddressbook.zListGetContacts();

    int count = 0;
    for (ContactItem ci : contacts) {
      if (ci.fileAs.equals(group.groupName) || ci.fileAs.equals(contactItem.fileAs)) {
        count++;
      }
    }

    ZAssert.assertTrue(
        count == 0,
        "Verify contact + group " + contactItem.fileAs + "," + group.groupName + " deleted");
  }
Ejemplo n.º 5
0
  private void registerAction(String uin, String laction, String msg) {
    if (!profile.getBoolean(Profile.OPTION_ENABLE_MM)) {
      return;
    }
    boolean needAddCommands = uins.size() == 0;
    uins.addElement(uin);

    if (uins.size() >= 1 && needAddCommands) {
      addCommandEx(JimmUI.cmdMenu, MENU_TYPE_LEFT_BAR);
    }
    ContactItem contact = profile.getItemByUIN(uin);
    String action = ResourceBundle.getString(laction);
    int counter = idx++;
    String date = DateAndTime.getDateString(true, false);
    int color = getColor(COLOR_CAP2);
    lock();

    if (contact == null) {
      addBigText(
          "[" + counter + "]: " + uin + " (" + date + ")\n", color, Font.STYLE_BOLD, counter);
    } else {
      addBigText(
          "[" + counter + "]: " + contact.name + " (" + date + ")\n",
          color,
          Font.STYLE_BOLD,
          counter);
    }
    color = getColor(COLOR_TEXT);

    if (contact != null) {
      if ((contact.getIntValue(ContactItem.CONTACTITEM_STATUS) == ContactItem.STATUS_OFFLINE)
          && (action.equals(ResourceBundle.getString("read xtraz"))
              || action.equals(ResourceBundle.getString("read status message")))
          && !contact.getBooleanValue(ContactItem.CONTACTITEM_IS_TEMP)) {
        addBigText(ResourceBundle.getString("status_invisible"), color, Font.STYLE_PLAIN, counter);
        contact.setStatus(ContactItem.STATUS_INVISIBLE, true);
      } else {
        addBigText(action, color, Font.STYLE_PLAIN, counter);
      }
    } else {
      addBigText(action, color, Font.STYLE_PLAIN, counter);
    }

    if (msg != null) {
      doCRLF(counter);
      addBigText(msg, color, Font.STYLE_PLAIN, counter);
    }

    doCRLF(counter);
    unlock();
  }
  @Test(
      description = "D1 Enhancement : Add 1 contact + 1 group to an existing group",
      groups = {"functional"})
  public void Add1ContactAnd1GroupToExistingGroup() throws HarnessException {

    // -- Data

    // Create a contact
    ContactItem contact = ContactItem.createContactItem(app.zGetActiveAccount());

    // Create a contact group
    ContactGroupItem group1 = ContactGroupItem.createContactGroupItem(app.zGetActiveAccount());
    ContactGroupItem group2 = ContactGroupItem.createContactGroupItem(app.zGetActiveAccount());

    // -- GUI

    // Refresh
    app.zPageAddressbook.zRefresh();

    // Check 3 contact items
    app.zPageAddressbook.zListItem(Action.A_CHECKBOX, contact.getName());
    app.zPageAddressbook.zListItem(Action.A_CHECKBOX, group1.getName());

    // Right click on one contact -> Group -> Existing Group Name
    app.zPageAddressbook.zListItem(
        Action.A_RIGHTCLICK, Button.B_CONTACTGROUP, group2, contact.getName());

    // -- Verification

    // Verify the contact group is created
    ContactGroupItem actual =
        ContactGroupItem.importFromSOAP(app.zGetActiveAccount(), group1.getName());
    ZAssert.assertNotNull(actual, "Verify the contact group is created");

    // Verify the contact group contains the contact
    ZAssert.assertContains(
        actual.getMemberList(),
        new ContactGroupItem.MemberItemContact(contact),
        "Verify the contact group conatins the contact");

    // The group members will be added to the new group
    for (ContactGroupItem.MemberItem m : group1.getMemberList()) {
      ZAssert.assertContains(
          actual.getMemberList(), m, "Verify the contact group contains the group members");
    }
  }
Ejemplo n.º 7
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 + "\"'");
  }
  @Test(
      description = "Create a new contact group by right click on existing contact",
      groups = {"smoke"})
  public void CreateContactGroupWith1Contact() throws HarnessException {

    // -- Data

    // Create a contact
    ContactItem contact = ContactItem.createContactItem(app.zGetActiveAccount());

    // The contact group name
    String groupname = "group" + ZimbraSeleniumProperties.getUniqueString();

    // -- GUI

    // Refresh
    app.zPageAddressbook.zRefresh();

    // Right click on the contact
    DialogNewContactGroup dialog =
        (DialogNewContactGroup)
            app.zPageAddressbook.zListItem(
                Action.A_RIGHTCLICK,
                Button.B_CONTACTGROUP,
                Button.O_NEW_CONTACTGROUP,
                contact.firstName);

    dialog.zEnterGroupName(groupname);
    dialog.zClickButton(Button.B_OK);

    // -- Verification

    // Verify the contact group is created
    ContactGroupItem actual = ContactGroupItem.importFromSOAP(app.zGetActiveAccount(), groupname);
    ZAssert.assertNotNull(actual, "Verify the contact group is created");

    // Verify the contact group contains the contact
    ZAssert.assertContains(
        actual.getMemberList(),
        new ContactGroupItem.MemberItemContact(contact),
        "Verify the contact group conatins the contact");
  }
Ejemplo n.º 9
0
  @Test(
      description =
          "Delete a contact, group, and folder permanently by Empty Trash folder on context menu",
      groups = {"smoke"})
  public void ClickOK() throws HarnessException {

    // -- Data

    // The trash folder
    FolderItem trash = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Trash);

    // Create a contact group via Soap
    ContactGroupItem group = ContactGroupItem.createContactGroupItem(app.zGetActiveAccount());

    // Move to trash
    app.zGetActiveAccount()
        .soapSend(
            "<ItemActionRequest xmlns='urn:zimbraMail'>"
                + "<action op='move' id='"
                + group.getId()
                + "' l='"
                + trash.getId()
                + "'/>"
                + "</ItemActionRequest>");

    // Create a contact via Soap
    ContactItem contact = ContactItem.createContactItem(app.zGetActiveAccount());

    // Move to trash
    app.zGetActiveAccount()
        .soapSend(
            "<ItemActionRequest xmlns='urn:zimbraMail'>"
                + "<action op='move' id='"
                + contact.getId()
                + "' l='"
                + trash.getId()
                + "'/>"
                + "</ItemActionRequest>");

    // Create a new folder in trash
    String name = "ab" + ZimbraSeleniumProperties.getUniqueString();
    app.zGetActiveAccount()
        .soapSend(
            "<CreateFolderRequest xmlns='urn:zimbraMail'>"
                + "<folder name='"
                + name
                + "' view='contact' l='"
                + trash.getId()
                + "'/>"
                + "</CreateFolderRequest>");

    // -- GUI

    // Refresh
    app.zPageAddressbook.zRefresh();

    // Now open empty trash dialog
    DialogWarning dialogWarning =
        (DialogWarning)
            app.zTreeContacts.zTreeItem(Action.A_RIGHTCLICK, Button.B_TREE_FOLDER_EMPTY, trash);

    // Click OK
    dialogWarning.zClickButton(Button.B_OK);

    // -- Verification

    // Verify items are permanently deleted

    // Verify Trash folder is empty
    ContactItem actualContact =
        ContactItem.importFromSOAP(
            app.zGetActiveAccount(), "is:anywhere #firstname:" + contact.firstName);
    ZAssert.assertNull(actualContact, "Verify the contact is deleted");

    ContactGroupItem actualGroup =
        ContactGroupItem.importFromSOAP(app.zGetActiveAccount(), "is:anywhere " + group.getName());
    ZAssert.assertNull(actualGroup, "Verify the contact group is deleted");

    FolderItem actualAddressbook = FolderItem.importFromSOAP(app.zGetActiveAccount(), name);
    ZAssert.assertNull(actualAddressbook, "Verify the addressbook is deleted");
  }