@Test(
      description = "Delete a conversation",
      groups = {"smoke"})
  public void DeleteConversation_01() 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);

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

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

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

    boolean found = false;
    for (MailItem m : conversations) {
      logger.info("Subject: looking for " + c.getSubject() + " found: " + m.gSubject);
      if (c.getSubject().equals(m.getSubject())) {
        found = true;
        break;
      }
    }
    ZAssert.assertFalse(found, "Verify the conversation is no longer in the inbox");
  }
Ejemplo n.º 2
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

  }
Ejemplo n.º 3
0
  @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");
  }
Ejemplo n.º 4
0
  @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");
  }
  @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");
      }
    }
  }
Ejemplo n.º 7
0
  @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");
  }
Ejemplo n.º 8
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");

  }
Ejemplo n.º 9
0
  @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");
  }
Ejemplo n.º 10
0
  @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");
  }
Ejemplo n.º 11
0
  @Bugs(ids = "81920")
  @Test(
      description = "Reply to a conversation with a draft",
      groups = {"functional"})
  public void Bug81920_01() throws HarnessException {

    // -- DATA

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

    // Create a draft in the conversation
    // First, need to determine the last message received
    int id = 0;
    for (MailItem m : c.getMessageList()) {
      if (Integer.parseInt(m.getId()) > id) {
        id = Integer.parseInt(m.getId());
      }
    }
    String body = "draft" + ZimbraSeleniumProperties.getUniqueString();
    app.zGetActiveAccount()
        .soapSend(
            "<SaveDraftRequest xmlns='urn:zimbraMail'>"
                + "<m origid='"
                + id
                + "' rt='r'>"
                + "<e t='t' a='"
                + ZimbraAccount.AccountA().EmailAddress
                + "'/>"
                + "<su>RE: "
                + c.getSubject()
                + "</su>"
                + "<mp ct='text/plain'>"
                + "<content>"
                + body
                + "</content>"
                + "</mp>"
                + "</m>"
                + "</SaveDraftRequest>");

    // Change the whole conversation to be unread
    app.zGetActiveAccount()
        .soapSend(
            "<ItemActionRequest xmlns='urn:zimbraMail'>"
                + "<action op='!read' id='"
                + c.getId()
                + "'/>"
                + "</ItemActionRequest>");

    // -- GUI

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

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

    // Click reply
    FormMailNew mailform = (FormMailNew) app.zPageMail.zToolbarPressButton(Button.B_REPLY);
    ZAssert.assertNotNull(mailform, "Verify the new form opened");

    // Send the message
    mailform.zSubmit();

    // -- Verification

    // From the test account, check the sent folder for the reply
    MailItem sent =
        MailItem.importFromSOAP(
            app.zGetActiveAccount(), "in:sent subject:(" + c.getSubject() + ")");
    ZAssert.assertNotNull(sent, "Verify the sent message in the sent folder");

    // Verify the draft body does not appear in the reply
    ZAssert.assertStringDoesNotContain(
        sent.dBodyText, body, "Verify the draft body does not appear in the reply");
  }
Ejemplo n.º 12
0
  @Bugs(ids = "81920")
  @Test(
      description = "Reply to a conversation with a spammed message",
      groups = {"functional"})
  public void Bug81920_03() throws HarnessException {

    // -- DATA

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

    // Create a draft in the conversation
    // First, need to determine the last message received
    int id = 0;
    String body = null;
    for (MailItem m : c.getMessageList()) {
      if (Integer.parseInt(m.getId()) > id) {
        id = Integer.parseInt(m.getId());
        body = m.dBodyText;
      }
    }

    // Move the last message to the trash
    app.zGetActiveAccount()
        .soapSend(
            "<ItemActionRequest xmlns='urn:zimbraMail'>"
                + "<action op='spam' id='"
                + id
                + "'/>"
                + "</ItemActionRequest>");

    // Change the whole conversation to be unread
    app.zGetActiveAccount()
        .soapSend(
            "<ItemActionRequest xmlns='urn:zimbraMail'>"
                + "<action op='!read' id='"
                + c.getId()
                + "'/>"
                + "</ItemActionRequest>");

    // -- GUI

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

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

    // Click reply
    FormMailNew mailform = (FormMailNew) app.zPageMail.zToolbarPressButton(Button.B_REPLY);
    ZAssert.assertNotNull(mailform, "Verify the new form opened");

    // Send the message
    mailform.zSubmit();

    // -- Verification

    // From the test account, check the sent folder for the reply
    MailItem sent =
        MailItem.importFromSOAP(
            app.zGetActiveAccount(), "in:sent subject:(" + c.getSubject() + ")");
    ZAssert.assertNotNull(sent, "Verify the sent message in the sent folder");

    // Verify the draft body does not appear in the reply
    ZAssert.assertStringDoesNotContain(
        sent.dBodyText, body, "Verify the spam body does not appear in the reply");
  }