@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");
  }
Example #2
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");
  }
Example #3
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");
  }
Example #4
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");
  }