Exemplo n.º 1
0
  private void TagGroup(DialogTag dialogTag, ContactGroupItem group) throws HarnessException {

    String tagName = "tag" + ZimbraSeleniumProperties.getUniqueString();
    dialogTag.zSetTagName(tagName);
    dialogTag.zClickButton(Button.B_OK);

    // 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='"
                + group.getId()
                + "'/>"
                + "</GetContactsRequest>");

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

    ZAssert.assertEquals(
        contactTags, tagID, "Verify the tag appears on the contact id=" + group.getId());

    // verify toasted message '1 contact tagged ...'
    String expectedMsg = "1 contact group tagged \"" + tagName + "\"";
    ZAssert.assertStringContains(
        app.zPageMain.zGetToaster().zGetToastMessage(),
        expectedMsg,
        "Verify toast message '" + expectedMsg + "'");
  }
  @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");
  }
Exemplo n.º 3
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");
  }
  @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");
    }
  }
Exemplo n.º 5
0
  @Test(
      description = "Tag a contact group, click pulldown menu Tag->New Tag",
      groups = {"smoke"})
  public void ClickPulldownMenuTagNewTag() throws HarnessException {

    // -- Data

    // Create a tag
    String tagName = "tag" + ZimbraSeleniumProperties.getUniqueString();

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

    // -- GUI

    // Refresh
    app.zPageAddressbook.zRefresh();

    // Select the contact
    app.zPageAddressbook.zListItem(Action.A_LEFTCLICK, group.getName());

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

    // -- Verification

    app.zGetActiveAccount()
        .soapSend(
            "<GetContactsRequest xmlns='urn:zimbraMail' >"
                + "<cn id='"
                + group.getId()
                + "'/>"
                + "</GetContactsRequest>");

    String tn = app.zGetActiveAccount().soapSelectValue("//mail:cn", "tn");
    ZAssert.assertNotNull(tn, "Verify the contact has tags");
    ZAssert.assertStringContains(tn, tagName, "Verify the contact is tagged with the correct tag");
  }
Exemplo n.º 6
0
  @Test(
      description = "Double tag a group ",
      groups = {"functional"})
  public void DoubleTag() throws HarnessException {

    // -- Data

    // Create a tag
    TagItem tag1 = TagItem.CreateUsingSoap(app.zGetActiveAccount());
    TagItem tag2 = TagItem.CreateUsingSoap(app.zGetActiveAccount());

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

    // -- GUI

    // Refresh
    app.zPageAddressbook.zRefresh();

    // Select the contact group
    app.zPageAddressbook.zListItem(Action.A_LEFTCLICK, group.getName());

    // Tag -> Existing Tag
    app.zPageAddressbook.zToolbarPressPulldown(Button.B_TAG, tag1);
    app.zPageAddressbook.zToolbarPressPulldown(Button.B_TAG, tag2);

    // -- Verification

    app.zGetActiveAccount()
        .soapSend(
            "<GetContactsRequest xmlns='urn:zimbraMail' >"
                + "<cn id='"
                + group.getId()
                + "'/>"
                + "</GetContactsRequest>");

    String t = app.zGetActiveAccount().soapSelectValue("//mail:cn", "t");
    ZAssert.assertNotNull(t, "Verify the contact has tags");
    ZAssert.assertStringContains(
        t, tag1.getId(), "Verify the contact is tagged with the correct tag");
    ZAssert.assertStringContains(
        t, tag2.getId(), "Verify the contact is tagged with the correct tag");
  }
  @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");
  }
  @Test(
      description = "D1 Enhancement : Add 3 contacts to an existing group",
      groups = {"functional", "matt"})
  public void Add3ContactsToExistingGroup() 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
    ContactGroupItem group = ContactGroupItem.createContactGroupItem(app.zGetActiveAccount());

    // -- 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
    app.zPageAddressbook.zListItem(
        Action.A_RIGHTCLICK, Button.B_CONTACTGROUP, group, contact1.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(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");
  }
Exemplo n.º 9
0
  @Test(
      description = "Tag a contact group by dnd on an existing tag",
      groups = {"functional"})
  public void DnDOnExistingTag() throws HarnessException {

    // -- Data

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

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

    // -- GUI

    // Refresh
    app.zPageAddressbook.zRefresh();

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

    // -- Verification

    app.zGetActiveAccount()
        .soapSend(
            "<GetContactsRequest xmlns='urn:zimbraMail' >"
                + "<cn id='"
                + group.getId()
                + "'/>"
                + "</GetContactsRequest>");

    String t = app.zGetActiveAccount().soapSelectValue("//mail:cn", "t");
    ZAssert.assertNotNull(t, "Verify the contact has tags");
    ZAssert.assertStringContains(
        t, tagItem.getId(), "Verify the contact is tagged with the correct tag");
  }
Exemplo n.º 10
0
  @Test(
      description = "Right click then click Tag Contact Group->a tag name",
      groups = {"functional"})
  public void ClickContextMenuTagContactExistingTag() throws HarnessException {

    // -- Data

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

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

    // -- GUI

    // Refresh
    app.zPageAddressbook.zRefresh();

    // Right Click -> Tag -> Existing Tag
    app.zPageAddressbook.zListItem(Action.A_RIGHTCLICK, Button.B_TAG, tagItem, group.getName());

    // -- Verification

    app.zGetActiveAccount()
        .soapSend(
            "<GetContactsRequest xmlns='urn:zimbraMail' >"
                + "<cn id='"
                + group.getId()
                + "'/>"
                + "</GetContactsRequest>");

    String t = app.zGetActiveAccount().soapSelectValue("//mail:cn", "t");
    ZAssert.assertNotNull(t, "Verify the contact has tags");
    ZAssert.assertStringContains(
        t, tagItem.getId(), "Verify the contact is tagged with the correct tag");
  }
Exemplo n.º 11
0
  @Test(
      description = "Delete multiple contact groups at once",
      groups = {"functional"})
  public void DeleteMultipleContactGroups() throws HarnessException {

    // Create a contact group via Soap
    ContactGroupItem group1 = ContactGroupItem.createUsingSOAP(app);

    group1.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++) {
      group1.addDListMember(dlist[i]);
    }

    // Create a contact group via Soap
    ContactGroupItem group2 = ContactGroupItem.createUsingSOAP(app);

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

    // Create a contact group via Soap
    ContactGroupItem group3 = ContactGroupItem.createUsingSOAP(app);

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

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

    // Select the items
    app.zPageAddressbook.zListItem(Action.A_CHECKBOX, group1.fileAs);
    app.zPageAddressbook.zListItem(Action.A_CHECKBOX, group2.fileAs);
    app.zPageAddressbook.zListItem(Action.A_CHECKBOX, group3.fileAs);

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

    // verify toasted message 3 contacts moved to Trash
    String expectedMsg = "3 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(group1.groupName)
          || ci.fileAs.equals(group2.groupName)
          || ci.fileAs.equals(group3.groupName)) {
        count++;
      }
    }

    ZAssert.assertTrue(
        count == 0,
        "Verify contact groups "
            + group1.groupName
            + ","
            + group2.groupName
            + ","
            + group3.groupName
            + " deleted");
  }
Exemplo n.º 12
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");
  }