@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)"); }
@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"); }
@Bugs(ids = "69132") @Test( description = "Cancel meeting using context menu", groups = {"functional"}) public void CancelMeeting_01() throws HarnessException { // -- Data setup // Creating object for meeting data String tz, apptSubject, apptBody, apptAttendee1; tz = ZTimeZone.TimeZoneEST.getID(); apptSubject = ZimbraSeleniumProperties.getUniqueString(); apptBody = ZimbraSeleniumProperties.getUniqueString(); apptAttendee1 = ZimbraAccount.AccountA().EmailAddress; // Absolute dates in UTC zone 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); app.zGetActiveAccount() .soapSend( "<CreateAppointmentRequest xmlns='urn:zimbraMail'>" + "<m>" + "<inv method='REQUEST' type='event' status='CONF' draft='0' class='PUB' fb='B' transp='O' allDay='0' name='" + apptSubject + "'>" + "<s d='" + startUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS() + "' tz='" + tz + "'/>" + "<e d='" + endUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS() + "' tz='" + tz + "'/>" + "<or a='" + app.zGetActiveAccount().EmailAddress + "'/>" + "<at role='REQ' ptst='NE' rsvp='1' a='" + apptAttendee1 + "' d='2'/>" + "</inv>" + "<e a='" + apptAttendee1 + "' t='t'/>" + "<mp content-type='text/plain'>" + "<content>" + apptBody + "</content>" + "</mp>" + "<su>" + apptSubject + "</su>" + "</m>" + "</CreateAppointmentRequest>"); String apptId = app.zGetActiveAccount().soapSelectValue("//mail:CreateAppointmentResponse", "apptId"); // -- GUI actions // Refresh the view app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH); // Select the appointment app.zPageCalendar.zListItem(Action.A_LEFTCLICK, apptSubject); // Right Click -> Delete context menu DialogWarning dialog = (DialogWarning) app.zPageCalendar.zListItem(Action.A_RIGHTCLICK, Button.O_CANCEL_MENU, apptSubject); // Click Send Cancellation dialog.zClickButton(Button.B_SEND_CANCELLATION); // -- Verification // Verify the meeting disappears from the view ZAssert.assertEquals( app.zPageCalendar.sIsElementPresent(app.zPageCalendar.zGetApptLocator(apptSubject)), false, "Verify meeting is deleted from organizer's calendar"); // Verify meeting is deleted from attendee's calendar // AppointmentItem canceledAppt = AppointmentItem.importFromSOAP(ZimbraAccount.AccountA(), // "subject:("+ apptSubject +")", startUTC, endUTC); AppointmentItem canceledAppt = AppointmentItem.importFromSOAP(ZimbraAccount.AccountA(), "subject:(" + apptSubject + ")"); ZAssert.assertNull(canceledAppt, "Verify meeting is deleted from attendee's calendar"); }
@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"); }
@Test( description = "Run a saved search", groups = {"smoke"}) public void RunSavedSearch_01() throws HarnessException { // Create the message data to be sent String name = "search" + ZimbraSeleniumProperties.getUniqueString(); String subject1 = "subject" + ZimbraSeleniumProperties.getUniqueString(); String subject2 = "subject" + ZimbraSeleniumProperties.getUniqueString(); String query = "subject:(" + subject1 + ")"; // Send two messages with different subjects to the account ZimbraAccount.AccountA() .soapSend( "<SendMsgRequest xmlns='urn:zimbraMail'>" + "<m>" + "<e t='t' a='" + app.zGetActiveAccount().EmailAddress + "'/>" + "<su>" + subject1 + "</su>" + "<mp ct='text/plain'>" + "<content>content1" + ZimbraSeleniumProperties.getUniqueString() + "</content>" + "</mp>" + "</m>" + "</SendMsgRequest>"); ZimbraAccount.AccountA() .soapSend( "<SendMsgRequest xmlns='urn:zimbraMail'>" + "<m>" + "<e t='t' a='" + app.zGetActiveAccount().EmailAddress + "'/>" + "<su>" + subject2 + "</su>" + "<mp ct='text/plain'>" + "<content>content1" + ZimbraSeleniumProperties.getUniqueString() + "</content>" + "</mp>" + "</m>" + "</SendMsgRequest>"); // Create the saved search app.zGetActiveAccount() .soapSend( "<CreateSearchFolderRequest xmlns='urn:zimbraMail'>" + "<search name='" + name + "' query='" + query + "' l='1'/>" + "</CreateSearchFolderRequest>"); // Get the item SavedSearchFolderItem item = SavedSearchFolderItem.importFromSOAP(app.zGetActiveAccount(), name); // Refresh the folder list app.zPageMail.zToolbarPressButton(Button.B_GETMAIL); // Left click on the search app.zTreeMail.zTreeItem(Action.A_LEFTCLICK, item); // Verify the correct messages appear List<MailItem> messages = app.zPageMail.zListGetMessages(); ZAssert.assertNotNull(messages, "Verify the message list exists"); MailItem found1 = null; MailItem found2 = null; for (MailItem m : messages) { logger.info("Subject: looking for " + subject1 + " found: " + m.gSubject); if (subject1.equals(m.gSubject)) { found1 = m; break; } logger.info("Subject: looking for " + subject2 + " found: " + m.gSubject); if (subject2.equals(m.gSubject)) { found2 = m; break; } } ZAssert.assertNotNull(found1, "Verify the matched message exists in the inbox"); ZAssert.assertNull(found2, "Verify the un-match message does not exist in the inbox"); }
@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"); }
@Test( description = "Forward (on behalf of) to a message in a shared folder (admin rights) - no SOBO rights", groups = {"functional"}) public void ForwardMail_02() throws HarnessException { // -- DATA // Create the folder owner ZimbraAccount owner = (new ZimbraAccount()).provision().authenticate(); 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.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, app.zGetActiveAccount().EmailAddress, "Verify the 'From' field is correct"); ZAssert.assertNull(sent.dSenderRecipient, "Verify the 'Sender' field is empty"); }