Exemple #1
0
  @Test(
      description = "Delete a a top level briefcase folder - Right click, Delete",
      groups = {"smoke"})
  public void DeleteFolder_02() throws HarnessException {
    ZimbraAccount account = app.zGetActiveAccount();

    FolderItem briefcaseRootFolder = FolderItem.importFromSOAP(account, SystemFolder.Briefcase);

    FolderItem userRootFolder = FolderItem.importFromSOAP(account, SystemFolder.UserRoot);

    ZAssert.assertNotNull(userRootFolder, "Verify the user root folder is available");

    FolderItem trash = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Trash);
    ZAssert.assertNotNull(trash, "Verify the trash is available");

    // Create a top level briefcase folder
    String briefcaseTopLevelFolderName = "folder" + ZimbraSeleniumProperties.getUniqueString();

    account.soapSend(
        "<CreateFolderRequest xmlns='urn:zimbraMail'>"
            + "<folder name='"
            + briefcaseTopLevelFolderName
            + "' l='"
            + userRootFolder.getId()
            + "' view='document'/>"
            + "</CreateFolderRequest>");

    FolderItem briefcaseTopLevelFolder =
        FolderItem.importFromSOAP(account, briefcaseTopLevelFolderName);
    ZAssert.assertNotNull(
        briefcaseTopLevelFolder, "Verify the briefcase top level folder is available");

    // refresh the Briefcase tree folder list
    app.zTreeBriefcase.zTreeItem(Action.A_LEFTCLICK, briefcaseRootFolder, false);

    // Delete the folder using context menu
    app.zTreeBriefcase.zTreeItem(
        Action.A_RIGHTCLICK, Button.B_TREE_DELETE, briefcaseTopLevelFolder);

    // Verify the folder is now in the trash
    briefcaseTopLevelFolder =
        FolderItem.importFromSOAP(app.zGetActiveAccount(), briefcaseTopLevelFolderName);
    ZAssert.assertNotNull(
        briefcaseTopLevelFolder, "Verify the briefcase top level folder is again available");
    ZAssert.assertEquals(
        trash.getId(),
        briefcaseTopLevelFolder.getParentId(),
        "Verify the deleted briefcase top level folder's parent is now the trash folder ID");
  }
  @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 = "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");
  }