private void TagGroup(DialogTag dialogTag, ContactGroupItem group) throws HarnessException { String tagName = "tag" + ZimbraSeleniumProperties.getUniqueString(); dialogTag.zSetTagName(tagName); dialogTag.zClickButton(Button.B_OK); // Make sure the tag was created on the server (get the tag ID) app.zGetActiveAccount().soapSend("<GetTagRequest xmlns='urn:zimbraMail'/>"); ; String tagID = app.zGetActiveAccount() .soapSelectValue("//mail:GetTagResponse//mail:tag[@name='" + tagName + "']", "id"); // Make sure the tag was applied to the contact app.zGetActiveAccount() .soapSend( "<GetContactsRequest xmlns='urn:zimbraMail'>" + "<cn id='" + group.getId() + "'/>" + "</GetContactsRequest>"); String contactTags = app.zGetActiveAccount().soapSelectValue("//mail:GetContactsResponse//mail:cn", "t"); ZAssert.assertEquals( contactTags, tagID, "Verify the tag appears on the contact id=" + group.getId()); // verify toasted message '1 contact tagged ...' String expectedMsg = "1 contact group tagged \"" + tagName + "\""; ZAssert.assertStringContains( app.zPageMain.zGetToaster().zGetToastMessage(), expectedMsg, "Verify toast message '" + expectedMsg + "'"); }
@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 = "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"); }
@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 = "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 = "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 = "Verify bug 13911", groups = {"functional"}) public void Bug_13911() throws HarnessException { String subject = "subject13010064065623"; String bodyBeforeImage = "K\u00e6re alle"; String bodyAfterImage = "Problemet best\u00E5r"; String MimeFolder = ZimbraSeleniumProperties.getBaseDirectory() + "/data/private/mime/Bugs/Bug13911"; LmtpInject.injectFile(ZimbraAccount.AccountZWC().EmailAddress, new File(MimeFolder)); // Click Get Mail button app.zPageMail.zToolbarPressButton(Button.B_GETMAIL); // Select the message so that it shows in the reading pane DisplayMail display = (DisplayMail) app.zPageMail.zListItem(Action.A_LEFTCLICK, subject); String body = display.zGetMailProperty(Field.Body); ZAssert.assertStringContains(body, bodyBeforeImage, "Verify the text before the image"); ZAssert.assertStringContains(body, bodyAfterImage, "Verify the text after the image"); }
// verify contact tagged with tag and toasted message private void Verify(ContactItem contactItem, String tagName) throws HarnessException { // Make sure the tag was created on the server (get the tag ID) app.zGetActiveAccount().soapSend("<GetTagRequest xmlns='urn:zimbraMail'/>"); ; String tagID = app.zGetActiveAccount() .soapSelectValue("//mail:GetTagResponse//mail:tag[@name='" + tagName + "']", "id"); // Make sure the tag was applied to the contact app.zGetActiveAccount() .soapSend( "<GetContactsRequest xmlns='urn:zimbraMail'>" + "<cn id='" + contactItem.getId() + "'/>" + "</GetContactsRequest>"); String contactTags = app.zGetActiveAccount().soapSelectValue("//mail:GetContactsResponse//mail:cn", "t"); // if multi-tagged if (contactTags.contains(",")) { ZAssert.assertStringContains( contactTags, tagID, "Verify the tag appears on the contact id=" + contactItem.getId()); } else { ZAssert.assertEquals( contactTags, tagID, "Verify the tag appears on the contact id=" + contactItem.getId()); } // verify toasted message '1 contact tagged ...' Toaster toast = app.zPageMain.zGetToaster(); String toastMsg = toast.zGetToastMessage(); ZAssert.assertStringContains( toastMsg, "1 contact tagged \"" + tagName + "\"", "Verify toast message '" + "1 contact tagged \"" + tagName + "\"'"); }
@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"); }
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"); }
@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 = "69132") @Test( description = "Accept meeting using 'Accept -> Edit Reply' and verify modified content", groups = {"functional"}) public void AcceptMeeting_04() throws HarnessException { // ------------------------ Test data ------------------------------------ String apptSubject = "appointment" + ZimbraSeleniumProperties.getUniqueString(); String modifiedBody = "modified" + ZimbraSeleniumProperties.getUniqueString(); Calendar now = Calendar.getInstance(); 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); // --------------- Creating invitation (organizer) ---------------------------- ZimbraAccount.AccountA() .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(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>content</content>" + "</mp>" + "</m>" + "</CreateAppointmentRequest>"); // --------------- Login to attendee & accept invitation // ---------------------------------------------------- // Refresh the view app.zPageMail.zToolbarPressButton(Button.B_GETMAIL); // Select the invitation DisplayMail display = (DisplayMail) app.zPageMail.zListItem(Action.A_LEFTCLICK, apptSubject); // Click Accept -> Edit Reply , which will open a new reply compose FormMailNew editReply = (FormMailNew) display.zPressButtonPulldown(Button.B_ACCEPT, Button.O_ACCEPT_EDIT_REPLY); editReply.zFillField(Field.Body, modifiedBody); editReply.zSubmit(); // ---------------- Verification at organizer & invitee side both // ------------------------------------- // --- Check that the organizer shows the attendee as "ACCEPT" --- // Organizer: Search for the appointment (InvId) ZimbraAccount.AccountA() .soapSend( "<SearchRequest xmlns='urn:zimbraMail' types='appointment' calExpandInstStart='" + startUTC.addDays(-10).toMillis() + "' calExpandInstEnd='" + endUTC.addDays(10).toMillis() + "'>" + "<query>" + apptSubject + "</query>" + "</SearchRequest>"); String organizerInvId = ZimbraAccount.AccountA().soapSelectValue("//mail:appt", "invId"); // Get the appointment details ZimbraAccount.AccountA() .soapSend("<GetAppointmentRequest xmlns='urn:zimbraMail' id='" + organizerInvId + "'/>"); String attendeeStatus = ZimbraAccount.AccountA() .soapSelectValue( "//mail:at[@a='" + app.zGetActiveAccount().EmailAddress + "']", "ptst"); // Verify attendee status shows as psts=AC ZAssert.assertEquals(attendeeStatus, "AC", "Verify that the attendee shows as 'ACCEPTED'"); // --- Check that the attendee showing status as "ACCEPT" --- // Attendee: Search for the appointment (InvId) app.zGetActiveAccount() .soapSend( "<SearchRequest xmlns='urn:zimbraMail' types='appointment' calExpandInstStart='" + startUTC.addDays(-10).toMillis() + "' calExpandInstEnd='" + endUTC.addDays(10).toMillis() + "'>" + "<query>" + apptSubject + "</query>" + "</SearchRequest>"); String attendeeInvId = app.zGetActiveAccount().soapSelectValue("//mail:appt", "invId"); // Get the appointment details app.zGetActiveAccount() .soapSend("<GetAppointmentRequest xmlns='urn:zimbraMail' id='" + attendeeInvId + "'/>"); String myStatus = app.zGetActiveAccount() .soapSelectValue( "//mail:at[@a='" + app.zGetActiveAccount().EmailAddress + "']", "ptst"); // Verify attendee status shows as psts=AC ZAssert.assertEquals(myStatus, "AC", "Verify that the attendee shows as 'ACCEPTED'"); // Organizer: Search for the appointment response String inboxId = FolderItem.importFromSOAP(ZimbraAccount.AccountA(), FolderItem.SystemFolder.Inbox).getId(); ZimbraAccount.AccountA() .soapSend( "<SearchRequest xmlns='urn:zimbraMail' types='message'>" + "<query>inid:" + inboxId + " subject:(" + apptSubject + ")</query>" + "</SearchRequest>"); // Verify message body content String body = ZimbraAccount.AccountA().soapSelectValue("//mail:m/mail:fr", null); ZAssert.assertStringContains(body, modifiedBody, "Verify modified body value"); }
@Test( description = "Verify that if the message is not read for less than zimbraPrefMarkMsgRead, it is not read", groups = {"functional"}) public void MarkReadMail_02() throws HarnessException { // Create the message data to be sent String subject1 = "subject" + ZimbraSeleniumProperties.getUniqueString(); String subject2 = "subject" + ZimbraSeleniumProperties.getUniqueString(); ZimbraAccount.AccountA() .soapSend( "<SendMsgRequest xmlns='urn:zimbraMail'>" + "<m>" + "<e t='t' a='" + app.zGetActiveAccount().EmailAddress + "'/>" + "<su>" + subject1 + "</su>" + "<mp ct='text/plain'>" + "<content>content" + 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>content" + ZimbraSeleniumProperties.getUniqueString() + "</content>" + "</mp>" + "</m>" + "</SendMsgRequest>"); // Create a mail item to represent the message MailItem mail1 = MailItem.importFromSOAP(app.zGetActiveAccount(), "subject:(" + subject1 + ")"); MailItem mail2 = MailItem.importFromSOAP(app.zGetActiveAccount(), "subject:(" + subject2 + ")"); // Click Get Mail button app.zPageMail.zToolbarPressButton(Button.B_GETMAIL); // Select the item app.zPageMail.zListItem(Action.A_LEFTCLICK, mail1.dSubject); // Select the next item immediately app.zPageMail.zListItem(Action.A_LEFTCLICK, mail2.dSubject); // Verify the message is marked read in the server (flags attribute should not contain (u)nread) mail1 = MailItem.importFromSOAP(app.zGetActiveAccount(), "subject:(" + subject1 + ")"); ZAssert.assertStringContains( mail1.getFlags(), "u", "Verify the message is marked read in the server"); // TODO: Verify the message is not marked unread in the list }
@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(); } }
@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"); }
@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"); }
@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"); }