コード例 #1
0
  @Bugs(ids = "82807")
  @Test(
      description = "Hover over an image attachment",
      dataProvider = "DataProviderMimeWithImageAttachments",
      groups = {"functional"})
  public void HoverOverAttachment_01(String subject, String path) throws HarnessException {

    // -- DATA

    final String mimeFile = ZimbraSeleniumProperties.getBaseDirectory() + path;
    LmtpInject.injectFile(app.zGetActiveAccount().EmailAddress, new File(mimeFile));

    // -- GUI

    // Click on Get Mail to refresh the folder list
    app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);

    // Select the message
    DisplayMail display = (DisplayMail) app.zPageMail.zListItem(Action.A_LEFTCLICK, subject);

    List<AttachmentItem> attachments = display.zListGetAttachments();
    ZAssert.assertEquals(attachments.size(), 1, "Verify the attachment appears");

    TooltipImage tooltip =
        (TooltipImage) display.zListAttachmentItem(Action.A_HOVEROVER, attachments.get(0));

    // -- VERIFICATION

    ZAssert.assertTrue(tooltip.zIsActive(), "Verify the tooltip shows");
    ZAssert.assertNotNull(tooltip.zGetField(Field.URL), "Verify the image URL");
  }
コード例 #2
0
ファイル: DeleteContactGroup.java プロジェクト: huu0510/z-pec
  @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");
  }
コード例 #3
0
  @Test(
      description = "Rename a folder - set to an invalid name with ':'",
      groups = {"functional"})
  public void RenameFolder_02() throws HarnessException {

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

    // Create the subfolder
    String name1 = "folder" + ZimbraSeleniumProperties.getUniqueString();

    app.zGetActiveAccount()
        .soapSend(
            "<CreateFolderRequest xmlns='urn:zimbraMail'>"
                + "<folder name='"
                + name1
                + "' l='"
                + inbox.getId()
                + "'/>"
                + "</CreateFolderRequest>");

    FolderItem subfolder1 = FolderItem.importFromSOAP(app.zGetActiveAccount(), name1);
    ZAssert.assertNotNull(subfolder1, "Verify the subfolder is available");

    // Click on Get Mail to refresh the folder list
    app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);

    // Rename the folder using context menu
    DialogRenameFolder dialog =
        (DialogRenameFolder)
            app.zTreeMail.zTreeItem(Action.A_RIGHTCLICK, Button.B_RENAME, subfolder1);
    ZAssert.assertNotNull(dialog, "Verify the dialog opened");

    // Set the name, click OK
    String name2 = "folder:folder" + ZimbraSeleniumProperties.getUniqueString();
    dialog.zSetNewName(name2);
    dialog.zClickButton(Button.B_OK);

    DialogError error = app.zPageMain.zGetErrorDialog(DialogErrorID.InvalidFolderName);
    ZAssert.assertTrue(error.zIsActive(), "Verify the error dialog appears");

    error.zClickButton(Button.B_OK);
  }
コード例 #4
0
ファイル: DeleteContactGroup.java プロジェクト: huu0510/z-pec
  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");
  }
コード例 #5
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");
  }
コード例 #6
0
ファイル: DeleteContactGroup.java プロジェクト: koem/Zimbra
  @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");
  }
コード例 #7
0
  @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();
    }
  }
コード例 #8
0
ファイル: FlagMail.java プロジェクト: koem/Zimbra
  @Test(
      description = "Flag a mail by using shortcut 'mf'",
      groups = {"functional"})
  public void FlagMail_02() throws HarnessException {

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

    ZimbraAccount.AccountA()
        .soapSend(
            "<SendMsgRequest xmlns='urn:zimbraMail'>"
                + "<m>"
                + "<e t='t' a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "<su>"
                + subject
                + "</su>"
                + "<mp ct='text/plain'>"
                + "<content>content"
                + ZimbraSeleniumProperties.getUniqueString()
                + "</content>"
                + "</mp>"
                + "</m>"
                + "</SendMsgRequest>");

    // Create a mail item to represent the message
    MailItem mail = MailItem.importFromSOAP(app.zGetActiveAccount(), "subject:(" + subject + ")");

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

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

    // Flag the item
    app.zPageMail.zKeyboardShortcut(Shortcut.S_MAIL_MARKFLAG);

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

    MailItem listmail = null;
    for (MailItem m : messages) {
      logger.info("Subject: looking for " + mail.dSubject + " found: " + m.gSubject);
      if (mail.dSubject.equals(m.gSubject)) {
        listmail = m;
        break;
      }
    }

    GeneralUtility.syncDesktopToZcsWithSoap(app.zGetActiveAccount());

    // Make sure the GUI shows "flagged"
    ZAssert.assertNotNull(listmail, "Verify the message is in the list");
    ZAssert.assertTrue(listmail.gIsFlagged, "Verify the message is flagged in the list");

    // Make sure the server shows "flagged"
    mail = MailItem.importFromSOAP(app.zGetActiveAccount(), "subject:(" + subject + ")");
    ZAssert.assertStringContains(
        mail.getFlags(), "f", "Verify the message is flagged in the server");
  }