@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)"); }
/** * Quick Command: Item Type: Mail Action 1: Tag Action 2: Mark Read Action 3: Mark Flagged Action * 4: Move To Subfolder * * @throws HarnessException */ protected QuickCommand getQuickCommand01() throws HarnessException { if (command1 != null) { // Command already exists, just return it return (command1); } // Create a tag String tagname = "tag" + ZimbraSeleniumProperties.getUniqueString(); ZimbraAccount.AccountZWC() .soapSend( "<CreateTagRequest xmlns='urn:zimbraMail'>" + "<tag name='" + tagname + "' color='1' />" + "</CreateTagRequest>"); TagItem tag = TagItem.importFromSOAP(ZimbraAccount.AccountZWC(), tagname); ZAssert.assertNotNull(tag, "Verify the tag was created"); // Create a subfolder String foldername = "folder" + ZimbraSeleniumProperties.getUniqueString(); ZimbraAccount.AccountZWC() .soapSend( "<CreateFolderRequest xmlns='urn:zimbraMail'>" + "<folder name='" + foldername + "' l='1' view='message'/>" + "</CreateFolderRequest>"); FolderItem folder = FolderItem.importFromSOAP(ZimbraAccount.AccountZWC(), foldername); ZAssert.assertNotNull(folder, "Verify the subfolder is available"); // Create the list of actions ArrayList<QuickCommandAction> actions = new ArrayList<QuickCommandAction>(); actions.add(new QuickCommandAction(QuickCommandAction.TypeId.actionTag, tag.getId(), true)); actions.add(new QuickCommandAction(QuickCommandAction.TypeId.actionFlag, "read", true)); actions.add(new QuickCommandAction(QuickCommandAction.TypeId.actionFlag, "flagged", true)); actions.add( new QuickCommandAction(QuickCommandAction.TypeId.actionFileInto, folder.getId(), true)); String name = "name" + ZimbraSeleniumProperties.getUniqueString(); String description = "description" + ZimbraSeleniumProperties.getUniqueString(); command1 = new QuickCommand(name, description, ItemTypeId.MSG, true); command1.addActions(actions); return (command1); }
@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"); }
@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"); }
@Bugs(ids = "81078") @Test( description = "Verify the LinkedIn zimlet appears in the folder tree", groups = {"functional"}) public void FolderTree_01() throws HarnessException { // -- DATA ZimletItem linkedin = CoreZimletItem.getCoreZimlet(CoreZimletName.com_zimbra_linkedinimage, app); // -- GUI // Expand the zimlets section app.zTreeMail.zSectionAction(FolderSectionAction.Expand, FolderSection.Zimlets); // Get the list of zimlets List<ZimletItem> zimlets = app.zTreeMail.zListGetZimlets(); // -- VERIFICATION // Find out if LinkedIn is listed ZimletItem found = null; for (ZimletItem zimlet : zimlets) { if (linkedin.equals(zimlet)) { found = zimlet; } } ZAssert.assertNotNull(found, "Verify the LinkedIn Zimlet was found"); }
@Test( description = "D1 Enhancement : Add a contact to an existing group", groups = {"smoke", "matt"}) public void Add1ContactToExistingGroup() throws HarnessException { // -- Data // Create a contact ContactItem contact = ContactItem.createContactItem(app.zGetActiveAccount()); // Create a contact group ContactGroupItem group = ContactGroupItem.createContactGroupItem(app.zGetActiveAccount()); // -- GUI // Refresh app.zPageAddressbook.zRefresh(); // Right click on the contact -> Group -> Existing Group Name app.zPageAddressbook.zListItem( Action.A_RIGHTCLICK, Button.B_CONTACTGROUP, group, contact.getName()); // -- Verification // Verify the contact group is created ContactGroupItem actual = ContactGroupItem.importFromSOAP(app.zGetActiveAccount(), group.getName()); ZAssert.assertNotNull(actual, "Verify the contact group is created"); // Verify the contact group contains the contact ZAssert.assertContains( actual.getMemberList(), new ContactGroupItem.MemberItemContact(contact), "Verify the contact group conatins the contact"); }
@Test( description = "Edit a folder, change the color (Context menu -> Edit)", groups = {"functional"}) public void ChangeColorOfSystemFolders() throws HarnessException { // -- Data FolderItem contacts = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Contacts); // -- 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, contacts); ZAssert.assertNotNull(dialog, "Verify the dialog opened"); dialog.zSetNewColor(FolderColor.Green); dialog.zClickButton(Button.B_OK); // -- Verification // Get the folder again FolderItem actual = FolderItem.importFromSOAP(app.zGetActiveAccount(), contacts.getName()); ZAssert.assertEquals( actual.getColor(), "3", "Verify the color of the folder is set to green (3)"); }
@Test( description = "D1 Enhancement : Create a contact group with 3 contacts", groups = {"functional"}) public void CreateContactGroupWith3Contacts() throws HarnessException { // -- Data // Create a contact ContactItem contact1 = ContactItem.createContactItem(app.zGetActiveAccount()); ContactItem contact2 = ContactItem.createContactItem(app.zGetActiveAccount()); ContactItem contact3 = ContactItem.createContactItem(app.zGetActiveAccount()); // Create a contact group String groupname = "group" + ZimbraSeleniumProperties.getUniqueString(); // -- GUI // Refresh app.zPageAddressbook.zRefresh(); // Check 3 contact items app.zPageAddressbook.zListItem(Action.A_CHECKBOX, contact1.getName()); app.zPageAddressbook.zListItem(Action.A_CHECKBOX, contact2.getName()); app.zPageAddressbook.zListItem(Action.A_CHECKBOX, contact3.getName()); // Right click on one contact -> Group -> Existing Group Name DialogNewContactGroup dialog = (DialogNewContactGroup) app.zPageAddressbook.zListItem( Action.A_RIGHTCLICK, Button.B_CONTACTGROUP, Button.O_NEW_CONTACTGROUP, contact1.getName()); dialog.zEnterGroupName(groupname); dialog.zClickButton(Button.B_OK); // -- Verification // Verify the contact group is created ContactGroupItem actual = ContactGroupItem.importFromSOAP(app.zGetActiveAccount(), groupname); ZAssert.assertNotNull(actual, "Verify the contact group is created"); // Verify the contact group contains the contact ZAssert.assertContains( actual.getMemberList(), new ContactGroupItem.MemberItemContact(contact1), "Verify the contact group conatins the contact"); ZAssert.assertContains( actual.getMemberList(), new ContactGroupItem.MemberItemContact(contact2), "Verify the contact group conatins the contact"); ZAssert.assertContains( actual.getMemberList(), new ContactGroupItem.MemberItemContact(contact3), "Verify the contact group conatins the contact"); }
@Test( description = "Delete a task by selecting and typing 'delete' keyboard-Verify Toast message through GUI", groups = {"smoke"}, dataProvider = "DataProviderDeleteKeys") public void DeleteTaskToastMsg_03(String name, int keyEvent) throws HarnessException { FolderItem taskFolder = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Tasks); // Create a basic task to delete String subject = "task" + ZimbraSeleniumProperties.getUniqueString(); app.zGetActiveAccount() .soapSend( "<CreateTaskRequest xmlns='urn:zimbraMail'>" + "<m >" + "<inv>" + "<comp name='" + subject + "'>" + "<or a='" + app.zGetActiveAccount().EmailAddress + "'/>" + "</comp>" + "</inv>" + "<su>" + subject + "</su>" + "<mp ct='text/plain'>" + "<content>content" + ZimbraSeleniumProperties.getUniqueString() + "</content>" + "</mp>" + "</m>" + "</CreateTaskRequest>"); GeneralUtility.syncDesktopToZcsWithSoap(app.zGetActiveAccount()); TaskItem task = TaskItem.importFromSOAP(app.zGetActiveAccount(), subject); ZAssert.assertNotNull(task, "Verify the task is created"); // Refresh the tasks view app.zPageTasks.zToolbarPressButton(Button.B_REFRESH); app.zTreeTasks.zTreeItem(Action.A_LEFTCLICK, taskFolder); // Select the item app.zPageTasks.zListItem(Action.A_MAIL_CHECKBOX, subject); // Click delete keyboard logger.info("Typing shortcut key " + name + " KeyEvent: " + keyEvent); app.zPageMail.zKeyboardKeyEvent(keyEvent); // Verifying the toaster message Toaster toast = app.zPageMain.zGetToaster(); String toastMsg = toast.zGetToastMessage(); ZAssert.assertStringContains( toastMsg, "1 task moved to Trash", "Verify toast message: Task Moved To trash"); }
@Test( description = "Create task through SOAP - delete using Backspace Key & verify Toast message through GUI", groups = {"functional"}) public void DeleteTaskToastMsg_07() throws HarnessException { FolderItem taskFolder = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Tasks); // Create a basic task to delete String subject = "task" + ZimbraSeleniumProperties.getUniqueString(); app.zGetActiveAccount() .soapSend( "<CreateTaskRequest xmlns='urn:zimbraMail'>" + "<m >" + "<inv>" + "<comp name='" + subject + "'>" + "<or a='" + app.zGetActiveAccount().EmailAddress + "'/>" + "</comp>" + "</inv>" + "<su>" + subject + "</su>" + "<mp ct='text/plain'>" + "<content>content" + ZimbraSeleniumProperties.getUniqueString() + "</content>" + "</mp>" + "</m>" + "</CreateTaskRequest>"); GeneralUtility.syncDesktopToZcsWithSoap(app.zGetActiveAccount()); TaskItem task = TaskItem.importFromSOAP(app.zGetActiveAccount(), subject); ZAssert.assertNotNull(task, "Verify the task is created"); // Refresh the tasks view app.zPageTasks.zToolbarPressButton(Button.B_REFRESH); app.zTreeTasks.zTreeItem(Action.A_LEFTCLICK, taskFolder); // Select the item app.zPageTasks.zListItem(Action.A_MAIL_CHECKBOX, subject); // Use Backspace Keyboard Shortcut app.zPageTasks.zKeyboardShortcut(Shortcut.S_BACKSPACE); // Verifying the toaster message Toaster toast = app.zPageMain.zGetToaster(); String toastMsg = toast.zGetToastMessage(); ZAssert.assertStringContains( toastMsg, "1 task moved to Trash", "Verify toast message: Task Moved to Trash"); }
@Test( description = "D1 Enhancement : Add 1 contact + 1 group to an existing group", groups = {"functional"}) public void Add1ContactAnd1GroupToExistingGroup() throws HarnessException { // -- Data // Create a contact ContactItem contact = ContactItem.createContactItem(app.zGetActiveAccount()); // Create a contact group ContactGroupItem group1 = ContactGroupItem.createContactGroupItem(app.zGetActiveAccount()); ContactGroupItem group2 = ContactGroupItem.createContactGroupItem(app.zGetActiveAccount()); // -- GUI // Refresh app.zPageAddressbook.zRefresh(); // Check 3 contact items app.zPageAddressbook.zListItem(Action.A_CHECKBOX, contact.getName()); app.zPageAddressbook.zListItem(Action.A_CHECKBOX, group1.getName()); // Right click on one contact -> Group -> Existing Group Name app.zPageAddressbook.zListItem( Action.A_RIGHTCLICK, Button.B_CONTACTGROUP, group2, contact.getName()); // -- Verification // Verify the contact group is created ContactGroupItem actual = ContactGroupItem.importFromSOAP(app.zGetActiveAccount(), group1.getName()); ZAssert.assertNotNull(actual, "Verify the contact group is created"); // Verify the contact group contains the contact ZAssert.assertContains( actual.getMemberList(), new ContactGroupItem.MemberItemContact(contact), "Verify the contact group conatins the contact"); // The group members will be added to the new group for (ContactGroupItem.MemberItem m : group1.getMemberList()) { ZAssert.assertContains( actual.getMemberList(), m, "Verify the contact group contains the group members"); } }
@Test( description = "Double tag a group ", groups = {"functional"}) public void DoubleTag() throws HarnessException { // -- Data // Create a tag TagItem tag1 = TagItem.CreateUsingSoap(app.zGetActiveAccount()); TagItem tag2 = TagItem.CreateUsingSoap(app.zGetActiveAccount()); // Create a contact group via Soap then select ContactGroupItem group = ContactGroupItem.createContactGroupItem(app.zGetActiveAccount()); // -- GUI // Refresh app.zPageAddressbook.zRefresh(); // Select the contact group app.zPageAddressbook.zListItem(Action.A_LEFTCLICK, group.getName()); // Tag -> Existing Tag app.zPageAddressbook.zToolbarPressPulldown(Button.B_TAG, tag1); app.zPageAddressbook.zToolbarPressPulldown(Button.B_TAG, tag2); // -- Verification app.zGetActiveAccount() .soapSend( "<GetContactsRequest xmlns='urn:zimbraMail' >" + "<cn id='" + group.getId() + "'/>" + "</GetContactsRequest>"); String t = app.zGetActiveAccount().soapSelectValue("//mail:cn", "t"); ZAssert.assertNotNull(t, "Verify the contact has tags"); ZAssert.assertStringContains( t, tag1.getId(), "Verify the contact is tagged with the correct tag"); ZAssert.assertStringContains( t, tag2.getId(), "Verify the contact is tagged with the correct tag"); }
@Test( description = "Tag a contact group, click pulldown menu Tag->New Tag", groups = {"smoke"}) public void ClickPulldownMenuTagNewTag() throws HarnessException { // -- Data // Create a tag String tagName = "tag" + ZimbraSeleniumProperties.getUniqueString(); // Create a contact group via Soap then select ContactGroupItem group = ContactGroupItem.createContactGroupItem(app.zGetActiveAccount()); // -- GUI // Refresh app.zPageAddressbook.zRefresh(); // Select the contact app.zPageAddressbook.zListItem(Action.A_LEFTCLICK, group.getName()); // click Tag Contact->New Tag DialogTag dialogTag = (DialogTag) app.zPageAddressbook.zListItem( Action.A_RIGHTCLICK, Button.B_TAG, Button.O_TAG_NEWTAG, group.getName()); dialogTag.zSetTagName(tagName); dialogTag.zClickButton(Button.B_OK); // -- Verification app.zGetActiveAccount() .soapSend( "<GetContactsRequest xmlns='urn:zimbraMail' >" + "<cn id='" + group.getId() + "'/>" + "</GetContactsRequest>"); String tn = app.zGetActiveAccount().soapSelectValue("//mail:cn", "tn"); ZAssert.assertNotNull(tn, "Verify the contact has tags"); ZAssert.assertStringContains(tn, tagName, "Verify the contact is tagged with the correct tag"); }
@Test( description = "Create a new contact group by right click on existing contact", groups = {"smoke"}) public void CreateContactGroupWith1Contact() throws HarnessException { // -- Data // Create a contact ContactItem contact = ContactItem.createContactItem(app.zGetActiveAccount()); // The contact group name String groupname = "group" + ZimbraSeleniumProperties.getUniqueString(); // -- GUI // Refresh app.zPageAddressbook.zRefresh(); // Right click on the contact DialogNewContactGroup dialog = (DialogNewContactGroup) app.zPageAddressbook.zListItem( Action.A_RIGHTCLICK, Button.B_CONTACTGROUP, Button.O_NEW_CONTACTGROUP, contact.firstName); dialog.zEnterGroupName(groupname); dialog.zClickButton(Button.B_OK); // -- Verification // Verify the contact group is created ContactGroupItem actual = ContactGroupItem.importFromSOAP(app.zGetActiveAccount(), groupname); ZAssert.assertNotNull(actual, "Verify the contact group is created"); // Verify the contact group contains the contact ZAssert.assertContains( actual.getMemberList(), new ContactGroupItem.MemberItemContact(contact), "Verify the contact group conatins the contact"); }
@Test( description = "Tag a contact group by dnd on an existing tag", groups = {"functional"}) public void DnDOnExistingTag() throws HarnessException { // -- Data // Create a tag TagItem tagItem = TagItem.CreateUsingSoap(app.zGetActiveAccount()); // Create a contact group via Soap then select ContactGroupItem group = ContactGroupItem.createContactGroupItem(app.zGetActiveAccount()); // -- GUI // Refresh app.zPageAddressbook.zRefresh(); // Dnd on the new tag app.zPageAddressbook.zDragAndDrop( "css=[id=zlif__CNS-main__" + group.getId() + "__fileas]:contains(" + group.getName() + ")", "css=div[id=main_Contacts-parent-TAG] div[id=ztih__main_Contacts__TAG] td[id^=zti__main_Contacts__][id$=_textCell]:contains(" + tagItem.getName() + ")"); // -- Verification app.zGetActiveAccount() .soapSend( "<GetContactsRequest xmlns='urn:zimbraMail' >" + "<cn id='" + group.getId() + "'/>" + "</GetContactsRequest>"); String t = app.zGetActiveAccount().soapSelectValue("//mail:cn", "t"); ZAssert.assertNotNull(t, "Verify the contact has tags"); ZAssert.assertStringContains( t, tagItem.getId(), "Verify the contact is tagged with the correct tag"); }
@Test( description = "Right click then click Tag Contact Group->a tag name", groups = {"functional"}) public void ClickContextMenuTagContactExistingTag() throws HarnessException { // -- Data // Create a tag TagItem tagItem = TagItem.CreateUsingSoap(app.zGetActiveAccount()); // Create a contact group via Soap then select ContactGroupItem group = ContactGroupItem.createContactGroupItem(app.zGetActiveAccount()); // -- GUI // Refresh app.zPageAddressbook.zRefresh(); // Right Click -> Tag -> Existing Tag app.zPageAddressbook.zListItem(Action.A_RIGHTCLICK, Button.B_TAG, tagItem, group.getName()); // -- Verification app.zGetActiveAccount() .soapSend( "<GetContactsRequest xmlns='urn:zimbraMail' >" + "<cn id='" + group.getId() + "'/>" + "</GetContactsRequest>"); String t = app.zGetActiveAccount().soapSelectValue("//mail:cn", "t"); ZAssert.assertNotNull(t, "Verify the contact has tags"); ZAssert.assertStringContains( t, tagItem.getId(), "Verify the contact is tagged with the correct tag"); }
@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"); }
@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); }
@Test( description = "Sort a list of messages by subject (A->Z)", groups = {"functional"}) public void SortBySubject_01() throws HarnessException { // Create the message data FolderItem inbox = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Inbox); String subjectA = "subjectA" + ZimbraSeleniumProperties.getUniqueString(); String subjectB = "subjectB" + ZimbraSeleniumProperties.getUniqueString(); app.zGetActiveAccount() .soapSend( "<AddMsgRequest xmlns='urn:zimbraMail'>" + "<m l='" + inbox.getId() + "' f='f'>" + "<content>From: [email protected]\n" + "To: [email protected] \n" + "Subject: " + subjectA + "\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>"); app.zGetActiveAccount() .soapSend( "<AddMsgRequest xmlns='urn:zimbraMail'>" + "<m l='" + inbox.getId() + "' >" + "<content>From: [email protected]\n" + "To: [email protected] \n" + "Subject: " + subjectB + "\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>"); // Click Get Mail button app.zPageMail.zToolbarPressButton(Button.B_GETMAIL); // Click on Inbox app.zTreeMail.zTreeItem(Action.A_LEFTCLICK, inbox); // First, sort by subject to clear the order app.zPageMail.zToolbarPressButton(Button.B_MAIL_LIST_SORTBY_FLAGGED); // Now, click on "subject" app.zPageMail.zToolbarPressButton(Button.B_MAIL_LIST_SORTBY_SUBJECT); // Get all the messages in the inbox app.zGetActiveAccount() .soapSend( "<GetPrefsRequest xmlns='urn:zimbraAccount'>" + "<pref name='zimbraPrefSortOrder'/>" + "</GetPrefsRequest>"); List<MailItem> messages = app.zPageMail.zListGetMessages(); ZAssert.assertNotNull(messages, "Verify the message list exists"); MailItem itemA = null; for (MailItem m : messages) { if (subjectA.equals(m.gSubject)) { itemA = m; } if (subjectB.equals(m.gSubject)) { ZAssert.assertNotNull( itemA, "Item B is in the list. Verify Item A has already been found."); } } ZAssert.assertNotNull(itemA, "Verify Item A was found."); }
@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 = "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 = "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 = "Delete multiple tasks (3) by select and toolbar delete : Verify Toast message through GUI", groups = {"functional"}) public void DeleteTaskToastMsg_05() throws HarnessException { FolderItem taskFolder = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Tasks); // Create the message data to be sent String subject1 = "task" + ZimbraSeleniumProperties.getUniqueString(); String subject2 = "task" + ZimbraSeleniumProperties.getUniqueString(); String subject3 = "task" + ZimbraSeleniumProperties.getUniqueString(); app.zGetActiveAccount() .soapSend( "<CreateTaskRequest xmlns='urn:zimbraMail'>" + "<m >" + "<inv>" + "<comp name='" + subject1 + "'>" + "<or a='" + app.zGetActiveAccount().EmailAddress + "'/>" + "</comp>" + "</inv>" + "<su>" + subject1 + "</su>" + "<mp ct='text/plain'>" + "<content>content" + ZimbraSeleniumProperties.getUniqueString() + "</content>" + "</mp>" + "</m>" + "</CreateTaskRequest>"); app.zGetActiveAccount() .soapSend( "<CreateTaskRequest xmlns='urn:zimbraMail'>" + "<m >" + "<inv>" + "<comp name='" + subject2 + "'>" + "<or a='" + app.zGetActiveAccount().EmailAddress + "'/>" + "</comp>" + "</inv>" + "<su>" + subject2 + "</su>" + "<mp ct='text/plain'>" + "<content>content" + ZimbraSeleniumProperties.getUniqueString() + "</content>" + "</mp>" + "</m>" + "</CreateTaskRequest>"); app.zGetActiveAccount() .soapSend( "<CreateTaskRequest xmlns='urn:zimbraMail'>" + "<m >" + "<inv>" + "<comp name='" + subject3 + "'>" + "<or a='" + app.zGetActiveAccount().EmailAddress + "'/>" + "</comp>" + "</inv>" + "<su>" + subject3 + "</su>" + "<mp ct='text/plain'>" + "<content>content" + ZimbraSeleniumProperties.getUniqueString() + "</content>" + "</mp>" + "</m>" + "</CreateTaskRequest>"); GeneralUtility.syncDesktopToZcsWithSoap(app.zGetActiveAccount()); // Import each message into MailItem objects TaskItem task1 = TaskItem.importFromSOAP(app.zGetActiveAccount(), subject1); ZAssert.assertNotNull(task1, "Verify the task is created"); TaskItem task2 = TaskItem.importFromSOAP(app.zGetActiveAccount(), subject2); ZAssert.assertNotNull(task2, "Verify the task is created"); TaskItem task3 = TaskItem.importFromSOAP(app.zGetActiveAccount(), subject3); ZAssert.assertNotNull(task3, "Verify the task is created"); // Refresh the tasks view app.zPageTasks.zToolbarPressButton(Button.B_REFRESH); app.zTreeTasks.zTreeItem(Action.A_LEFTCLICK, taskFolder); // Select the items app.zPageTasks.zListItem(Action.A_MAIL_CHECKBOX, subject1); app.zPageTasks.zListItem(Action.A_MAIL_CHECKBOX, subject2); app.zPageTasks.zListItem(Action.A_MAIL_CHECKBOX, subject3); // Click toolbar delete button app.zPageTasks.zToolbarPressButton(Button.B_DELETE); // Verifying the toaster message Toaster toast = app.zPageMain.zGetToaster(); String toastMsg = toast.zGetToastMessage(); ZAssert.assertStringContains( toastMsg, "3 tasks moved to Trash", "Verify toast message: N Tasks Moved to Trash"); }
@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"); }
@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"); }
@Test( description = "Cancel Empty Trash folder option", groups = {"functional"}) public void ClickCancel() 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_CANCEL); // -- Verification // Verify items are permanently deleted // Verify Trash folder is empty ContactItem actualContact = ContactItem.importFromSOAP( app.zGetActiveAccount(), "is:anywhere #firstname:" + contact.firstName); ZAssert.assertNotNull(actualContact, "Verify the contact is not deleted"); ContactGroupItem actualGroup = ContactGroupItem.importFromSOAP(app.zGetActiveAccount(), "is:anywhere " + group.getName()); ZAssert.assertNotNull(actualGroup, "Verify the contact group is not deleted"); FolderItem actualAddressbook = FolderItem.importFromSOAP(app.zGetActiveAccount(), name); ZAssert.assertNotNull(actualAddressbook, "Verify the addressbook is not deleted"); }
@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 = "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"); }