@Test(
      description = "Delete a conversation by selecting and typing '.t' shortcut",
      groups = {"functional"})
  public void DeleteConversation_04() throws HarnessException {

    // Create the message data to be sent
    ConversationItem c = ConversationItem.createConversationItem(app.zGetActiveAccount());

    // Click Get Mail button
    app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);

    // Check the item
    app.zPageMail.zListItem(Action.A_LEFTCLICK, c.getSubject());

    // Click delete
    app.zPageMail.zKeyboardShortcut(Shortcut.S_MAIL_MOVETOTRASH);

    // -- Verification

    // Check each message to verify they exist in the trash
    FolderItem trash =
        FolderItem.importFromSOAP(app.zGetActiveAccount(), FolderItem.SystemFolder.Trash);
    ConversationItem actual =
        ConversationItem.importFromSOAP(
            app.zGetActiveAccount(), "is:anywhere subject:" + c.getSubject());

    for (MailItem m : actual.getMessageList()) {
      ZAssert.assertEquals(
          m.dFolderId, trash.getId(), "Verify the conversation message is in the trash");
    }
  }
  @Test(
      description = "Delete a conversation using checkbox and toolbar delete button",
      groups = {"functional"})
  public void DeleteConversation_02() throws HarnessException {

    // Create the message data to be sent
    ConversationItem c = ConversationItem.createConversationItem(app.zGetActiveAccount());

    // Click Get Mail button
    app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);

    // Check the item
    app.zPageMail.zListItem(Action.A_MAIL_CHECKBOX, c.getSubject());

    // Click delete
    app.zPageMail.zToolbarPressButton(Button.B_DELETE);

    // -- Verification

    // Check each message to verify they exist in the trash
    FolderItem trash =
        FolderItem.importFromSOAP(app.zGetActiveAccount(), FolderItem.SystemFolder.Trash);
    ConversationItem actual =
        ConversationItem.importFromSOAP(
            app.zGetActiveAccount(), "is:anywhere subject:" + c.getSubject());

    for (MailItem m : actual.getMessageList()) {
      ZAssert.assertEquals(
          m.dFolderId, trash.getId(), "Verify the conversation message is in the trash");
    }
  }
  @Test(
      description = "Delete a conversation by selecting and typing 'delete' keyboard",
      groups = {"functional"},
      dataProvider = "DataProviderDeleteKeys")
  public void DeleteConversation_03(String name, int keyEvent) throws HarnessException {

    // Create the message data to be sent
    ConversationItem c = ConversationItem.createConversationItem(app.zGetActiveAccount());

    // Click Get Mail button
    app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);

    // Check the item
    app.zPageMail.zListItem(Action.A_LEFTCLICK, c.getSubject());

    // Click delete
    logger.info("Typing shortcut key " + name + " KeyEvent: " + keyEvent);
    app.zPageMail.zKeyboardKeyEvent(keyEvent);

    // -- Verification

    // Check each message to verify they exist in the trash
    FolderItem trash =
        FolderItem.importFromSOAP(app.zGetActiveAccount(), FolderItem.SystemFolder.Trash);
    ConversationItem actual =
        ConversationItem.importFromSOAP(
            app.zGetActiveAccount(), "is:anywhere subject:" + c.getSubject());

    for (MailItem m : actual.getMessageList()) {
      ZAssert.assertEquals(
          m.dFolderId, trash.getId(), "Verify the conversation message is in the trash");
    }
  }
Exemple #4
0
  @Test(
      description = "Mark a message as unread by clicking on it, then using 'mu' hotkeys",
      groups = {"smoke"})
  public void MarkUnReadMail_01() throws HarnessException {

    // Create the message data to be sent
    String subject = "subject" + ZimbraSeleniumProperties.getUniqueString();

    FolderItem inboxFolder = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Inbox);
    app.zGetActiveAccount()
        .soapSend(
            "<AddMsgRequest xmlns='urn:zimbraMail'>"
                + "<m l='"
                + inboxFolder.getId()
                + "' f=''>"
                + "<content>From: [email protected]\n"
                + "To: [email protected] \n"
                + "Subject: "
                + subject
                + "\n"
                + "MIME-Version: 1.0 \n"
                + "Content-Type: text/plain; charset=utf-8 \n"
                + "Content-Transfer-Encoding: 7bit\n"
                + "\n"
                + "simple text string in the body\n"
                + "</content>"
                + "</m>"
                + "</AddMsgRequest>");

    // Create a mail item to represent the message
    MailItem mail = MailItem.importFromSOAP(app.zGetActiveAccount(), "subject:(" + subject + ")");
    ZAssert.assertStringDoesNotContain(mail.getFlags(), "u", "Verify message is initially unread");

    // Click Get Mail button
    app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);

    // Select the item
    app.zPageMail.zListItem(Action.A_LEFTCLICK, mail.dSubject);

    // TODO: need to L10N this
    app.zPageMail.zKeyboardShortcut(Shortcut.S_MAIL_MARKUNREAD);

    GeneralUtility.syncDesktopToZcsWithSoap(app.zGetActiveAccount());

    // Verify the message is marked read in the server (flags attribute should not contain (u)nread)
    mail = MailItem.importFromSOAP(app.zGetActiveAccount(), "subject:(" + subject + ")");
    ZAssert.assertStringContains(
        mail.getFlags(), "u", "Verify the message is marked read in the server");

    // TODO: Verify the message is not marked unread in the list

  }
  /**
   * Quick Command: Item Type: Mail Action 1: Tag Action 2: Mark Read Action 3: Mark Flagged Action
   * 4: Move To Subfolder
   *
   * @throws HarnessException
   */
  protected QuickCommand getQuickCommand01() throws HarnessException {

    if (command1 != null) {
      // Command already exists, just return it
      return (command1);
    }

    // Create a tag
    String tagname = "tag" + ZimbraSeleniumProperties.getUniqueString();
    ZimbraAccount.AccountZWC()
        .soapSend(
            "<CreateTagRequest xmlns='urn:zimbraMail'>"
                + "<tag name='"
                + tagname
                + "' color='1' />"
                + "</CreateTagRequest>");

    TagItem tag = TagItem.importFromSOAP(ZimbraAccount.AccountZWC(), tagname);
    ZAssert.assertNotNull(tag, "Verify the tag was created");

    // Create a subfolder
    String foldername = "folder" + ZimbraSeleniumProperties.getUniqueString();
    ZimbraAccount.AccountZWC()
        .soapSend(
            "<CreateFolderRequest xmlns='urn:zimbraMail'>"
                + "<folder name='"
                + foldername
                + "' l='1' view='message'/>"
                + "</CreateFolderRequest>");

    FolderItem folder = FolderItem.importFromSOAP(ZimbraAccount.AccountZWC(), foldername);
    ZAssert.assertNotNull(folder, "Verify the subfolder is available");

    // Create the list of actions
    ArrayList<QuickCommandAction> actions = new ArrayList<QuickCommandAction>();
    actions.add(new QuickCommandAction(QuickCommandAction.TypeId.actionTag, tag.getId(), true));
    actions.add(new QuickCommandAction(QuickCommandAction.TypeId.actionFlag, "read", true));
    actions.add(new QuickCommandAction(QuickCommandAction.TypeId.actionFlag, "flagged", true));
    actions.add(
        new QuickCommandAction(QuickCommandAction.TypeId.actionFileInto, folder.getId(), true));

    String name = "name" + ZimbraSeleniumProperties.getUniqueString();
    String description = "description" + ZimbraSeleniumProperties.getUniqueString();

    command1 = new QuickCommand(name, description, ItemTypeId.MSG, true);
    command1.addActions(actions);

    return (command1);
  }
  @Test(
      description =
          "Delete a task by selecting and typing 'delete' keyboard-Verify Toast message through GUI",
      groups = {"smoke"},
      dataProvider = "DataProviderDeleteKeys")
  public void DeleteTaskToastMsg_03(String name, int keyEvent) throws HarnessException {

    FolderItem taskFolder = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Tasks);

    // Create a basic task to delete
    String subject = "task" + ZimbraSeleniumProperties.getUniqueString();

    app.zGetActiveAccount()
        .soapSend(
            "<CreateTaskRequest xmlns='urn:zimbraMail'>"
                + "<m >"
                + "<inv>"
                + "<comp name='"
                + subject
                + "'>"
                + "<or a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "</comp>"
                + "</inv>"
                + "<su>"
                + subject
                + "</su>"
                + "<mp ct='text/plain'>"
                + "<content>content"
                + ZimbraSeleniumProperties.getUniqueString()
                + "</content>"
                + "</mp>"
                + "</m>"
                + "</CreateTaskRequest>");

    GeneralUtility.syncDesktopToZcsWithSoap(app.zGetActiveAccount());

    TaskItem task = TaskItem.importFromSOAP(app.zGetActiveAccount(), subject);
    ZAssert.assertNotNull(task, "Verify the task is created");

    // Refresh the tasks view
    app.zPageTasks.zToolbarPressButton(Button.B_REFRESH);
    app.zTreeTasks.zTreeItem(Action.A_LEFTCLICK, taskFolder);

    // Select the item
    app.zPageTasks.zListItem(Action.A_MAIL_CHECKBOX, subject);

    // Click delete keyboard
    logger.info("Typing shortcut key " + name + " KeyEvent: " + keyEvent);
    app.zPageMail.zKeyboardKeyEvent(keyEvent);

    // Verifying the toaster message
    Toaster toast = app.zPageMain.zGetToaster();
    String toastMsg = toast.zGetToastMessage();
    ZAssert.assertStringContains(
        toastMsg, "1 task moved to Trash", "Verify toast message: Task Moved To trash");
  }
  @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 =
          "Create task through SOAP - delete using Backspace Key & verify Toast message through GUI",
      groups = {"functional"})
  public void DeleteTaskToastMsg_07() throws HarnessException {

    FolderItem taskFolder = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Tasks);

    // Create a basic task to delete
    String subject = "task" + ZimbraSeleniumProperties.getUniqueString();

    app.zGetActiveAccount()
        .soapSend(
            "<CreateTaskRequest xmlns='urn:zimbraMail'>"
                + "<m >"
                + "<inv>"
                + "<comp name='"
                + subject
                + "'>"
                + "<or a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "</comp>"
                + "</inv>"
                + "<su>"
                + subject
                + "</su>"
                + "<mp ct='text/plain'>"
                + "<content>content"
                + ZimbraSeleniumProperties.getUniqueString()
                + "</content>"
                + "</mp>"
                + "</m>"
                + "</CreateTaskRequest>");

    GeneralUtility.syncDesktopToZcsWithSoap(app.zGetActiveAccount());

    TaskItem task = TaskItem.importFromSOAP(app.zGetActiveAccount(), subject);
    ZAssert.assertNotNull(task, "Verify the task is created");

    // Refresh the tasks view
    app.zPageTasks.zToolbarPressButton(Button.B_REFRESH);
    app.zTreeTasks.zTreeItem(Action.A_LEFTCLICK, taskFolder);

    // Select the item
    app.zPageTasks.zListItem(Action.A_MAIL_CHECKBOX, subject);

    // Use Backspace Keyboard Shortcut
    app.zPageTasks.zKeyboardShortcut(Shortcut.S_BACKSPACE);

    // Verifying the toaster message
    Toaster toast = app.zPageMain.zGetToaster();
    String toastMsg = toast.zGetToastMessage();
    ZAssert.assertStringContains(
        toastMsg, "1 task moved to Trash", "Verify toast message: Task Moved to Trash");
  }
  @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)");
  }
  @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)");
  }
  // expand the folder to show folder's children
  public void zExpand(FolderItem folderItem) throws HarnessException {

    String locator = "css=td#zti__main_Contacts__" + folderItem.getId() + "_nodeCell" + ">div.";
    // already expanded or not have sub folders
    if (!sIsElementPresent(locator + Locators.COLLAPSE_NODE)) {
      return;
    }
    SleepUtil.sleepMedium();
    if (this.sIsElementPresent(locator + Locators.COLLAPSE_NODE)) {
      sMouseDown(locator + Locators.COLLAPSE_NODE);
    }
    zWaitForElementPresent(locator + Locators.EXPAND_NODE);
  }
Exemple #12
0
  private void _verifyContactGroupDeleted(ContactGroupItem group) throws HarnessException {
    // verify toasted message 1 contact group moved to Trash
    String expectedMsg = "1 contact group 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();

    boolean isFileAsEqual = false;
    for (ContactItem ci : contacts) {
      if (ci.fileAs.equals(group.groupName)) {
        isFileAsEqual = true;
        break;
      }
    }

    ZAssert.assertFalse(isFileAsEqual, "Verify contact group " + group.groupName + " deleted");

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

    // verify deleted contact displayed in trash folder
    // refresh Trash folder
    app.zTreeContacts.zTreeItem(Action.A_LEFTCLICK, trash);

    contacts = app.zPageAddressbook.zListGetContacts();

    isFileAsEqual = false;
    for (ContactItem ci : contacts) {
      if (ci.fileAs.equals(group.groupName)) {
        isFileAsEqual = true;
        break;
      }
    }

    ZAssert.assertTrue(
        isFileAsEqual, "Verify contact group (" + group.groupName + ") displayed in Trash folder");
  }
Exemple #13
0
  @Test(
      description = "Empty a folder (context menu)",
      groups = {"smoke"})
  public void EmptyFolder_01() throws HarnessException {

    String foldername = "folder" + ZimbraSeleniumProperties.getUniqueString();
    String subject = "subject" + ZimbraSeleniumProperties.getUniqueString();

    FolderItem inbox =
        FolderItem.importFromSOAP(app.zGetActiveAccount(), FolderItem.SystemFolder.Inbox);

    // Create a subfolder in Inbox
    app.zGetActiveAccount()
        .soapSend(
            "<CreateFolderRequest xmlns='urn:zimbraMail'>"
                + "<folder name='"
                + foldername
                + "' l='"
                + inbox.getId()
                + "'/>"
                + "</CreateFolderRequest>");

    // Make sure the folder was created on the server
    FolderItem subfolder = FolderItem.importFromSOAP(app.zGetActiveAccount(), foldername);
    ZAssert.assertNotNull(subfolder, "Verify the folder exists on the server");

    // Add an message to the new subfolder
    app.zGetActiveAccount()
        .soapSend(
            "<AddMsgRequest xmlns='urn:zimbraMail'>"
                + "<m l='"
                + subfolder.getId()
                + "'>"
                + "<content>From: [email protected]\n"
                + "To: [email protected] \n"
                + "Subject: "
                + subject
                + "\n"
                + "MIME-Version: 1.0 \n"
                + "Content-Type: text/plain; charset=utf-8 \n"
                + "Content-Transfer-Encoding: 7bit\n"
                + "\n"
                + "simple text string in the body\n"
                + "</content>"
                + "</m>"
                + "</AddMsgRequest>");

    MailItem mail = MailItem.importFromSOAP(app.zGetActiveAccount(), "subject:(" + subject + ")");
    // Click on Get Mail to refresh the folder list
    app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);
    // Right click on folder, select "Mark all as read"
    DialogWarning dialog =
        (DialogWarning)
            app.zTreeMail.zTreeItem(Action.A_RIGHTCLICK, Button.B_TREE_FOLDER_EMPTY, subfolder);
    ZAssert.assertNotNull(
        dialog, "Verify the warning dialog pops up - Are you sure you want to delete all items?");

    // Dismiss it
    dialog.zClickButton(Button.B_OK);

    List<MailItem> messages = app.zPageMail.zListGetMessages();
    ZAssert.assertNotNull(messages, "Verify the message list exists");

    MailItem found = null;
    for (MailItem m : messages) {
      logger.info("Subject: looking for " + mail.dSubject + " found: " + m.gSubject);
      if (mail.dSubject.equals(m.gSubject)) {
        found = m;
        break;
      }
    }
    ZAssert.assertNull(found, "Verify the message is no longer exist");

    // Make sure the folder was created on the server
    // MailItem mail = MailItem.importFromSOAP(app.zGetActiveAccount(),
    // "subject:("+ subject +")");
    // ZAssert.assertNull(mail, "Verify the message no longer exists");

  }
Exemple #14
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");
  }
  @Bugs(ids = "86168")
  @Test(
      description = "Forward (on behalf of) to a message in a shared folder (admin rights)",
      groups = {"functional"})
  public void ForwardMail_01() throws HarnessException {

    // -- DATA

    // Create the folder owner
    ZimbraAccount owner = (new ZimbraAccount()).provision().authenticate();

    // Allow sending rights
    owner.soapSend(
        "<GrantRightsRequest xmlns='urn:zimbraAccount'>"
            + "<ace gt='usr' d='"
            + app.zGetActiveAccount().EmailAddress
            + "' right='sendOnBehalfOf'/>"
            + "</GrantRightsRequest>");

    String foldername = "folder" + ZimbraSeleniumProperties.getUniqueString();
    String subject = "subject" + ZimbraSeleniumProperties.getUniqueString();
    String mountpointname = "mountpoint" + ZimbraSeleniumProperties.getUniqueString();

    FolderItem inbox = FolderItem.importFromSOAP(owner, FolderItem.SystemFolder.Inbox);

    // Create a folder to share
    owner.soapSend(
        "<CreateFolderRequest xmlns='urn:zimbraMail'>"
            + "<folder name='"
            + foldername
            + "' l='"
            + inbox.getId()
            + "'/>"
            + "</CreateFolderRequest>");

    FolderItem folder = FolderItem.importFromSOAP(owner, foldername);

    // Share it
    owner.soapSend(
        "<FolderActionRequest xmlns='urn:zimbraMail'>"
            + "<action id='"
            + folder.getId()
            + "' op='grant'>"
            + "<grant d='"
            + app.zGetActiveAccount().EmailAddress
            + "' gt='usr' perm='r'/>"
            + "</action>"
            + "</FolderActionRequest>");

    // Add a message to it
    owner.soapSend(
        "<AddMsgRequest xmlns='urn:zimbraMail'>"
            + "<m l='"
            + folder.getId()
            + "' >"
            + "<content>From: "
            + ZimbraAccount.AccountB().EmailAddress
            + "\n"
            + "To: "
            + owner.EmailAddress
            + "\n"
            + "Subject: "
            + subject
            + "\n"
            + "MIME-Version: 1.0 \n"
            + "Content-Type: text/plain; charset=utf-8 \n"
            + "Content-Transfer-Encoding: 7bit\n"
            + "\n"
            + "simple text string in the body\n"
            + "</content>"
            + "</m>"
            + "</AddMsgRequest>");

    // Mount it
    app.zGetActiveAccount()
        .soapSend(
            "<CreateMountpointRequest xmlns='urn:zimbraMail'>"
                + "<link l='1' name='"
                + mountpointname
                + "'  rid='"
                + folder.getId()
                + "' zid='"
                + owner.ZimbraId
                + "'/>"
                + "</CreateMountpointRequest>");

    FolderMountpointItem mountpoint =
        FolderMountpointItem.importFromSOAP(app.zGetActiveAccount(), mountpointname);

    // -- GUI

    // Login to load the rights
    app.zPageLogin.zNavigateTo();
    this.startingPage.zNavigateTo();

    try {

      // Click on the mountpoint
      app.zTreeMail.zTreeItem(Action.A_LEFTCLICK, mountpoint);

      // Select the item
      app.zPageMail.zListItem(Action.A_LEFTCLICK, subject);

      // Reply the item
      FormMailNew mailform = (FormMailNew) app.zPageMail.zToolbarPressButton(Button.B_FORWARD);
      mailform.zFillField(FormMailNew.Field.To, ZimbraAccount.AccountA().EmailAddress);
      mailform.zFillField(Field.From, owner.EmailAddress);
      mailform.zSubmit();

    } finally {

      // Select the inbox
      app.zTreeMail.zTreeItem(
          Action.A_LEFTCLICK,
          FolderItem.importFromSOAP(app.zGetActiveAccount(), FolderItem.SystemFolder.Inbox));
    }

    // -- VERIFICATION

    // From the receiving end, verify the message details
    // Need 'in:inbox' to separate the message from the sent message
    MailItem sent =
        MailItem.importFromSOAP(app.zGetActiveAccount(), "in:sent subject:(" + subject + ")");

    ZAssert.assertEquals(
        sent.dToRecipients.size(), 1, "Verify the message is sent to 1 'to' recipient");
    ZAssert.assertEquals(
        sent.dToRecipients.get(0).dEmailAddress,
        ZimbraAccount.AccountA().EmailAddress,
        "Verify the 'To' field is correct");
    ZAssert.assertEquals(
        sent.dFromRecipient.dEmailAddress,
        owner.EmailAddress,
        "Verify the 'From' field is correct");
    ZAssert.assertEquals(
        sent.dSenderRecipient.dEmailAddress,
        app.zGetActiveAccount().EmailAddress,
        "Verify the 'Sender' field is correct");
  }
  @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");
  }
  @Bugs(ids = "79188")
  @Test(
      description = "Delete a conversation - 1 message in inbox, 1 message in draft",
      groups = {"functional"})
  public void DeleteConversation_11() throws HarnessException {

    // -- DATA
    String subject = "subject" + ZimbraSeleniumProperties.getUniqueString();

    // Create a conversation (1 message in inbox, 1 draft response)
    ZimbraAccount.AccountA()
        .soapSend(
            "<SendMsgRequest xmlns='urn:zimbraMail'>"
                + "<m>"
                + "<e t='t' a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "<su>"
                + subject
                + "</su>"
                + "<mp ct='text/plain'>"
                + "<content>body "
                + ZimbraSeleniumProperties.getUniqueString()
                + "</content>"
                + "</mp>"
                + "</m>"
                + "</SendMsgRequest>");

    MailItem message1 =
        MailItem.importFromSOAP(app.zGetActiveAccount(), "subject:(" + subject + ")");

    app.zGetActiveAccount()
        .soapSend(
            "<SaveDraftRequest xmlns='urn:zimbraMail'>"
                + "<m origid='"
                + message1.getId()
                + "' rt='r'>"
                + "<e t='t' a='"
                + ZimbraAccount.AccountA().EmailAddress
                + "'/>"
                + "<su>RE: "
                + subject
                + "</su>"
                + "<mp ct='text/plain'>"
                + "<content>body "
                + ZimbraSeleniumProperties.getUniqueString()
                + "</content>"
                + "</mp>"
                + "</m>"
                + "</SaveDraftRequest>");

    // Get the system folders
    FolderItem inbox = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Inbox);
    FolderItem drafts = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Drafts);
    FolderItem trash = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Trash);

    // -- GUI

    // Click Get Mail button
    app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);

    // Click in Drafts
    app.zTreeMail.zTreeItem(Action.A_LEFTCLICK, drafts);

    // Select the conversation or message (in 8.X, only messages are shown in drafts, not
    // conversations)
    app.zPageMail.zListItem(Action.A_LEFTCLICK, subject);

    // Click Delete
    app.zPageMail.zToolbarPressButton(Button.B_DELETE);

    // -- Verification

    // Verify inbox message remains (bug 79188)
    MailItem m =
        MailItem.importFromSOAP(
            app.zGetActiveAccount(), "subject:(" + subject + ") inid:" + inbox.getId());
    ZAssert.assertNotNull(m, "Verify original message reamins in the inbox");

    // Verify draft is no longer in drafts folder
    m =
        MailItem.importFromSOAP(
            app.zGetActiveAccount(), "subject:(" + subject + ") inid:" + drafts.getId());
    ZAssert.assertNull(m, "Verify message is deleted from drafts");

    // Verify draft is in trash folder
    m =
        MailItem.importFromSOAP(
            app.zGetActiveAccount(), "subject:(" + subject + ") inid:" + trash.getId());
    ZAssert.assertNotNull(m, "Verify message is moved to trash");
  }
  @Test(
      description =
          "Delete a conversation - 1 message in inbox, 1 message in sent, 1 message in subfolder",
      groups = {"functional"})
  public void DeleteConversation_10() throws HarnessException {

    // -- DATA

    // Create a conversation (3 messages)
    ConversationItem c = ConversationItem.createConversationItem(app.zGetActiveAccount());

    // Put one message in inbox, one in trash, one in subfolder

    // Get the system folders
    FolderItem inbox = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Inbox);
    FolderItem trash = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Trash);
    FolderItem sent = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Sent);

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

    // Create a message in a subfolder
    String foldername = "folder" + ZimbraSeleniumProperties.getUniqueString();
    app.zGetActiveAccount()
        .soapSend(
            "<CreateFolderRequest xmlns='urn:zimbraMail'>"
                + "<folder name='"
                + foldername
                + "' l='"
                + inbox.getId()
                + "'/>"
                + "</CreateFolderRequest>");
    FolderItem subfolder = FolderItem.importFromSOAP(app.zGetActiveAccount(), foldername);

    // Move the conversation to the subfolder
    app.zGetActiveAccount()
        .soapSend(
            "<ItemActionRequest xmlns='urn:zimbraMail'>"
                + "<action op='move' l='"
                + subfolder.getId()
                + "' id='"
                + c.getMessageList().get(1).getId()
                + "'/>"
                + "</ItemActionRequest>");

    // Reply to one message (putting a message in sent)
    app.zGetActiveAccount()
        .soapSend(
            "<SendMsgRequest xmlns='urn:zimbraMail'>"
                + "<m origid='"
                + c.getMessageList().get(2).getId()
                + "' rt='r'>"
                + "<e t='t' a='"
                + ZimbraAccount.AccountA().EmailAddress
                + "'/>"
                + "<su>RE: "
                + c.getSubject()
                + "</su>"
                + "<mp ct='text/plain'>"
                + "<content>"
                + "body"
                + ZimbraSeleniumProperties.getUniqueString()
                + "</content>"
                + "</mp>"
                + "</m>"
                + "</SendMsgRequest>");
    String idSent = app.zGetActiveAccount().soapSelectValue("//mail:m", "id");

    // -- GUI

    // Click Get Mail button
    app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);

    // Right click the item, select delete
    app.zPageMail.zListItem(Action.A_RIGHTCLICK, Button.B_DELETE, c.getSubject());

    // -- Verification

    // Expected: all messages should be in trash, except for the sent message
    // Check each message to verify they exist in the trash
    ConversationItem actual =
        ConversationItem.importFromSOAP(
            app.zGetActiveAccount(), "is:anywhere subject:" + c.getSubject());

    for (MailItem m : actual.getMessageList()) {
      if (idSent.equals(m.getId())) {
        // Sent message should remain in sent
        ZAssert.assertEquals(
            m.dFolderId, sent.getId(), "Verify the conversation message is in the sent folder");
      } else {
        // All other messages should be moved to trash
        ZAssert.assertEquals(
            m.dFolderId, trash.getId(), "Verify the conversation message is in the trash");
      }
    }
  }
 private void bindCommonMessage(FolderItem folderItem) {
   mTitle.setText(folderItem.getTitle());
   mDate.setText(Utils.formatTimeStampString(getContext(), folderItem.getDate(), false));
   mSnippet.setText(folderItem.getSnippet());
 }
  @Test(
      description = "Undo - Mark a message as spam, using 'Spam' toolbar button",
      groups = {"functional"})
  public void UndoMarkSpamMessage_01() throws HarnessException {

    FolderItem inbox =
        FolderItem.importFromSOAP(app.zGetActiveAccount(), FolderItem.SystemFolder.Inbox);
    FolderItem junk =
        FolderItem.importFromSOAP(app.zGetActiveAccount(), FolderItem.SystemFolder.Junk);
    String subject = "subject" + ZimbraSeleniumProperties.getUniqueString();

    app.zGetActiveAccount()
        .soapSend(
            "<AddMsgRequest xmlns='urn:zimbraMail'>"
                + "<m l='"
                + inbox.getId()
                + "'>"
                + "<content>"
                + "From: [email protected]\n"
                + "To: [email protected] \n"
                + "Subject: "
                + subject
                + "\n"
                + "MIME-Version: 1.0 \n"
                + "Content-Type: text/plain; charset=utf-8 \n"
                + "Content-Transfer-Encoding: 7bit\n"
                + "\n"
                + "content \n"
                + "\n"
                + "\n"
                + "</content>"
                + "</m>"
                + "</AddMsgRequest>");

    MailItem message =
        MailItem.importFromSOAP(app.zGetActiveAccount(), "subject:(" + subject + ") is:anywhere");
    ZAssert.assertNotNull(message, "Verify the message was created");

    // Click Get Mail button
    app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);

    // Select the item
    app.zPageMail.zListItem(Action.A_LEFTCLICK, subject);

    // Click spam
    app.zPageMail.zToolbarPressButton(Button.B_RESPORTSPAM);

    // Get the mail item for the new message
    // Need 'is:anywhere' to include the spam folder
    MailItem spam =
        MailItem.importFromSOAP(app.zGetActiveAccount(), "is:anywhere subject:(" + subject + ")");
    ZAssert.assertEquals(spam.dFolderId, junk.getId(), "Verify the message is in the spam folder");

    // Click undo
    Toaster toaster = app.zPageMain.zGetToaster();
    toaster.zClickUndo();

    // Get the mail item for the new message
    // Need 'is:anywhere' to include the spam folder
    MailItem undone =
        MailItem.importFromSOAP(app.zGetActiveAccount(), "is:anywhere subject:(" + subject + ")");
    ZAssert.assertEquals(
        undone.dFolderId, inbox.getId(), "Verify the message is back in the inbox folder");
  }
  @Test(
      description = "Grantee views show original of the appointment from grantor's calendar",
      groups = {"functional"})
  public void ShowOriginal_01() throws HarnessException {

    String apptSubject = "appointment" + ZimbraSeleniumProperties.getUniqueString();
    String apptContent = ZimbraSeleniumProperties.getUniqueString();
    String foldername = "folder" + ZimbraSeleniumProperties.getUniqueString();
    String mountpointname = "mountpoint" + ZimbraSeleniumProperties.getUniqueString();

    Calendar now = this.calendarWeekDayUTC;
    ZDate startUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            12,
            0,
            0);
    ZDate endUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            14,
            0,
            0);

    FolderItem calendarFolder =
        FolderItem.importFromSOAP(ZimbraAccount.AccountA(), FolderItem.SystemFolder.Calendar);

    // Create a folder to share
    ZimbraAccount.AccountA()
        .soapSend(
            "<CreateFolderRequest xmlns='urn:zimbraMail'>"
                + "<folder name='"
                + foldername
                + "' l='"
                + calendarFolder.getId()
                + "'/>"
                + "</CreateFolderRequest>");

    FolderItem folder = FolderItem.importFromSOAP(ZimbraAccount.AccountA(), foldername);

    // Share it
    ZimbraAccount.AccountA()
        .soapSend(
            "<FolderActionRequest xmlns='urn:zimbraMail'>"
                + "<action id='"
                + folder.getId()
                + "' op='grant'>"
                + "<grant d='"
                + app.zGetActiveAccount().EmailAddress
                + "' gt='usr' perm='r' view='appointment'/>"
                + "</action>"
                + "</FolderActionRequest>");

    // Mount it
    app.zGetActiveAccount()
        .soapSend(
            "<CreateMountpointRequest xmlns='urn:zimbraMail'>"
                + "<link l='1' name='"
                + mountpointname
                + "'  rid='"
                + folder.getId()
                + "' zid='"
                + ZimbraAccount.AccountA().ZimbraId
                + "' view='appointment' color='5'/>"
                + "</CreateMountpointRequest>");

    // Create appointment
    ZimbraAccount.AccountA()
        .soapSend(
            "<CreateAppointmentRequest xmlns='urn:zimbraMail'>"
                + "<m l='"
                + folder.getId()
                + "' >"
                + "<inv method='REQUEST' type='event' status='CONF' draft='0' class='PUB' fb='B' transp='O' allDay='0' name='"
                + apptSubject
                + "'>"
                + "<s d='"
                + startUTC.toTimeZone(ZTimeZone.TimeZoneEST.getID()).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + ZTimeZone.TimeZoneEST.getID()
                + "'/>"
                + "<e d='"
                + endUTC.toTimeZone(ZTimeZone.TimeZoneEST.getID()).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + ZTimeZone.TimeZoneEST.getID()
                + "'/>"
                + "<or a='"
                + ZimbraAccount.AccountA().EmailAddress
                + "'/>"
                + "<at role='REQ' ptst='NE' rsvp='1' a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "</inv>"
                + "<e a='"
                + app.zGetActiveAccount().EmailAddress
                + "' t='t'/>"
                + "<su>"
                + apptSubject
                + "</su>"
                + "<mp content-type='text/plain'>"
                + "<content>"
                + apptContent
                + "</content>"
                + "</mp>"
                + "</m>"
                + "</CreateAppointmentRequest>");
    app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH);

    // Mark ON to mounted calendar folder and select the appointment
    app.zTreeCalendar.zDeSelectCalendarFolder("Calendar");
    app.zTreeCalendar.zSelectMountedFolder(mountpointname);

    // Appointment show original
    SeparateWindowShowOriginal window =
        (SeparateWindowShowOriginal)
            app.zPageCalendar.zListItem(
                Action.A_RIGHTCLICK, Button.O_SHOW_ORIGINAL_MENU, apptSubject);
    try {
      window.zWaitForActive();
      SleepUtil.sleepMedium();
      ZAssert.assertTrue(window.zIsActive(), "Verify the window is active");

      String body = window.sGetBodyText();
      ZAssert.assertStringContains(body, apptSubject, "Verify subject in show original");
      ZAssert.assertStringContains(body, apptContent, "Verify content in show original");
      ZAssert.assertStringContains(body, "BEGIN:VCALENDAR", "Verify BEGIN header in show original");
      ZAssert.assertStringContains(body, "END:VCALENDAR", "Verify END header in show original");
      ZAssert.assertStringContains(
          body,
          "ORGANIZER:mailto:" + ZimbraAccount.AccountA().EmailAddress,
          "Verify organizer value in show original");

    } finally {
      if (window != null) window.zCloseWindow();
    }
  }
  /* (non-Javadoc)
   * @see framework.ui.AbsTree#zTreeItem(framework.ui.Action, framework.items.FolderItem)
   */
  public AbsPage zTreeItem(Action action, IItem addressbook) throws HarnessException {
    tracer.trace("Click " + action + " on addressbook " + addressbook);

    // Validate the arguments
    if ((action == null) || (addressbook == null)) {
      throw new HarnessException("Must define an action and addressbook");
    }
    FolderItem folder = null;
    TagItem tag = null;
    if (!(addressbook instanceof FolderItem)) {
      tag = (TagItem) addressbook;
      // throw new HarnessException("Must use FolderItem as argument, but was "+
      // addressbook.getClass());
    } else {

      folder = (FolderItem) addressbook;
    }
    AbsPage page = null;
    String locator = null;

    if (action == Action.A_LEFTCLICK) {

      // choose target addressbook to move contact to (done for TouchPad)
      locator =
          "css=div[id^='ext-tagview'] div[id^='ext-simplelistitem'] div[id^='ext-element']:contains('"
              + tag.getName()
              + "')";
      page = null;
    } else if (action == Action.A_RIGHTCLICK) {

      locator = "id=zti__main_Contacts__" + folder.getId() + "_textCell";
      if (!this.sIsElementPresent(locator)) {
        throw new HarnessException("Unable to locator folder in tree " + locator);
      }

      this.zRightClickAt(locator, "");
      zWaitForBusyOverlay();

      return (null);

    } else {
      throw new HarnessException("Action " + action + " not yet implemented");
    }

    if (locator == null) {
      throw new HarnessException("no locator defined for action: " + action);
    }

    if (!this.sIsElementPresent(locator)) {
      throw new HarnessException("Unable to locator folder in tree " + locator);
    }

    // By default, left click at locator
    zClick(locator);
    zWaitForBusyOverlay();

    if (page != null) {
      page.zWaitForActive();
    }

    return (page);
  }
  @Test(
      description = "Login to the Ajax Client - with a mountpoint to a deleted share",
      groups = {"functional"})
  public void ShareDeleted01() throws HarnessException {

    // Data setup

    String subject = "subject" + ZimbraSeleniumProperties.getUniqueString();
    String foldername = "folder" + ZimbraSeleniumProperties.getUniqueString();
    String mountpointname = "mountpoint" + ZimbraSeleniumProperties.getUniqueString();

    FolderItem inbox = FolderItem.importFromSOAP(Owner, FolderItem.SystemFolder.Inbox);

    // Create a folder to share
    Owner.soapSend(
        "<CreateFolderRequest xmlns='urn:zimbraMail'>"
            + "<folder name='"
            + foldername
            + "' l='"
            + inbox.getId()
            + "'/>"
            + "</CreateFolderRequest>");

    FolderItem folder = FolderItem.importFromSOAP(Owner, foldername);

    Owner.soapSend(
        "<AddMsgRequest xmlns='urn:zimbraMail'>"
            + "<m l='"
            + folder.getId()
            + "' f='u'>"
            + "<content>From: [email protected]\n"
            + "To: [email protected] \n"
            + "Subject: "
            + subject
            + "\n"
            + "MIME-Version: 1.0 \n"
            + "Content-Type: text/plain; charset=utf-8 \n"
            + "Content-Transfer-Encoding: 7bit\n"
            + "\n"
            + "simple text string in the body\n"
            + "</content>"
            + "</m>"
            + "</AddMsgRequest>");

    // Share it
    Owner.soapSend(
        "<FolderActionRequest xmlns='urn:zimbraMail'>"
            + "<action id='"
            + folder.getId()
            + "' op='grant'>"
            + "<grant d='"
            + app.zGetActiveAccount().EmailAddress
            + "' gt='usr' perm='rwidxa'/>"
            + "</action>"
            + "</FolderActionRequest>");

    // Mount it
    app.zGetActiveAccount()
        .soapSend(
            "<CreateMountpointRequest xmlns='urn:zimbraMail'>"
                + "<link l='1' name='"
                + mountpointname
                + "'  rid='"
                + folder.getId()
                + "' zid='"
                + Owner.ZimbraId
                + "'/>"
                + "</CreateMountpointRequest>");

    FolderMountpointItem mountpoint =
        FolderMountpointItem.importFromSOAP(app.zGetActiveAccount(), mountpointname);
    ZAssert.assertNotNull(mountpoint, "Verify the mountpoint was created");

    // Click Get Mail button
    app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);

    // View the folder
    app.zTreeMail.zTreeItem(Action.A_LEFTCLICK, mountpoint);

    // Logout
    ZimbraAccount account = app.zGetActiveAccount();
    app.zPageMain.zLogout();

    // Share it
    Owner.soapSend(
        "<FolderActionRequest xmlns='urn:zimbraMail'>"
            + "<action id='"
            + folder.getId()
            + "' op='delete'>"
            + "</action>"
            + "</FolderActionRequest>");

    // Login
    app.zPageLogin.zLogin(account);

    // View the folder
    app.zTreeMail.zTreeItem(Action.A_LEFTCLICK, mountpoint);
  }
  @Bugs(ids = "63796")
  @Test(
      description =
          "Verify Permission Denied on Spam (keyboard='ms') a shared mail (read-only share)",
      groups = {"functional"})
  public void MarkSpamMessage_02() throws HarnessException {
    String foldername = "folder" + ZimbraSeleniumProperties.getUniqueString();
    String subject = "subject" + ZimbraSeleniumProperties.getUniqueString();
    String mountpointname = "mountpoint" + ZimbraSeleniumProperties.getUniqueString();

    FolderItem inbox =
        FolderItem.importFromSOAP(ZimbraAccount.AccountA(), FolderItem.SystemFolder.Inbox);

    // Create a folder to share
    ZimbraAccount.AccountA()
        .soapSend(
            "<CreateFolderRequest xmlns='urn:zimbraMail'>"
                + "<folder name='"
                + foldername
                + "' l='"
                + inbox.getId()
                + "'/>"
                + "</CreateFolderRequest>");

    FolderItem folder = FolderItem.importFromSOAP(ZimbraAccount.AccountA(), foldername);

    // Share it
    ZimbraAccount.AccountA()
        .soapSend(
            "<FolderActionRequest xmlns='urn:zimbraMail'>"
                + "<action id='"
                + folder.getId()
                + "' op='grant'>"
                + "<grant d='"
                + app.zGetActiveAccount().EmailAddress
                + "' gt='usr' perm='r'/>"
                + "</action>"
                + "</FolderActionRequest>");

    // Add a message to it
    ZimbraAccount.AccountA()
        .soapSend(
            "<AddMsgRequest xmlns='urn:zimbraMail'>"
                + "<m l='"
                + folder.getId()
                + "' >"
                + "<content>From: [email protected]\n"
                + "To: [email protected] \n"
                + "Subject: "
                + subject
                + "\n"
                + "MIME-Version: 1.0 \n"
                + "Content-Type: text/plain; charset=utf-8 \n"
                + "Content-Transfer-Encoding: 7bit\n"
                + "\n"
                + "simple text string in the body\n"
                + "</content>"
                + "</m>"
                + "</AddMsgRequest>");

    MailItem mail = MailItem.importFromSOAP(ZimbraAccount.AccountA(), "subject:(" + subject + ")");

    // Mount it
    app.zGetActiveAccount()
        .soapSend(
            "<CreateMountpointRequest xmlns='urn:zimbraMail'>"
                + "<link l='1' name='"
                + mountpointname
                + "'  rid='"
                + folder.getId()
                + "' zid='"
                + ZimbraAccount.AccountA().ZimbraId
                + "'/>"
                + "</CreateMountpointRequest>");

    FolderMountpointItem mountpoint =
        FolderMountpointItem.importFromSOAP(app.zGetActiveAccount(), mountpointname);

    // Click Get Mail button
    app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);

    // For some reason, it takes a bit of time for this share to show up
    SleepUtil.sleepMedium();

    // Click on the mountpoint
    app.zTreeMail.zTreeItem(Action.A_LEFTCLICK, mountpoint);

    // Select the item
    app.zPageMail.zListItem(Action.A_LEFTCLICK, mail.dSubject);

    // Spam the item
    app.zPageMail.zKeyboardShortcut(Shortcut.S_MAIL_MARKSPAM);

    // http://bugzilla.zimbra.com/show_bug.cgi?id=63796
    // A "Permission Denied" error popup should not occur
    DialogError dialog = app.zPageMain.zGetErrorDialog(DialogError.DialogErrorID.Zimbra);
    ZAssert.assertNotNull(dialog, "Verify the PERM DENIED Error Dialog is created");
    ZAssert.assertFalse(dialog.zIsActive(), "Verify the PERM DENIED Error Dialog is not active");

    // Verify the message is still in the owner's folder
    mail = MailItem.importFromSOAP(ZimbraAccount.AccountA(), "subject:(" + subject + ")");
    ZAssert.assertEquals(
        mail.dFolderId, folder.getId(), "Verify the message is still in the owner's folder");
  }
  @Test(
      description =
          "Delete multiple tasks (3) by select and toolbar delete : Verify Toast message through GUI",
      groups = {"functional"})
  public void DeleteTaskToastMsg_05() throws HarnessException {

    FolderItem taskFolder = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Tasks);

    // Create the message data to be sent
    String subject1 = "task" + ZimbraSeleniumProperties.getUniqueString();
    String subject2 = "task" + ZimbraSeleniumProperties.getUniqueString();
    String subject3 = "task" + ZimbraSeleniumProperties.getUniqueString();

    app.zGetActiveAccount()
        .soapSend(
            "<CreateTaskRequest xmlns='urn:zimbraMail'>"
                + "<m >"
                + "<inv>"
                + "<comp name='"
                + subject1
                + "'>"
                + "<or a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "</comp>"
                + "</inv>"
                + "<su>"
                + subject1
                + "</su>"
                + "<mp ct='text/plain'>"
                + "<content>content"
                + ZimbraSeleniumProperties.getUniqueString()
                + "</content>"
                + "</mp>"
                + "</m>"
                + "</CreateTaskRequest>");

    app.zGetActiveAccount()
        .soapSend(
            "<CreateTaskRequest xmlns='urn:zimbraMail'>"
                + "<m >"
                + "<inv>"
                + "<comp name='"
                + subject2
                + "'>"
                + "<or a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "</comp>"
                + "</inv>"
                + "<su>"
                + subject2
                + "</su>"
                + "<mp ct='text/plain'>"
                + "<content>content"
                + ZimbraSeleniumProperties.getUniqueString()
                + "</content>"
                + "</mp>"
                + "</m>"
                + "</CreateTaskRequest>");

    app.zGetActiveAccount()
        .soapSend(
            "<CreateTaskRequest xmlns='urn:zimbraMail'>"
                + "<m >"
                + "<inv>"
                + "<comp name='"
                + subject3
                + "'>"
                + "<or a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "</comp>"
                + "</inv>"
                + "<su>"
                + subject3
                + "</su>"
                + "<mp ct='text/plain'>"
                + "<content>content"
                + ZimbraSeleniumProperties.getUniqueString()
                + "</content>"
                + "</mp>"
                + "</m>"
                + "</CreateTaskRequest>");

    GeneralUtility.syncDesktopToZcsWithSoap(app.zGetActiveAccount());

    // Import each message into MailItem objects
    TaskItem task1 = TaskItem.importFromSOAP(app.zGetActiveAccount(), subject1);
    ZAssert.assertNotNull(task1, "Verify the task is created");

    TaskItem task2 = TaskItem.importFromSOAP(app.zGetActiveAccount(), subject2);
    ZAssert.assertNotNull(task2, "Verify the task is created");

    TaskItem task3 = TaskItem.importFromSOAP(app.zGetActiveAccount(), subject3);
    ZAssert.assertNotNull(task3, "Verify the task is created");

    // Refresh the tasks view
    app.zPageTasks.zToolbarPressButton(Button.B_REFRESH);
    app.zTreeTasks.zTreeItem(Action.A_LEFTCLICK, taskFolder);

    // Select the items
    app.zPageTasks.zListItem(Action.A_MAIL_CHECKBOX, subject1);
    app.zPageTasks.zListItem(Action.A_MAIL_CHECKBOX, subject2);
    app.zPageTasks.zListItem(Action.A_MAIL_CHECKBOX, subject3);

    // Click toolbar delete button
    app.zPageTasks.zToolbarPressButton(Button.B_DELETE);

    // Verifying the toaster message
    Toaster toast = app.zPageMain.zGetToaster();
    String toastMsg = toast.zGetToastMessage();
    ZAssert.assertStringContains(
        toastMsg, "3 tasks moved to Trash", "Verify toast message: N Tasks Moved to Trash");
  }
  @Test(
      description = "Sort a list of messages by subject (A->Z)",
      groups = {"functional"})
  public void SortBySubject_01() throws HarnessException {

    // Create the message data
    FolderItem inbox = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Inbox);
    String subjectA = "subjectA" + ZimbraSeleniumProperties.getUniqueString();
    String subjectB = "subjectB" + ZimbraSeleniumProperties.getUniqueString();

    app.zGetActiveAccount()
        .soapSend(
            "<AddMsgRequest xmlns='urn:zimbraMail'>"
                + "<m l='"
                + inbox.getId()
                + "' f='f'>"
                + "<content>From: [email protected]\n"
                + "To: [email protected] \n"
                + "Subject: "
                + subjectA
                + "\n"
                + "MIME-Version: 1.0 \n"
                + "Content-Type: text/plain; charset=utf-8 \n"
                + "Content-Transfer-Encoding: 7bit\n"
                + "\n"
                + "simple text string in the body\n"
                + "</content>"
                + "</m>"
                + "</AddMsgRequest>");

    app.zGetActiveAccount()
        .soapSend(
            "<AddMsgRequest xmlns='urn:zimbraMail'>"
                + "<m l='"
                + inbox.getId()
                + "' >"
                + "<content>From: [email protected]\n"
                + "To: [email protected] \n"
                + "Subject: "
                + subjectB
                + "\n"
                + "MIME-Version: 1.0 \n"
                + "Content-Type: text/plain; charset=utf-8 \n"
                + "Content-Transfer-Encoding: 7bit\n"
                + "\n"
                + "simple text string in the body\n"
                + "</content>"
                + "</m>"
                + "</AddMsgRequest>");

    // Click Get Mail button
    app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);

    // Click on Inbox
    app.zTreeMail.zTreeItem(Action.A_LEFTCLICK, inbox);

    // First, sort by subject to clear the order
    app.zPageMail.zToolbarPressButton(Button.B_MAIL_LIST_SORTBY_FLAGGED);

    // Now, click on "subject"
    app.zPageMail.zToolbarPressButton(Button.B_MAIL_LIST_SORTBY_SUBJECT);

    // Get all the messages in the inbox
    app.zGetActiveAccount()
        .soapSend(
            "<GetPrefsRequest xmlns='urn:zimbraAccount'>"
                + "<pref name='zimbraPrefSortOrder'/>"
                + "</GetPrefsRequest>");

    List<MailItem> messages = app.zPageMail.zListGetMessages();
    ZAssert.assertNotNull(messages, "Verify the message list exists");

    MailItem itemA = null;
    for (MailItem m : messages) {
      if (subjectA.equals(m.gSubject)) {
        itemA = m;
      }
      if (subjectB.equals(m.gSubject)) {
        ZAssert.assertNotNull(
            itemA, "Item B is in the list.  Verify Item A has already been found.");
      }
    }

    ZAssert.assertNotNull(itemA, "Verify Item A was found.");
  }
  @Test(
      description = "Verify Permission Denied on Spam a shared mail (read-only share)",
      groups = {"functional"})
  public void MarkSpamMessage_01() throws HarnessException {
    String foldername = "folder" + ZimbraSeleniumProperties.getUniqueString();
    String subject = "subject" + ZimbraSeleniumProperties.getUniqueString();
    String mountpointname = "mountpoint" + ZimbraSeleniumProperties.getUniqueString();

    FolderItem inbox =
        FolderItem.importFromSOAP(ZimbraAccount.AccountA(), FolderItem.SystemFolder.Inbox);

    // Create a folder to share
    ZimbraAccount.AccountA()
        .soapSend(
            "<CreateFolderRequest xmlns='urn:zimbraMail'>"
                + "<folder name='"
                + foldername
                + "' l='"
                + inbox.getId()
                + "'/>"
                + "</CreateFolderRequest>");

    FolderItem folder = FolderItem.importFromSOAP(ZimbraAccount.AccountA(), foldername);

    // Share it
    ZimbraAccount.AccountA()
        .soapSend(
            "<FolderActionRequest xmlns='urn:zimbraMail'>"
                + "<action id='"
                + folder.getId()
                + "' op='grant'>"
                + "<grant d='"
                + app.zGetActiveAccount().EmailAddress
                + "' gt='usr' perm='r'/>"
                + "</action>"
                + "</FolderActionRequest>");

    // Add a message to it
    ZimbraAccount.AccountA()
        .soapSend(
            "<AddMsgRequest xmlns='urn:zimbraMail'>"
                + "<m l='"
                + folder.getId()
                + "' >"
                + "<content>From: [email protected]\n"
                + "To: [email protected] \n"
                + "Subject: "
                + subject
                + "\n"
                + "MIME-Version: 1.0 \n"
                + "Content-Type: text/plain; charset=utf-8 \n"
                + "Content-Transfer-Encoding: 7bit\n"
                + "\n"
                + "simple text string in the body\n"
                + "</content>"
                + "</m>"
                + "</AddMsgRequest>");

    MailItem mail = MailItem.importFromSOAP(ZimbraAccount.AccountA(), "subject:(" + subject + ")");

    // Mount it
    app.zGetActiveAccount()
        .soapSend(
            "<CreateMountpointRequest xmlns='urn:zimbraMail'>"
                + "<link l='1' name='"
                + mountpointname
                + "'  rid='"
                + folder.getId()
                + "' zid='"
                + ZimbraAccount.AccountA().ZimbraId
                + "'/>"
                + "</CreateMountpointRequest>");

    FolderMountpointItem mountpoint =
        FolderMountpointItem.importFromSOAP(app.zGetActiveAccount(), mountpointname);

    // Click Get Mail button
    app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);

    // Click on the mountpoint
    app.zTreeMail.zTreeItem(Action.A_LEFTCLICK, mountpoint);

    // Select the item
    app.zPageMail.zListItem(Action.A_LEFTCLICK, mail.dSubject);

    // Verify that the toolbar button is disabled
    String locator = "css=div[id='ztb__TV-main'] div[id='zb__TV-main__SPAM']";

    ZAssert.assertTrue(
        app.zPageMail.sIsElementPresent(locator), "Verify the spam button is present");

    ZAssert.assertTrue(
        app.zPageMail.sIsElementPresent(locator + "[class*='ZDisabled']"),
        "Verify the spam button is disabled");
  }
  @Test(
      description = "Mark all messages as read in folder (context menu)",
      groups = {"functional"})
  public void MarkAllAsReadMountpoint_01() throws HarnessException {
    String foldername = "folder" + ZimbraSeleniumProperties.getUniqueString();
    String subject = "subject" + ZimbraSeleniumProperties.getUniqueString();
    String mountpointname = "mountpoint" + ZimbraSeleniumProperties.getUniqueString();

    FolderItem inbox =
        FolderItem.importFromSOAP(ZimbraAccount.AccountA(), FolderItem.SystemFolder.Inbox);

    // Create a folder to share
    ZimbraAccount.AccountA()
        .soapSend(
            "<CreateFolderRequest xmlns='urn:zimbraMail'>"
                + "<folder name='"
                + foldername
                + "' l='"
                + inbox.getId()
                + "'/>"
                + "</CreateFolderRequest>");

    FolderItem folder = FolderItem.importFromSOAP(ZimbraAccount.AccountA(), foldername);

    // Share it
    ZimbraAccount.AccountA()
        .soapSend(
            "<FolderActionRequest xmlns='urn:zimbraMail'>"
                + "<action id='"
                + folder.getId()
                + "' op='grant'>"
                + "<grant d='"
                + app.zGetActiveAccount().EmailAddress
                + "' gt='usr' perm='rwidxa'/>"
                + "</action>"
                + "</FolderActionRequest>");

    // Add a message to it
    ZimbraAccount.AccountA()
        .soapSend(
            "<AddMsgRequest xmlns='urn:zimbraMail'>"
                + "<m l='"
                + folder.getId()
                + "' f='u'>"
                + "<content>From: [email protected]\n"
                + "To: [email protected] \n"
                + "Subject: "
                + subject
                + "\n"
                + "MIME-Version: 1.0 \n"
                + "Content-Type: text/plain; charset=utf-8 \n"
                + "Content-Transfer-Encoding: 7bit\n"
                + "\n"
                + "simple text string in the body\n"
                + "</content>"
                + "</m>"
                + "</AddMsgRequest>");

    // Mount it
    app.zGetActiveAccount()
        .soapSend(
            "<CreateMountpointRequest xmlns='urn:zimbraMail'>"
                + "<link l='1' name='"
                + mountpointname
                + "'  rid='"
                + folder.getId()
                + "' zid='"
                + ZimbraAccount.AccountA().ZimbraId
                + "'/>"
                + "</CreateMountpointRequest>");

    FolderMountpointItem mountpoint =
        FolderMountpointItem.importFromSOAP(app.zGetActiveAccount(), mountpointname);

    // Click Get Mail button
    app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);

    // Right click on folder, select "Mark all as read"
    app.zTreeMail.zTreeItem(Action.A_RIGHTCLICK, Button.B_TREE_FOLDER_MARKASREAD, mountpoint);

    // Make sure the folder was created on the server
    MailItem mail = MailItem.importFromSOAP(ZimbraAccount.AccountA(), "subject:(" + subject + ")");
    ZAssert.assertNotNull(mail, "Verify the message exists");
    ZAssert.assertStringDoesNotContain(
        mail.getFlags(), "u", "Verify the mail flags does not contain (u)nread");
  }
  protected AbsPage zTreeItem(Action action, Button option, FolderItem folderItem)
      throws HarnessException {

    AbsPage page = null;
    String actionLocator = null;
    String optionLocator = null;

    if ((action == null) || (option == null) || (folderItem == null)) {
      throw new HarnessException("Must define an action, option, and addressbook");
    }

    logger.info(
        myPageName() + " zTreeItem(" + action + ", " + option + "," + folderItem.getName() + ")");
    tracer.trace(action + " then " + option + " on Folder Item = " + folderItem.getName());

    if (folderItem.getName().equals("USER_ROOT")) {
      actionLocator = "css=div#ztih__main_Contacts__ADDRBOOK_div";
    } else {
      actionLocator = "css=div#zti__main_Contacts__" + folderItem.getId() + "_div";
    }

    if (action == Action.A_RIGHTCLICK) {

      if (option == Button.B_TREE_NEWFOLDER) {

        optionLocator =
            "css=div[id^='ZmActionMenu_contacts_ADDRBOOK'] div[id^='NEW_ADDRBOOK'] td[id$='_title']";
        page =
            new DialogCreateFolder(MyApplication, ((AppAjaxClient) MyApplication).zPageAddressbook);

      } else if (option == Button.B_DELETE) {

        optionLocator =
            "css=div[id^='ZmActionMenu_contacts_ADDRBOOK'] div[id^='DELETE_WITHOUT_SHORTCUT'] td[id$='_title']";
        page = null;

      } else if (option == Button.B_RENAME) {

        optionLocator =
            "css=div[id^='ZmActionMenu_contacts_ADDRBOOK'] div[id^='RENAME_FOLDER'] td[id$='_title']";
        page =
            new DialogRenameFolder(MyApplication, ((AppAjaxClient) MyApplication).zPageAddressbook);

      } else if (option == Button.B_TREE_EDIT) {

        optionLocator =
            "css=div[id^='ZmActionMenu_contacts_ADDRBOOK'] div[id^='EDIT_PROPS'] td[id$='_title']";
        page =
            new DialogEditFolder(MyApplication, ((AppAjaxClient) MyApplication).zPageAddressbook);

      } else if (option == Button.B_TREE_FOLDER_EMPTY) {

        optionLocator =
            "css=div[id^='ZmActionMenu_contacts_ADDRBOOK'] div[id^='EMPTY_FOLDER'] td[id$='_title']";
        page =
            new DialogWarning(
                DialogWarning.DialogWarningID.EmptyFolderWarningMessage,
                MyApplication,
                ((AppAjaxClient) MyApplication).zPageAddressbook);

      } else if (option == Button.B_SHARE) {

        optionLocator =
            "css=div[id='ZmActionMenu_contacts_ADDRBOOK'] div[id='SHARE_ADDRBOOK'] td[id$='_title']";
        page = new DialogShare(MyApplication, ((AppAjaxClient) MyApplication).zPageAddressbook);

      } else {
        throw new HarnessException("implement action:" + action + " option:" + option);
      }

      if (actionLocator != null) {

        zRightClickAt(actionLocator, "0,0");
        zWaitForBusyOverlay();
      }

      if (optionLocator != null) {

        zClickAt(optionLocator, "0,0");
        zWaitForBusyOverlay();
      }

      if (page != null) {
        page.zWaitForActive();
      }

      return page;

    } else if (action == Action.A_LEFTCLICK) {

      if (option == Button.B_TREE_NEWFOLDER) {

        zClickAt("css=div[class^=ImgNewContactsFolder][class*=ZWidget]", "0,0");
        page =
            new DialogCreateFolder(MyApplication, ((AppAjaxClient) MyApplication).zPageAddressbook);

      } else {
        throw new HarnessException("implement action:" + action + " option:" + option);
      }

    } else {
      throw new HarnessException("implement action:" + action + " option:" + option);
    }

    if (page != null) {
      page.zWaitForActive();
    }

    return page;
  }
Exemple #30
0
  @Test(
      description =
          "Grantee opens appointment from grantor's calendar and close it without making any changes",
      groups = {"functional"})
  public void Close_01() throws HarnessException {

    String apptSubject = "appointment" + ZimbraSeleniumProperties.getUniqueString();
    String apptContent = ZimbraSeleniumProperties.getUniqueString();
    String foldername = "folder" + ZimbraSeleniumProperties.getUniqueString();
    String mountpointname = "mountpoint" + ZimbraSeleniumProperties.getUniqueString();

    Calendar now = this.calendarWeekDayUTC;
    ZDate startUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            12,
            0,
            0);
    ZDate endUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            14,
            0,
            0);

    FolderItem calendarFolder =
        FolderItem.importFromSOAP(ZimbraAccount.AccountA(), FolderItem.SystemFolder.Calendar);

    // Create a folder to share
    ZimbraAccount.AccountA()
        .soapSend(
            "<CreateFolderRequest xmlns='urn:zimbraMail'>"
                + "<folder name='"
                + foldername
                + "' l='"
                + calendarFolder.getId()
                + "' view='appointment'/>"
                + "</CreateFolderRequest>");

    FolderItem folder = FolderItem.importFromSOAP(ZimbraAccount.AccountA(), foldername);

    // Share it
    ZimbraAccount.AccountA()
        .soapSend(
            "<FolderActionRequest xmlns='urn:zimbraMail'>"
                + "<action id='"
                + folder.getId()
                + "' op='grant'>"
                + "<grant d='"
                + app.zGetActiveAccount().EmailAddress
                + "' gt='usr' perm='r' view='appointment'/>"
                + "</action>"
                + "</FolderActionRequest>");

    // Mount it
    app.zGetActiveAccount()
        .soapSend(
            "<CreateMountpointRequest xmlns='urn:zimbraMail'>"
                + "<link l='1' name='"
                + mountpointname
                + "'  rid='"
                + folder.getId()
                + "' zid='"
                + ZimbraAccount.AccountA().ZimbraId
                + "' view='appointment' color='5'/>"
                + "</CreateMountpointRequest>");

    // Create appointment
    ZimbraAccount.AccountA()
        .soapSend(
            "<CreateAppointmentRequest xmlns='urn:zimbraMail'>"
                + "<m l='"
                + folder.getId()
                + "' >"
                + "<inv method='REQUEST' type='event' status='CONF' draft='0' class='PUB' fb='B' transp='O' allDay='0' name='"
                + apptSubject
                + "'>"
                + "<s d='"
                + startUTC.toTimeZone(ZTimeZone.TimeZoneEST.getID()).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + ZTimeZone.TimeZoneEST.getID()
                + "'/>"
                + "<e d='"
                + endUTC.toTimeZone(ZTimeZone.TimeZoneEST.getID()).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + ZTimeZone.TimeZoneEST.getID()
                + "'/>"
                + "<or a='"
                + ZimbraAccount.AccountA().EmailAddress
                + "'/>"
                + "<at role='REQ' ptst='NE' rsvp='1' a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "</inv>"
                + "<e a='"
                + app.zGetActiveAccount().EmailAddress
                + "' t='t'/>"
                + "<su>"
                + apptSubject
                + "</su>"
                + "<mp content-type='text/plain'>"
                + "<content>"
                + apptContent
                + "</content>"
                + "</mp>"
                + "</m>"
                + "</CreateAppointmentRequest>");
    app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH);

    // Mark ON to mounted calendar folder and select the appointment
    app.zTreeCalendar.zMarkOnOffCalendarFolder("Calendar");
    app.zTreeCalendar.zMarkOnOffMountedFolder(mountpointname);

    // Open appointment
    app.zPageCalendar.zListItem(Action.A_RIGHTCLICK, Button.O_OPEN_MENU, apptSubject);
    app.zPageCalendar.zToolbarPressButton(Button.B_CLOSE);

    // Make sure there is no warning or any other dialog (below code should fail if any)
    app.zPageCalendar.zListItem(Action.A_RIGHTCLICK, Button.O_OPEN_MENU, apptSubject);
    app.zPageCalendar.zToolbarPressButton(Button.B_CLOSE);
  }