@Test( description = "Mark a message as unread by clicking on it, then using 'mu' hotkeys", groups = {"smoke"}) public void MarkUnReadMail_01() throws HarnessException { // Create the message data to be sent String subject = "subject" + ZimbraSeleniumProperties.getUniqueString(); FolderItem inboxFolder = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Inbox); app.zGetActiveAccount() .soapSend( "<AddMsgRequest xmlns='urn:zimbraMail'>" + "<m l='" + inboxFolder.getId() + "' f=''>" + "<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>"); // Create a mail item to represent the message MailItem mail = MailItem.importFromSOAP(app.zGetActiveAccount(), "subject:(" + subject + ")"); ZAssert.assertStringDoesNotContain(mail.getFlags(), "u", "Verify message is initially unread"); // Click Get Mail button app.zPageMail.zToolbarPressButton(Button.B_GETMAIL); // Select the item app.zPageMail.zListItem(Action.A_LEFTCLICK, mail.dSubject); // TODO: need to L10N this app.zPageMail.zKeyboardShortcut(Shortcut.S_MAIL_MARKUNREAD); GeneralUtility.syncDesktopToZcsWithSoap(app.zGetActiveAccount()); // Verify the message is marked read in the server (flags attribute should not contain (u)nread) mail = MailItem.importFromSOAP(app.zGetActiveAccount(), "subject:(" + subject + ")"); ZAssert.assertStringContains( mail.getFlags(), "u", "Verify the message is marked read in the server"); // TODO: Verify the message is not marked unread in the list }
@Test( description = "Mark a message as read by clicking on it then waiting", groups = {"smoke"}) public void MarkReadMail_01() 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); // Wait to read the message SleepUtil.sleep(1000L * (delaySeconds)); // Wait the for the client to send the change to the server app.zPageMail.zWaitForBusyOverlay(); // Verify the message is marked read in the server (flags attribute should not contain (u)nread) mail = MailItem.importFromSOAP(app.zGetActiveAccount(), "subject:(" + subject + ")"); ZAssert.assertStringDoesNotContain( mail.getFlags(), "u", "Verify the message is marked read in the server"); // TODO: Verify the message is not marked unread in the list }
@Test( description = "Mark a message as read by clicking on it, then using 'mr' hotkeys", groups = {"functional"}) public void MarkReadMail_03() 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); // TODO: need to L10N this app.zPageMail.zKeyboardShortcut(Shortcut.S_MAIL_MARKREAD); // Verify the message is marked read in the server (flags attribute should not contain (u)nread) mail = MailItem.importFromSOAP(app.zGetActiveAccount(), "subject:(" + subject + ")"); ZAssert.assertStringDoesNotContain( mail.getFlags(), "u", "Verify the message is marked read in the server"); // TODO: Verify the message is not marked unread in the list }
@Test( description = "Mark a message as read by context menu -> mark read", groups = {"functional"}) public void MarkReadMail_04() 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); app.zPageMail.zListItem(Action.A_RIGHTCLICK, Button.O_MARK_AS_READ, mail.dSubject); // Verify the message is marked read in the server (flags attribute should not contain (u)nread) mail = MailItem.importFromSOAP(app.zGetActiveAccount(), "subject:(" + subject + ")"); ZAssert.assertStringDoesNotContain( mail.getFlags(), "u", "Verify the message is marked read in the server"); }
@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"); }
@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"); }
@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"); }