@BeforeMethod( description = "Make sure the Owner account exists", groups = {"always"}) public void CreateOwner() throws HarnessException { Owner = new ZimbraAccount(); Owner.provision(); Owner.authenticate(); }
/** * 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); }
@Test( description = "Delete a a top level briefcase folder - Right click, Delete", groups = {"smoke"}) public void DeleteFolder_02() throws HarnessException { ZimbraAccount account = app.zGetActiveAccount(); FolderItem briefcaseRootFolder = FolderItem.importFromSOAP(account, SystemFolder.Briefcase); FolderItem userRootFolder = FolderItem.importFromSOAP(account, SystemFolder.UserRoot); ZAssert.assertNotNull(userRootFolder, "Verify the user root folder is available"); FolderItem trash = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Trash); ZAssert.assertNotNull(trash, "Verify the trash is available"); // Create a top level briefcase folder String briefcaseTopLevelFolderName = "folder" + ZimbraSeleniumProperties.getUniqueString(); account.soapSend( "<CreateFolderRequest xmlns='urn:zimbraMail'>" + "<folder name='" + briefcaseTopLevelFolderName + "' l='" + userRootFolder.getId() + "' view='document'/>" + "</CreateFolderRequest>"); FolderItem briefcaseTopLevelFolder = FolderItem.importFromSOAP(account, briefcaseTopLevelFolderName); ZAssert.assertNotNull( briefcaseTopLevelFolder, "Verify the briefcase top level folder is available"); // refresh the Briefcase tree folder list app.zTreeBriefcase.zTreeItem(Action.A_LEFTCLICK, briefcaseRootFolder, false); // Delete the folder using context menu app.zTreeBriefcase.zTreeItem( Action.A_RIGHTCLICK, Button.B_TREE_DELETE, briefcaseTopLevelFolder); // Verify the folder is now in the trash briefcaseTopLevelFolder = FolderItem.importFromSOAP(app.zGetActiveAccount(), briefcaseTopLevelFolderName); ZAssert.assertNotNull( briefcaseTopLevelFolder, "Verify the briefcase top level folder is again available"); ZAssert.assertEquals( trash.getId(), briefcaseTopLevelFolder.getParentId(), "Verify the deleted briefcase top level folder's parent is now the trash folder ID"); }
/** * Added @beforeClass because after logged in ,when we try to create signature through soap, it * doesn't shows in (GUI)'Pref/signatures' unless and until we refresh browser. * * @throws HarnessException */ @BeforeClass(groups = {"always"}) public void CreateSignature() throws HarnessException { ZimbraAccount.AccountZWC().authenticate(); ZimbraAccount.AccountZWC() .soapSend( "<CreateSignatureRequest xmlns='urn:zimbraAccount'>" + "<signature name='" + this.sigName + "' >" + "<content type='text/plain'>" + this.sigBody + "</content>" + "</signature>" + "</CreateSignatureRequest>"); }
/** * Set up basic quick commands for all combinations * * @throws HarnessException */ @Bugs(ids = "71389") // Hold off on GUI implementation of Quick Commands in 8.X // @BeforeClass( groups = { "always" } ) public void addQuickCommands() throws HarnessException { logger.info("addQuickCommands: start"); // Create a quick command in the user preferences ZimbraAccount.AccountZWC() .soapSend( "<ModifyPrefsRequest xmlns='urn:zimbraAccount'>" + "<pref name='zimbraPrefQuickCommand'>" + this.getQuickCommand01().toString() + "</pref>" + "<pref name='zimbraPrefQuickCommand'>" + this.getQuickCommand02().toString() + "</pref>" + "<pref name='zimbraPrefQuickCommand'>" + this.getQuickCommand03().toString() + "</pref>" + "</ModifyPrefsRequest>"); // Re-login to pick up the new preferences super.startingPage.zRefresh(); // The AjaxCommonTest.commonTestBeforeMethod() method will log into the client logger.info("addQuickCommands: finish"); }
/** * Create an all-day appointment on the server * * @param account The appointment organizer * @param date The appointment start date * @param duration The appointment duration (in days) * @param subject The appointment subject * @param content The appointment text content * @param location The appointment location (null if none) * @param attendees A list of attendees (null for none) * @return * @throws HarnessException */ public static AppointmentItem createAppointmentAllDay( ZimbraAccount account, Calendar date, int duration, String subject, String content, String location, List<ZimbraAccount> attendees) throws HarnessException { // If location is null, don't specify the loc attribute String loc = (location == null ? "" : "loc='" + location + "'"); // Convert the calendar to a ZDate ZDate start = new ZDate( date.get(Calendar.YEAR), date.get(Calendar.MONTH) + 1, date.get(Calendar.DAY_OF_MONTH), 12, 0, 0); account.soapSend( "<CreateAppointmentRequest xmlns='urn:zimbraMail'>" + "<m l='10'>" + "<inv>" + "<comp allDay='1' name='" + subject + "' " + loc + " draft='0' status='CONF' class='PUB' transp='O' fb='F'>" + "<s d='" + start.toYYYYMMDD() + "'/>" + "<e d='" + start.addDays(duration > 0 ? duration - 1 : 0).toYYYYMMDD() + "'/>" + "<or a='" + account.EmailAddress + "'/>" + "</comp>" + "</inv>" + "<su>" + subject + "</su>" + "<mp ct='text/plain'>" + "<content>" + content + "</content>" + "</mp>" + "</m>" + "</CreateAppointmentRequest>"); AppointmentItem result = AppointmentItem.importFromSOAP( account, "subject:(" + subject + ")", start.addDays(-7), start.addDays(7)); return (result); }
@Bugs(ids = "69132") @Test( description = "View a basic all-day appointment in the work week view", groups = { "smoke" }) public void GetAllDayAppointment_01() throws HarnessException { // Create the appointment on the server String apptSubject = "appointment" + ZimbraSeleniumProperties.getUniqueString(); String apptLocation = "location" + ZimbraSeleniumProperties.getUniqueString(); String apptBody = "content" + ZimbraSeleniumProperties.getUniqueString(); // Absolute dates in UTC zone Calendar now = this.calendarWeekDayUTC; ZDate startUTC = new ZDate(now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, now.get(Calendar.DAY_OF_MONTH), 12, 0, 0); ZDate endUTC = new ZDate(now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, now.get(Calendar.DAY_OF_MONTH), 14, 0, 0); // EST timezone string String tz = ZTimeZone.TimeZoneEST.getID(); // Create a meeting request from AccountA to the test account ZimbraAccount.AccountA().soapSend( "<CreateAppointmentRequest xmlns='urn:zimbraMail'>" + "<m>" + "<inv>" + "<comp status='CONF' fb='B' class='PUB' transp='O' allDay='1' name='"+ apptSubject +"' loc='"+ apptLocation +"'>" + "<s d='"+ startUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS() +"' tz='"+ tz +"'/>" + "<e d='"+ endUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS() +"' tz='"+ tz +"'/>" + "<at role='REQ' ptst='NE' rsvp='1' a='"+ app.zGetActiveAccount().EmailAddress +"'/>" + "<or a='"+ ZimbraAccount.AccountA().EmailAddress + "'/>" + "</comp>" + "</inv>" + "<e a='"+ app.zGetActiveAccount().EmailAddress +"' t='t'/>" + "<su>"+ apptSubject + "</su>" + "<mp ct='text/plain'>" + "<content>"+ apptBody +"</content>" + "</mp>" + "</m>" + "</CreateAppointmentRequest>"); AppointmentItem appt = AppointmentItem.importFromSOAP(app.zGetActiveAccount(), "subject:("+ apptSubject +")", startUTC.addDays(-7), endUTC.addDays(7)); ZAssert.assertNotNull(appt, "Verify the new appointment is created"); app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH); //wait for the appointment displayed in the view ZAssert.assertEquals(app.zPageCalendar.sIsElementPresent(app.zPageCalendar.zGetReadOnlyAllDayApptLocator(apptSubject)), true, "Verify all-day appointment is deleted"); }
/** * Get an AppointmentItem using soap * * @param account * @param query * @param start * @param end * @return * @throws HarnessException */ public static AppointmentItem importFromSOAP( ZimbraAccount account, String query, ZDate start, ZDate end) throws HarnessException { try { account.soapSend( "<SearchRequest xmlns='urn:zimbraMail' types='appointment' calExpandInstStart='" + start.toMillis() + "' calExpandInstEnd='" + end.toMillis() + "'>" + "<query>" + query + "</query>" + "</SearchRequest>"); Element[] results = account.soapSelectNodes("//mail:SearchResponse/mail:appt"); if (results.length != 1) // throw new HarnessException("Query should return 1 result, not "+ results.length); return null; String id = account.soapSelectValue("//mail:appt", "id"); account.soapSend( "<GetAppointmentRequest xmlns='urn:zimbraMail' id='" + id + "' includeContent='1'>" + "</GetAppointmentRequest>"); Element getAppointmentResponse = account.soapSelectNode("//mail:GetAppointmentResponse", 1); // Using the response, create this item return (importFromSOAP(getAppointmentResponse)); } catch (Exception e) { throw new HarnessException( "Unable to import using SOAP query(" + query + ") and account(" + account.EmailAddress + ")", e); } }
@Test( description = "Login to the Ajax Client", groups = {"sanity"}) public void BasicLogin01() throws HarnessException { // Login app.zPageLogin.zLogin(ZimbraAccount.AccountHTML()); // Verify main page becomes active ZAssert.assertTrue(app.zPageMain.zIsActive(), "Verify that the account is logged in"); }
public static TaskItem importFromSOAP(ZimbraAccount account, String query) throws HarnessException { try { account.soapSend( "<SearchRequest xmlns='urn:zimbraMail' types='task' >" + "<query>" + query + "</query>" + "</SearchRequest>"); Element[] results = account.soapSelectNodes("//mail:SearchResponse/mail:task"); if (results.length != 1) throw new HarnessException("Query should return 1 result, not " + results.length); String invId = account.soapSelectValue("//mail:SearchResponse/mail:task", "invId"); account.soapSend( "<GetMsgRequest xmlns='urn:zimbraMail'>" + "<m id='" + invId + "' />" + "</GetMsgRequest>"); Element getMsgResponse = account.soapSelectNode("//mail:GetMsgResponse", 1); // Using the response, create this item return (importFromSOAP(getMsgResponse)); } catch (Exception e) { throw new HarnessException( "Unable to import using SOAP query(" + query + ") and account(" + account.EmailAddress + ")", e); } }
/** * ZimbraAccount.AccountA() sends a two-hour appointment to app.zGetActiveAccount() with subject * and start time * * @param subject * @param start * @throws HarnessException */ private void SendCreateAppointmentRequest(String subject, ZDate start) throws HarnessException { 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='" + subject + "'>" + "<s d='" + start.toTimeZone(ZTimeZone.TimeZoneEST.getID()).toYYYYMMDDTHHMMSS() + "' tz='" + ZTimeZone.TimeZoneEST.getID() + "'/>" + "<e d='" + start.addHours(2).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>" + subject + "</su>" + "<mp content-type='text/plain'>" + "<content>content</content>" + "</mp>" + "</m>" + "</CreateAppointmentRequest>"); }
public static SignatureItem importFromSOAP(ZimbraAccount account, String name) throws HarnessException { if (account == null) throw new HarnessException("account cannot be null"); if (name == null) throw new HarnessException("name cannot be null"); if (name.trim().length() == 0) throw new HarnessException("name cannot be empty: (" + name + ")"); try { account.soapSend("<GetSignaturesRequest xmlns='urn:zimbraAccount'/>"); Element[] results = account.soapSelectNodes("//acct:signature[@name='" + name + "']"); return (importFromSOAP(results[0])); } catch (Exception e) { throw new HarnessException( "Unable to import using SOAP name(" + name + ") and account(" + account.EmailAddress + ")", e); } }
@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 }
@AfterMethod(alwaysRun = true) public void afterMethod() throws HarnessException { logger.info("Checking for the Move Dialog ..."); // Check if the "Move Dialog is still open DialogMove dialog = new DialogMove(app, ((AppAjaxClient) app).zPageBriefcase); if (dialog.zIsActive()) { logger.warn(dialog.myPageName() + " was still active. Cancelling ..."); dialog.zClickButton(Button.B_CANCEL); } // This step is necessary because next test may be uploading the same // file // if account is not reset, ZCS will be confused, and the next // uploaded file // will be deleted per previous command. ZimbraAccount.ResetAccountZWC(); }
@Bugs(ids = "69132") @Test( description = "Create simple all day appointment in week view", groups = {"smoke"}) public void CreateAllDayAppointment_01() throws HarnessException { // Create appointment String apptSubject; apptSubject = "appointment" + ZimbraSeleniumProperties.getUniqueString(); AppointmentItem appt = new AppointmentItem(); appt.setSubject(apptSubject); appt.setContent("content" + ZimbraSeleniumProperties.getUniqueString()); appt.setAttendees(ZimbraAccount.AccountA().EmailAddress); appt.setIsAllDay(true); // Open the new mail form FormApptNew apptForm = (FormApptNew) app.zPageCalendar.zToolbarPressButton(Button.B_NEW); apptForm.zFill(appt); apptForm.zSubmit(); // Verify the new appointment exists on the server AppointmentItem actual = AppointmentItem.importFromSOAP( app.zGetActiveAccount(), "subject:(" + appt.getSubject() + ")"); ZAssert.assertNotNull(actual, "Verify the new appointment is created"); ZAssert.assertEquals( actual.getSubject(), appt.getSubject(), "Subject: Verify the appointment data"); ZAssert.assertEquals( app.zGetActiveAccount() .soapMatch("//mail:GetAppointmentResponse//mail:comp", "allDay", "1"), true, ""); // Verify in UI app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH); ZAssert.assertEquals( app.zPageCalendar.sIsElementPresent(app.zPageCalendar.zGetAllDayApptLocator(apptSubject)), true, "Verify all-day appointment present in UI"); }
/** * TestCase : Trusted Domain with message view 1.Set domain in Preference/Mail/Trusted Addresses * Verify it through soap(GetPrefsRequest) 2.In message View Inject mail with external image * 3.Verify To,From,Subject through soap 4.Click on same mail 5.Yellow color Warning Msg Info bar * should not present for trusted domain * * @throws HarnessException */ @Test( description = "Verify Display Image link in Trusted doamin for message view", groups = {"smoke"}) public void TrustedDomainMsgView_01() throws HarnessException { final String subject = "TestTrustedAddress"; final String from = "*****@*****.**"; final String to = "*****@*****.**"; final String mimeFolder = ZimbraSeleniumProperties.getBaseDirectory() + "/data/public/mime/ExternalImg.txt"; // Verify domain through soap- GetPrefsRequest String PrefMailTrustedAddr = ZimbraAccount.AccountZWC().getPreference("zimbraPrefMailTrustedSenderList"); ZAssert.assertTrue( PrefMailTrustedAddr.equals("testdoamin.com"), "Verify doamin is present /Pref/TrustedAddr"); // Inject the external image message(s) LmtpInject.injectFile(app.zGetActiveAccount().EmailAddress, new File(mimeFolder)); MailItem mail = MailItem.importFromSOAP(app.zGetActiveAccount(), subject); ZAssert.assertNotNull(mail, "Verify message is received"); ZAssert.assertEquals(from, mail.dFromRecipient.dEmailAddress, "Verify the from matches"); ZAssert.assertEquals(to, mail.dToRecipients.get(0).dEmailAddress, "Verify the to address"); // Click Get Mail button app.zPageMail.zToolbarPressButton(Button.B_GETMAIL); // Select the message so that it shows in the reading pane app.zPageMail.zListItem(Action.A_LEFTCLICK, subject); // DisplayTrustedAddress actual = new DisplayTrustedAddress(app); // Verify Warning info bar with other links ZAssert.assertFalse( app.zPageMail.zHasWDDLinks(), "Verify Warning icon ,Display Image and Domain link does not present"); }
@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"); }
@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"); }
@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 = "Delete a conversation - 1 message in inbox, 1 message in sent, 1 message in subfolder", groups = {"functional"}) public void DeleteConversation_10() throws HarnessException { // -- DATA // Create a conversation (3 messages) ConversationItem c = ConversationItem.createConversationItem(app.zGetActiveAccount()); // Put one message in inbox, one in trash, one in subfolder // Get the system folders FolderItem inbox = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Inbox); FolderItem trash = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Trash); FolderItem sent = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Sent); // Move the conversation to the trash app.zGetActiveAccount() .soapSend( "<ItemActionRequest xmlns='urn:zimbraMail'>" + "<action op='move' l='" + trash.getId() + "' id='" + c.getMessageList().get(0).getId() + "'/>" + "</ItemActionRequest>"); // Create a message in a subfolder String foldername = "folder" + ZimbraSeleniumProperties.getUniqueString(); app.zGetActiveAccount() .soapSend( "<CreateFolderRequest xmlns='urn:zimbraMail'>" + "<folder name='" + foldername + "' l='" + inbox.getId() + "'/>" + "</CreateFolderRequest>"); FolderItem subfolder = FolderItem.importFromSOAP(app.zGetActiveAccount(), foldername); // Move the conversation to the subfolder app.zGetActiveAccount() .soapSend( "<ItemActionRequest xmlns='urn:zimbraMail'>" + "<action op='move' l='" + subfolder.getId() + "' id='" + c.getMessageList().get(1).getId() + "'/>" + "</ItemActionRequest>"); // Reply to one message (putting a message in sent) app.zGetActiveAccount() .soapSend( "<SendMsgRequest xmlns='urn:zimbraMail'>" + "<m origid='" + c.getMessageList().get(2).getId() + "' rt='r'>" + "<e t='t' a='" + ZimbraAccount.AccountA().EmailAddress + "'/>" + "<su>RE: " + c.getSubject() + "</su>" + "<mp ct='text/plain'>" + "<content>" + "body" + ZimbraSeleniumProperties.getUniqueString() + "</content>" + "</mp>" + "</m>" + "</SendMsgRequest>"); String idSent = app.zGetActiveAccount().soapSelectValue("//mail:m", "id"); // -- GUI // Click Get Mail button app.zPageMail.zToolbarPressButton(Button.B_GETMAIL); // Right click the item, select delete app.zPageMail.zListItem(Action.A_RIGHTCLICK, Button.B_DELETE, c.getSubject()); // -- Verification // Expected: all messages should be in trash, except for the sent message // Check each message to verify they exist in the trash ConversationItem actual = ConversationItem.importFromSOAP( app.zGetActiveAccount(), "is:anywhere subject:" + c.getSubject()); for (MailItem m : actual.getMessageList()) { if (idSent.equals(m.getId())) { // Sent message should remain in sent ZAssert.assertEquals( m.dFolderId, sent.getId(), "Verify the conversation message is in the sent folder"); } else { // All other messages should be moved to trash ZAssert.assertEquals( m.dFolderId, trash.getId(), "Verify the conversation message is in the trash"); } } }
@Bugs(ids = "62137") @Test( description = "Bug 62137 - 'http://<server>?app=calendar' broken with/without login to zcs", groups = {"functional"}) public void Bug62137_01() throws HarnessException { // Creating object for appointment data String tz, apptSubject, apptBody, apptAttendee; tz = ZTimeZone.TimeZoneEST.getID(); apptSubject = ZimbraSeleniumProperties.getUniqueString(); apptBody = ZimbraSeleniumProperties.getUniqueString(); apptAttendee = ZimbraAccount.AccountA().EmailAddress; // Absolute dates in UTC zone Calendar now = this.calendarWeekDayUTC; ZDate startUTC = new ZDate( now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, now.get(Calendar.DAY_OF_MONTH), 12, 0, 0); ZDate endUTC = new ZDate( now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, now.get(Calendar.DAY_OF_MONTH), 14, 0, 0); app.zGetActiveAccount() .soapSend( "<CreateAppointmentRequest xmlns='urn:zimbraMail'>" + "<m>" + "<inv method='REQUEST' type='event' fb='B' transp='O' allDay='0' name='" + apptSubject + "'>" + "<s d='" + startUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS() + "' tz='" + tz + "'/>" + "<e d='" + endUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS() + "' tz='" + tz + "'/>" + "<or a='" + app.zGetActiveAccount().EmailAddress + "'/>" + "<at role='REQ' ptst='NE' rsvp='1' a='" + apptAttendee + "' d='2'/>" + "</inv>" + "<mp content-type='text/plain'>" + "<content>" + apptBody + "</content>" + "</mp>" + "<su>" + apptSubject + "</su>" + "</m>" + "</CreateAppointmentRequest>"); // Reload the application, with app=calendar query parameter ZimbraURI uri = new ZimbraURI(ZimbraURI.getBaseURI()); uri.addQuery("app", "calendar"); app.zPageCalendar.sOpen(uri.toString()); // Verify the page becomes active app.zPageMain.zWaitForActive(); app.zPageCalendar.zWaitForActive(); ZAssert.assertTrue(app.zPageCalendar.zIsActive(), "Verify the page becomes active"); // Verify the appointment appears in the view boolean found = false; List<AppointmentItem> items = app.zPageCalendar.zListGetAppointments(); for (AppointmentItem item : items) { if (apptSubject.equals(item.getSubject())) { found = true; break; } } ZAssert.assertTrue(found, "Verify appt gets displayed in work week view"); }
@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 }
@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"); }
@Test( description = "Create weekly recurring invite with attendee and location with every Monday, end after 2 occurrences", groups = {"smoke"}) public void WeeklyEveryXdayEndAfterYoccurrences_01() throws HarnessException { // Create appointment data AppointmentItem appt = new AppointmentItem(); String apptSubject, apptAttendee, apptContent, apptLocation; ZimbraResource location = new ZimbraResource(ZimbraResource.Type.LOCATION); apptSubject = ZimbraSeleniumProperties.getUniqueString(); apptAttendee = ZimbraAccount.AccountA().EmailAddress; apptContent = ZimbraSeleniumProperties.getUniqueString(); apptLocation = location.EmailAddress; // Absolute dates in UTC zone Calendar now = this.calendarWeekDayUTC; ZDate startUTC = new ZDate( now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, now.get(Calendar.DAY_OF_MONTH), 20, 0, 0); ZDate endUTC = new ZDate( now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, now.get(Calendar.DAY_OF_MONTH), 22, 0, 0); appt.setSubject(apptSubject); appt.setAttendees(apptAttendee); appt.setStartTime(startUTC); appt.setEndTime(endUTC); appt.setLocation(apptLocation); appt.setContent(apptContent); // Compose appointment and send it to invitee FormApptNew apptForm = (FormApptNew) app.zPageCalendar.zToolbarPressButton(Button.B_NEW); apptForm.zFill(appt); apptForm.zRepeat( Button.O_EVERY_WEEK_MENU, Button.B_EVERY_X_RADIO_BUTTON, "Monday", Button.B_END_AFTER_X_OCCURRENCES_RADIO_BUTTON, "2"); ZAssert.assertStringContains( app.zPageCalendar.zGetRecurringLink(), "Every Monday End after 2 occurrence(s) Effective ", "Recurring link: Verify the appointment data"); apptForm.zSubmit(); SleepUtil.sleepLong(); // SOAP gives wrong response 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"); app.zGetActiveAccount() .soapSend("<GetAppointmentRequest xmlns='urn:zimbraMail' id='" + attendeeInvId + "'/>"); String ruleFrequency = app.zGetActiveAccount().soapSelectValue("//mail:appt//mail:rule", "freq"); String count = app.zGetActiveAccount().soapSelectValue("//mail:appt//mail:count", "num"); String interval = app.zGetActiveAccount().soapSelectValue("//mail:appt//mail:interval", "ival"); String weekday = app.zGetActiveAccount().soapSelectValue("//mail:appt//mail:wkday", "day"); // Verify appointment exists on server meeting with correct recurring details AppointmentItem actual = AppointmentItem.importFromSOAP( app.zGetActiveAccount(), "subject:(" + appt.getSubject() + ")", appt.getStartTime().addDays(-7), appt.getEndTime().addDays(7)); ZAssert.assertNotNull(actual, "Verify the new appointment is created"); ZAssert.assertEquals( actual.getSubject(), appt.getSubject(), "Subject: Verify the appointment data"); ZAssert.assertEquals( actual.getAttendees(), apptAttendee, "Attendees: Verify the appointment data"); ZAssert.assertEquals( actual.getLocation(), apptLocation, "Location: Verify the appointment data"); ZAssert.assertEquals(ruleFrequency, "WEE", "Repeat frequency: Verify the appointment data"); ZAssert.assertEquals(count, "2", "No. of occurrences: Verify the appointment data"); ZAssert.assertEquals(interval, "1", "Repeat interval: Verify the appointment data"); ZAssert.assertEquals(weekday, "MO", "Weekday: Verify the appointment data"); ZAssert.assertEquals( actual.getContent(), appt.getContent(), "Content: Verify the appointment data"); // Verify location free/busy status shows as psts=AC String locationStatus = app.zGetActiveAccount().soapSelectValue("//mail:at[@a='" + apptLocation + "']", "ptst"); ZAssert.assertEquals( locationStatus, "AC", "Verify that the location status shows as 'ACCEPTED'"); ZimbraAccount.AccountA() .soapSend( "<SearchRequest xmlns='urn:zimbraMail' types='appointment' calExpandInstStart='" + startUTC.addDays(-10).toMillis() + "' calExpandInstEnd='" + endUTC.addDays(10).toMillis() + "'>" + "<query>" + apptSubject + "</query>" + "</SearchRequest>"); attendeeInvId = ZimbraAccount.AccountA().soapSelectValue("//mail:appt", "invId"); ZimbraAccount.AccountA() .soapSend("<GetAppointmentRequest xmlns='urn:zimbraMail' id='" + attendeeInvId + "'/>"); ruleFrequency = app.zGetActiveAccount().soapSelectValue("//mail:appt//mail:rule", "freq"); count = app.zGetActiveAccount().soapSelectValue("//mail:appt//mail:count", "num"); interval = app.zGetActiveAccount().soapSelectValue("//mail:appt//mail:interval", "ival"); weekday = app.zGetActiveAccount().soapSelectValue("//mail:appt//mail:wkday", "day"); // Verify the attendee receives the meeting with correct recurring details AppointmentItem received = AppointmentItem.importFromSOAP( ZimbraAccount.AccountA(), "subject:(" + appt.getSubject() + ")", appt.getStartTime().addDays(-7), appt.getEndTime().addDays(7)); ZAssert.assertNotNull(received, "Verify the new appointment is created"); ZAssert.assertEquals( received.getSubject(), appt.getSubject(), "Subject: Verify the appointment data"); ZAssert.assertEquals( received.getAttendees(), apptAttendee, "Attendees: Verify the appointment data"); ZAssert.assertEquals( received.getLocation(), apptLocation, "Location: Verify the appointment data"); ZAssert.assertEquals(ruleFrequency, "WEE", "Repeat frequency: Verify the appointment data"); ZAssert.assertEquals(count, "2", "No. of occurrences: Verify the appointment data"); ZAssert.assertEquals(interval, "1", "Repeat interval: Verify the appointment data"); ZAssert.assertEquals(weekday, "MO", "Weekday: Verify the appointment data"); ZAssert.assertEquals( received.getContent(), appt.getContent(), "Content: Verify the appointment data"); // Verify the attendee receives the invitation MailItem invite = MailItem.importFromSOAP(ZimbraAccount.AccountA(), "subject:(" + appt.getSubject() + ")"); ZAssert.assertNotNull(invite, "Verify the invite is received"); ZAssert.assertEquals( invite.dSubject, appt.getSubject(), "Subject: Verify the appointment data"); // Go to next/previous week and verify correct number of recurring instances app.zPageCalendar.zToolbarPressButton(Button.B_NEXT_PAGE); SleepUtil.sleepMedium(); // Let UI draw first and important for calendar testcases reliability ZAssert.assertEquals( app.zPageCalendar.zGetApptCountWorkWeekView(), 2, "Verify correct no. of recurring instances are present in calendar view"); app.zPageCalendar.zToolbarPressButton(Button.B_NEXT_PAGE); app.zPageCalendar.zToolbarPressButton(Button.B_NEXT_PAGE); SleepUtil.sleepMedium(); // Let UI draw first and important for calendar testcases reliability ZAssert.assertEquals( app.zPageCalendar.zGetApptCountWorkWeekView(), 0, "Verify correct no. of recurring instances are present in calendar view"); }
@Test( description = "Close modifying appt and take action from warning dialog : Save Changes and send updates", groups = {"functional"}) public void ModifyAppointment_01() throws HarnessException { // Create appointment data String tz, apptSubject, apptAttendee1, apptAttendee2; apptSubject = ZimbraSeleniumProperties.getUniqueString(); apptAttendee1 = ZimbraAccount.AccountA().EmailAddress; apptAttendee2 = ZimbraAccount.AccountB().EmailAddress; // Absolute dates in UTC zone tz = ZTimeZone.TimeZoneEST.getID(); 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); // Create appointment app.zGetActiveAccount() .soapSend( "<CreateAppointmentRequest xmlns='urn:zimbraMail'>" + "<m>" + "<inv method='REQUEST' type='event' status='CONF' draft='0' class='PUB' fb='B' transp='O' allDay='0' name='" + apptSubject + "'>" + "<s d='" + startUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS() + "' tz='" + tz + "'/>" + "<e d='" + endUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS() + "' tz='" + tz + "'/>" + "<or a='" + app.zGetActiveAccount().EmailAddress + "'/>" + "<at role='REQ' ptst='NE' rsvp='1' a='" + apptAttendee1 + "' d='2'/>" + "<at role='REQ' ptst='NE' rsvp='1' a='" + apptAttendee2 + "' d='2'/>" + "</inv>" + "<e a='" + ZimbraAccount.AccountA().EmailAddress + "' t='t'/>" + "<mp content-type='text/plain'>" + "<content>" + ZimbraSeleniumProperties.getUniqueString() + "</content>" + "</mp>" + "<su>" + apptSubject + "</su>" + "</m>" + "</CreateAppointmentRequest>"); app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH); // Remove attendee and close the appt app.zPageCalendar.zListItem(Action.A_DOUBLECLICK, apptSubject); FormApptNew apptForm = new FormApptNew(app); apptForm.zRemoveAttendee(apptAttendee2); apptForm.zToolbarPressButton(Button.B_CLOSE); DialogConfirmModification confirmClose = (DialogConfirmModification) new DialogConfirmModification(app, app.zPageCalendar); confirmClose.zClickButton(Button.B_SAVE_MODIFICATION); DialogSendUpdatetoAttendees sendUpdateDialog = (DialogSendUpdatetoAttendees) new DialogSendUpdatetoAttendees(app, app.zPageCalendar); sendUpdateDialog.zClickButton(Button.B_OK); // Verify if an attendee is removed from appt and attendee gets update AppointmentItem actual = AppointmentItem.importFromSOAP(app.zGetActiveAccount(), "subject:(" + apptSubject + ")"); ZAssert.assertEquals(actual.getSubject(), apptSubject, "Subject: Verify the appointment data"); ZAssert.assertStringDoesNotContain( actual.getAttendees(), apptAttendee2, "Attendees: Verify the attendee data"); // Verify attendee2 receives cancellation message ZimbraAccount.AccountB() .soapSend( "<SearchRequest xmlns='urn:zimbraMail' types='message'>" + "<query>subject:" + (char) 34 + "Cancelled: " + apptSubject + (char) 34 + "</query>" + "</SearchRequest>"); String id = ZimbraAccount.AccountB().soapSelectValue("//mail:m", "id"); ZAssert.assertNotNull(id, "Verify attendee2 receives cancelled meeting message"); // Verify appointment is deleted from attendee2's calendar AppointmentItem removedAttendee = AppointmentItem.importFromSOAP(ZimbraAccount.AccountB(), "subject:(" + apptSubject + ")"); ZAssert.assertNull(removedAttendee, "Verify meeting is deleted from attendee2's calendar"); }
@Test( description = "Create document using keyboard shortcut - verify through SOAP & RestUtil", groups = {"functional"}) public void CreateDocument_03() throws HarnessException { ZimbraAccount account = app.zGetActiveAccount(); FolderItem briefcaseFolder = FolderItem.importFromSOAP(account, SystemFolder.Briefcase); // Create document item DocumentItem document = new DocumentItem(); String docName = document.getName(); String docText = document.getDocText(); Shortcut shortcut = Shortcut.S_NEWDOCUMENT; // Open new document page using keyboard shortcut app.zPageBriefcase.zSelectWindow(PageBriefcase.pageTitle); DocumentBriefcaseNew documentBriefcaseNew = (DocumentBriefcaseNew) app.zPageBriefcase.zKeyboardShortcut(shortcut); try { app.zPageBriefcase.zSelectWindow(DocumentBriefcaseNew.pageTitle); // Fill out the document with the data documentBriefcaseNew.zFillField(DocumentBriefcaseNew.Field.Name, docName); documentBriefcaseNew.zFillField(DocumentBriefcaseNew.Field.Body, docText); // Save and close app.zPageBriefcase.zSelectWindow(DocumentBriefcaseNew.pageTitle); documentBriefcaseNew.zSubmit(); } finally { app.zPageBriefcase.zSelectWindow(PageBriefcase.pageTitle); } app.zPageBriefcase.zWaitForWindowClosed(DocumentBriefcaseNew.pageTitle); // refresh briefcase page app.zTreeBriefcase.zTreeItem(Action.A_LEFTCLICK, briefcaseFolder, true); // Display file through RestUtil EnumMap<PageBriefcase.Response.ResponsePart, String> response = app.zPageBriefcase.displayFile( docName, new HashMap<String, String>() { private static final long serialVersionUID = 1L; { put("fmt", PageBriefcase.Response.Format.NATIVE.getFormat()); } }); // Search for created document account.soapSend( "<SearchRequest xmlns='urn:zimbraMail' types='document'>" + "<query>" + docName + "</query>" + "</SearchRequest>"); ZAssert.assertStringContains( account.soapSelectValue("//mail:doc", "name"), docName, "Verify document name through GUI"); HtmlElement element = HtmlElement.clean(response.get(PageBriefcase.Response.ResponsePart.BODY)); HtmlElement.evaluate(element, "//body", null, Pattern.compile(".*" + docText + ".*"), 1); ZAssert.assertStringContains( response.get(PageBriefcase.Response.ResponsePart.BODY), docText, "Verify document content through GUI"); // delete file upon test completion app.zPageBriefcase.deleteFileByName(docName); }
@Bugs(ids = "69132") @Test( description = "Cancel meeting using context menu", groups = {"functional"}) public void CancelMeeting_01() throws HarnessException { // -- Data setup // Creating object for meeting data String tz, apptSubject, apptBody, apptAttendee1; tz = ZTimeZone.TimeZoneEST.getID(); apptSubject = ZimbraSeleniumProperties.getUniqueString(); apptBody = ZimbraSeleniumProperties.getUniqueString(); apptAttendee1 = ZimbraAccount.AccountA().EmailAddress; // Absolute dates in UTC zone Calendar now = this.calendarWeekDayUTC; ZDate startUTC = new ZDate( now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, now.get(Calendar.DAY_OF_MONTH), 12, 0, 0); ZDate endUTC = new ZDate( now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, now.get(Calendar.DAY_OF_MONTH), 14, 0, 0); app.zGetActiveAccount() .soapSend( "<CreateAppointmentRequest xmlns='urn:zimbraMail'>" + "<m>" + "<inv method='REQUEST' type='event' status='CONF' draft='0' class='PUB' fb='B' transp='O' allDay='0' name='" + apptSubject + "'>" + "<s d='" + startUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS() + "' tz='" + tz + "'/>" + "<e d='" + endUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS() + "' tz='" + tz + "'/>" + "<or a='" + app.zGetActiveAccount().EmailAddress + "'/>" + "<at role='REQ' ptst='NE' rsvp='1' a='" + apptAttendee1 + "' d='2'/>" + "</inv>" + "<e a='" + apptAttendee1 + "' t='t'/>" + "<mp content-type='text/plain'>" + "<content>" + apptBody + "</content>" + "</mp>" + "<su>" + apptSubject + "</su>" + "</m>" + "</CreateAppointmentRequest>"); String apptId = app.zGetActiveAccount().soapSelectValue("//mail:CreateAppointmentResponse", "apptId"); // -- GUI actions // Refresh the view app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH); // Select the appointment app.zPageCalendar.zListItem(Action.A_LEFTCLICK, apptSubject); // Right Click -> Delete context menu DialogWarning dialog = (DialogWarning) app.zPageCalendar.zListItem(Action.A_RIGHTCLICK, Button.O_CANCEL_MENU, apptSubject); // Click Send Cancellation dialog.zClickButton(Button.B_SEND_CANCELLATION); // -- Verification // Verify the meeting disappears from the view ZAssert.assertEquals( app.zPageCalendar.sIsElementPresent(app.zPageCalendar.zGetApptLocator(apptSubject)), false, "Verify meeting is deleted from organizer's calendar"); // Verify meeting is deleted from attendee's calendar // AppointmentItem canceledAppt = AppointmentItem.importFromSOAP(ZimbraAccount.AccountA(), // "subject:("+ apptSubject +")", startUTC, endUTC); AppointmentItem canceledAppt = AppointmentItem.importFromSOAP(ZimbraAccount.AccountA(), "subject:(" + apptSubject + ")"); ZAssert.assertNull(canceledAppt, "Verify meeting is deleted from attendee's calendar"); }
@Test( description = "Verify Permission Denied on Spam a shared mail (read-only share)", groups = {"functional"}) public void MarkSpamMessage_01() throws HarnessException { String foldername = "folder" + ZimbraSeleniumProperties.getUniqueString(); String subject = "subject" + ZimbraSeleniumProperties.getUniqueString(); String mountpointname = "mountpoint" + ZimbraSeleniumProperties.getUniqueString(); FolderItem inbox = FolderItem.importFromSOAP(ZimbraAccount.AccountA(), FolderItem.SystemFolder.Inbox); // Create a folder to share ZimbraAccount.AccountA() .soapSend( "<CreateFolderRequest xmlns='urn:zimbraMail'>" + "<folder name='" + foldername + "' l='" + inbox.getId() + "'/>" + "</CreateFolderRequest>"); FolderItem folder = FolderItem.importFromSOAP(ZimbraAccount.AccountA(), foldername); // Share it ZimbraAccount.AccountA() .soapSend( "<FolderActionRequest xmlns='urn:zimbraMail'>" + "<action id='" + folder.getId() + "' op='grant'>" + "<grant d='" + app.zGetActiveAccount().EmailAddress + "' gt='usr' perm='r'/>" + "</action>" + "</FolderActionRequest>"); // Add a message to it ZimbraAccount.AccountA() .soapSend( "<AddMsgRequest xmlns='urn:zimbraMail'>" + "<m l='" + folder.getId() + "' >" + "<content>From: [email protected]\n" + "To: [email protected] \n" + "Subject: " + subject + "\n" + "MIME-Version: 1.0 \n" + "Content-Type: text/plain; charset=utf-8 \n" + "Content-Transfer-Encoding: 7bit\n" + "\n" + "simple text string in the body\n" + "</content>" + "</m>" + "</AddMsgRequest>"); MailItem mail = MailItem.importFromSOAP(ZimbraAccount.AccountA(), "subject:(" + subject + ")"); // Mount it app.zGetActiveAccount() .soapSend( "<CreateMountpointRequest xmlns='urn:zimbraMail'>" + "<link l='1' name='" + mountpointname + "' rid='" + folder.getId() + "' zid='" + ZimbraAccount.AccountA().ZimbraId + "'/>" + "</CreateMountpointRequest>"); FolderMountpointItem mountpoint = FolderMountpointItem.importFromSOAP(app.zGetActiveAccount(), mountpointname); // Click Get Mail button app.zPageMail.zToolbarPressButton(Button.B_GETMAIL); // Click on the mountpoint app.zTreeMail.zTreeItem(Action.A_LEFTCLICK, mountpoint); // Select the item app.zPageMail.zListItem(Action.A_LEFTCLICK, mail.dSubject); // Verify that the toolbar button is disabled String locator = "css=div[id='ztb__TV-main'] div[id='zb__TV-main__SPAM']"; ZAssert.assertTrue( app.zPageMail.sIsElementPresent(locator), "Verify the spam button is present"); ZAssert.assertTrue( app.zPageMail.sIsElementPresent(locator + "[class*='ZDisabled']"), "Verify the spam button is disabled"); }
@Test( description = "Close modifying appt and take action from warning dialog : Dont save But keep open", groups = {"functional"}) public void ModifyAppointment_03() throws HarnessException { // Creating object for appointment data AppointmentItem appt = new AppointmentItem(); String tz, apptSubject, apptAttendee1, apptAttendee2, editApptSubject; tz = ZTimeZone.TimeZoneEST.getID(); apptSubject = ZimbraSeleniumProperties.getUniqueString(); editApptSubject = ZimbraSeleniumProperties.getUniqueString(); apptAttendee1 = ZimbraAccount.AccountA().EmailAddress; apptAttendee2 = ZimbraAccount.AccountB().EmailAddress; // Absolute dates in UTC zone Calendar now = this.calendarWeekDayUTC; ZDate startUTC = new ZDate( now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, now.get(Calendar.DAY_OF_MONTH), 12, 0, 0); ZDate endUTC = new ZDate( now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, now.get(Calendar.DAY_OF_MONTH), 14, 0, 0); app.zGetActiveAccount() .soapSend( "<CreateAppointmentRequest xmlns='urn:zimbraMail'>" + "<m>" + "<inv method='REQUEST' type='event' status='CONF' draft='0' class='PUB' fb='B' transp='O' allDay='0' name='" + apptSubject + "'>" + "<s d='" + startUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS() + "' tz='" + tz + "'/>" + "<e d='" + endUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS() + "' tz='" + tz + "'/>" + "<or a='" + app.zGetActiveAccount().EmailAddress + "'/>" + "<at role='REQ' ptst='NE' rsvp='1' a='" + apptAttendee1 + "' d='2'/>" + "<at role='REQ' ptst='NE' rsvp='1' a='" + apptAttendee2 + "' d='2'/>" + "</inv>" + "<e a='" + ZimbraAccount.AccountA().EmailAddress + "' t='t'/>" + "<mp content-type='text/plain'>" + "<content>" + ZimbraSeleniumProperties.getUniqueString() + "</content>" + "</mp>" + "<su>" + apptSubject + "</su>" + "</m>" + "</CreateAppointmentRequest>"); app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH); String apptId = app.zGetActiveAccount().soapSelectValue("//mail:CreateAppointmentResponse", "apptId"); // Try to remove attendee and press close button app.zPageCalendar.zListItem(Action.A_DOUBLECLICK, apptSubject); FormApptNew apptForm = new FormApptNew(app); appt.setSubject(editApptSubject); apptForm.zRemoveAttendee(apptAttendee2); apptForm.zToolbarPressButton(Button.B_CLOSE); DialogConfirmModification confirmClose = (DialogConfirmModification) new DialogConfirmModification(app, app.zPageCalendar); confirmClose.zClickButton(Button.B_DONTSAVE_KEEP_OPEN); confirmClose.zClickButton(Button.B_SAVE_MODIFICATION); // Verify 'Save Appointment' dialog is closed ZAssert.assertFalse(confirmClose.zIsActive(), "Verify 'Save Appointment' dialog is closed"); // Verify new appt page is still open ZAssert.assertFalse(apptForm.zVerifyNewApptTabClosed(), "Verify new appt page is still open"); app.zGetActiveAccount() .soapSend("<GetAppointmentRequest xmlns='urn:zimbraMail' id='" + apptId + "'/>"); AppointmentItem modifyAppt = AppointmentItem.importFromSOAP(ZimbraAccount.AccountA(), "subject:(" + apptSubject + ")"); // Verify that appointment subject is not modified ZAssert.assertEquals( app.zGetActiveAccount() .soapMatch("//mail:GetAppointmentResponse//mail:comp", "name", apptSubject), true, ""); // Verify meeting attendees remains as it is ZAssert.assertStringContains( modifyAppt.getAttendees(), apptAttendee2, "Attendees: Verify attendee1 is present in the meeting invite"); ZAssert.assertStringContains( modifyAppt.getAttendees(), apptAttendee1, "Attendees: Verify attendee2 is present in the meeting invite"); }