@Test( description = "Create Simple Html signature through GUI", groups = {"sanity"}) public void CreateBasicHtmlSignature() throws HarnessException { String sigName = "signame" + ZimbraSeleniumProperties.getUniqueString(); String sigBody = "sigbody" + ZimbraSeleniumProperties.getUniqueString(); // click on signature from left pane app.zTreePreferences.zTreeItem(Action.A_LEFTCLICK, TreeItem.MailSignatures); // Click on New signature button FormSignatureNew signew = (FormSignatureNew) app.zPageSignature.zToolbarPressButton(Button.B_NEW); // select html format from drop down signew.zSelectFormat("html"); // Reason:With "?dev=1&debug=0", Tinymce editor in HTML mode takes more time to load // commented out incompatible to webdriver reference // if(ClientSessionFactory.session().selenium().getEval("window.tinyMCE").equalsIgnoreCase("null")){ SleepUtil.sleepVeryLong(); // } // Fill Signature Name and body signew.zFillField(Field.SignatureName, sigName); signew.zFillField(Field.SignatureHtmlBody, sigBody); signew.zSubmit(); SignatureItem signature = SignatureItem.importFromSOAP(app.zGetActiveAccount(), sigName); // Verify signature name and body contents ZAssert.assertEquals(signature.getName(), sigName, "Verify signature Name"); ZAssert.assertStringContains(signature.dBodyHtmlText, sigBody, "Verify Html signature body"); // ZAssert.assertEquals(signature.dBodyHtmlText,sigBody,"Verify Html signature body"); }
@Test( description = "Create Simple text signature through GUI", groups = {"sanity"}) public void CreateBasicTextSignature() throws HarnessException { String sigName = "signame" + ZimbraSeleniumProperties.getUniqueString(); String sigBody = "sigbody" + ZimbraSeleniumProperties.getUniqueString(); // click on signature from left pane app.zTreePreferences.zTreeItem(Action.A_LEFTCLICK, TreeItem.MailSignatures); // Click on New signature button FormSignatureNew signew = (FormSignatureNew) app.zPageSignature.zToolbarPressButton(Button.B_NEW); // Fill Signature Name and body signew.zFillField(Field.SignatureName, sigName); signew.zFillField(Field.SignatureBody, sigBody); signew.zSubmit(); SignatureItem signature = SignatureItem.importFromSOAP(app.zGetActiveAccount(), sigName); // Verify signature name and body content ZAssert.assertEquals(signature.getName(), sigName, "Verify signature Name"); ZAssert.assertEquals(signature.dBodyText, sigBody, "Verify Text signature body"); }
@Test( description = "Measure the time to load the Calendar, month view, 1 appointment", groups = {"performance"}) public void ZmCalendarApp_02() throws HarnessException { // Create an appointment String subject = "subject" + ZimbraSeleniumProperties.getUniqueString(); AppointmentItem.createAppointmentSingleDay( app.zGetActiveAccount(), Calendar.getInstance(), 60, null, subject, "content" + ZimbraSeleniumProperties.getUniqueString(), "location" + ZimbraSeleniumProperties.getUniqueString(), null); // Start the perf token PerfToken token = PerfMetrics.startTimestamp( PerfKey.ZmCalendarApp, "Load the calendar app, month view, 1 appointment"); // Go to calendar // app.zPageCalendar.zNavigateTo(); app.zPageCalendar.zClickAt("css=td[id='zb__App__Calendar_title']", ""); PerfMetrics.waitTimestamp(token); // Wait for the app to load app.zPageCalendar.zWaitForActive(); }
@Test( description = "Delete a task by selecting and typing 'delete' keyboard-Verify Toast message through GUI", groups = {"smoke"}, dataProvider = "DataProviderDeleteKeys") public void DeleteTaskToastMsg_03(String name, int keyEvent) throws HarnessException { FolderItem taskFolder = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Tasks); // Create a basic task to delete String subject = "task" + ZimbraSeleniumProperties.getUniqueString(); app.zGetActiveAccount() .soapSend( "<CreateTaskRequest xmlns='urn:zimbraMail'>" + "<m >" + "<inv>" + "<comp name='" + subject + "'>" + "<or a='" + app.zGetActiveAccount().EmailAddress + "'/>" + "</comp>" + "</inv>" + "<su>" + subject + "</su>" + "<mp ct='text/plain'>" + "<content>content" + ZimbraSeleniumProperties.getUniqueString() + "</content>" + "</mp>" + "</m>" + "</CreateTaskRequest>"); GeneralUtility.syncDesktopToZcsWithSoap(app.zGetActiveAccount()); TaskItem task = TaskItem.importFromSOAP(app.zGetActiveAccount(), subject); ZAssert.assertNotNull(task, "Verify the task is created"); // Refresh the tasks view app.zPageTasks.zToolbarPressButton(Button.B_REFRESH); app.zTreeTasks.zTreeItem(Action.A_LEFTCLICK, taskFolder); // Select the item app.zPageTasks.zListItem(Action.A_MAIL_CHECKBOX, subject); // Click delete keyboard logger.info("Typing shortcut key " + name + " KeyEvent: " + keyEvent); app.zPageMail.zKeyboardKeyEvent(keyEvent); // Verifying the toaster message Toaster toast = app.zPageMain.zGetToaster(); String toastMsg = toast.zGetToastMessage(); ZAssert.assertStringContains( toastMsg, "1 task moved to Trash", "Verify toast message: Task Moved To trash"); }
@Test( description = "Create task through SOAP - delete using Backspace Key & verify Toast message through GUI", groups = {"functional"}) public void DeleteTaskToastMsg_07() throws HarnessException { FolderItem taskFolder = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Tasks); // Create a basic task to delete String subject = "task" + ZimbraSeleniumProperties.getUniqueString(); app.zGetActiveAccount() .soapSend( "<CreateTaskRequest xmlns='urn:zimbraMail'>" + "<m >" + "<inv>" + "<comp name='" + subject + "'>" + "<or a='" + app.zGetActiveAccount().EmailAddress + "'/>" + "</comp>" + "</inv>" + "<su>" + subject + "</su>" + "<mp ct='text/plain'>" + "<content>content" + ZimbraSeleniumProperties.getUniqueString() + "</content>" + "</mp>" + "</m>" + "</CreateTaskRequest>"); GeneralUtility.syncDesktopToZcsWithSoap(app.zGetActiveAccount()); TaskItem task = TaskItem.importFromSOAP(app.zGetActiveAccount(), subject); ZAssert.assertNotNull(task, "Verify the task is created"); // Refresh the tasks view app.zPageTasks.zToolbarPressButton(Button.B_REFRESH); app.zTreeTasks.zTreeItem(Action.A_LEFTCLICK, taskFolder); // Select the item app.zPageTasks.zListItem(Action.A_MAIL_CHECKBOX, subject); // Use Backspace Keyboard Shortcut app.zPageTasks.zKeyboardShortcut(Shortcut.S_BACKSPACE); // Verifying the toaster message Toaster toast = app.zPageMain.zGetToaster(); String toastMsg = toast.zGetToastMessage(); ZAssert.assertStringContains( toastMsg, "1 task moved to Trash", "Verify toast message: Task Moved to Trash"); }
@Test( description = "Verify the downloads links return 200 rather than 404", groups = {"functional"}) public void DownloadsTab_02() throws HarnessException { // Determine which links should be present List<String> locators = new ArrayList<String>(); if (ZimbraSeleniumProperties.zimbraGetVersionString().contains("NETWORK")) { locators.addAll(Arrays.asList(NetworkOnlyLocators)); locators.addAll(Arrays.asList(CommonLocators)); } else if (ZimbraSeleniumProperties.zimbraGetVersionString().contains("FOSS")) { locators.addAll(Arrays.asList(FossOnlyLocators)); locators.addAll(Arrays.asList(CommonLocators)); } else { throw new HarnessException( "Unable to find NETWORK or FOSS in version string: " + ZimbraSeleniumProperties.zimbraGetVersionString()); } for (String locator : locators) { String href = app.zPageDownloads.sGetAttribute("xpath=" + locator + "@href"); String page = ZimbraSeleniumProperties.getBaseURL() + href; HttpURLConnection connection = null; try { URL url = new URL(page); connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("HEAD"); int code = connection.getResponseCode(); // TODO: why is 400 returned for the PDF links? // 200 and 400 are acceptable ZAssert.assertStringContains( "200 400", "" + code, "Verify the download URL is valid: " + url.toString()); } catch (MalformedURLException e) { throw new HarnessException(e); } catch (IOException e) { throw new HarnessException(e); } finally { if (connection != null) { connection.disconnect(); connection = null; } } } }
@Test( description = "Edit a subfolder, change name and color Context menu -> Edit)", groups = {"functional"}) public void ChangeNameColorOfSubFolder() throws HarnessException { // -- Data FolderItem contacts = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Contacts); // Create a folder String name = "ab" + ZimbraSeleniumProperties.getUniqueString(); String newname = "ab" + ZimbraSeleniumProperties.getUniqueString(); app.zGetActiveAccount() .soapSend( "<CreateFolderRequest xmlns='urn:zimbraMail'>" + "<folder name='" + name + "' view='contact' l='" + contacts.getId() + "'/>" + "</CreateFolderRequest>"); FolderItem folderItem = FolderItem.importFromSOAP(app.zGetActiveAccount(), name); // -- GUI // Refresh app.zPageAddressbook.zRefresh(); // Change the folder's color using context menu DialogEditFolder dialog = (DialogEditFolder) app.zTreeContacts.zTreeItem(Action.A_RIGHTCLICK, Button.B_TREE_EDIT, folderItem); ZAssert.assertNotNull(dialog, "Verify the dialog opened"); dialog.zSetNewColor(FolderColor.Orange); dialog.zSetNewName(newname); dialog.zClickButton(Button.B_OK); // -- Verification // Get the folder again FolderItem actual = FolderItem.importFromSOAP(app.zGetActiveAccount(), name); ZAssert.assertNull(actual, "Verify the old addressbook does not exist"); actual = FolderItem.importFromSOAP(app.zGetActiveAccount(), newname); ZAssert.assertNotNull(actual, "Verify the new addressbook exists"); ZAssert.assertEquals( actual.getColor(), "9", "Verify the color of the folder is set to orange (9)"); }
@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 = "Rename a folder - Context menu -> Rename", groups = {"smoke"}) public void RenameFolder_01() throws HarnessException { FolderItem inbox = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Inbox); ZAssert.assertNotNull(inbox, "Verify the inbox is available"); // Create the subfolder String name1 = "folder" + ZimbraSeleniumProperties.getUniqueString(); app.zGetActiveAccount() .soapSend( "<CreateFolderRequest xmlns='urn:zimbraMail'>" + "<folder name='" + name1 + "' l='" + inbox.getId() + "'/>" + "</CreateFolderRequest>"); FolderItem subfolder1 = FolderItem.importFromSOAP(app.zGetActiveAccount(), name1); ZAssert.assertNotNull(subfolder1, "Verify the subfolder is available"); // Click on Get Mail to refresh the folder list app.zPageMail.zToolbarPressButton(Button.B_GETMAIL); // Rename the folder using context menu DialogRenameFolder dialog = (DialogRenameFolder) app.zTreeMail.zTreeItem(Action.A_RIGHTCLICK, Button.B_RENAME, subfolder1); ZAssert.assertNotNull(dialog, "Verify the dialog opened"); // Set the name, click OK String name2 = "folder" + ZimbraSeleniumProperties.getUniqueString(); dialog.zSetNewName(name2); dialog.zClickButton(Button.B_OK); // Get all the folders and verify the new name appears and the old name disappears app.zGetActiveAccount().soapSend("<GetFolderRequest xmlns = 'urn:zimbraMail'/>"); Element[] eFolder1 = app.zGetActiveAccount().soapSelectNodes("//mail:folder[@name='" + name1 + "']"); ZAssert.assertEquals(eFolder1.length, 0, "Verify the old folder name no longer exists"); Element[] eFolder2 = app.zGetActiveAccount().soapSelectNodes("//mail:folder[@name='" + name2 + "']"); ZAssert.assertEquals(eFolder2.length, 1, "Verify the new folder name exists"); }
/** * 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 = "Verify the Downloads Tab contains the correct FOSS vs NETWORK links", groups = {"functional"}) public void DownloadsTab_01() throws HarnessException { // Make sure common links are present for (String locator : CommonLocators) { ZAssert.assertTrue( app.zPageDownloads.sIsElementPresent(locator), "Verify the common locator exists: " + locator); } // If NETWORK, make sure NETWORK-only links appear and FOSS-only links do not appear // If FOSS, make sure FOSS-only links appear and NETWORK-only links do not appear if (ZimbraSeleniumProperties.zimbraGetVersionString().contains("NETWORK")) { for (String locator : NetworkOnlyLocators) { ZAssert.assertTrue( app.zPageDownloads.sIsElementPresent(locator), "Verify the network-only locator exists: " + locator); } for (String locator : FossOnlyLocators) { ZAssert.assertFalse( app.zPageDownloads.sIsElementPresent(locator), "Verify the foss-only locator does not exists: " + locator); } } else if (ZimbraSeleniumProperties.zimbraGetVersionString().contains("FOSS")) { for (String locator : NetworkOnlyLocators) { ZAssert.assertFalse( app.zPageDownloads.sIsElementPresent(locator), "Verify the network-only locator does not exists: " + locator); } for (String locator : FossOnlyLocators) { ZAssert.assertTrue( app.zPageDownloads.sIsElementPresent(locator), "Verify the foss-only locator exists: " + locator); } } else { throw new HarnessException( "Unable to find NETWORK or FOSS in version string: " + ZimbraSeleniumProperties.zimbraGetVersionString()); } }
@Test( description = "Create a new tasklist using tasks app New -> New Task Folder", groups = {"functional"}) public void CreateTaskFolder_02() throws HarnessException { ZimbraAccount account = app.zGetActiveAccount(); FolderItem taskFolder = FolderItem.importFromSOAP(account, SystemFolder.Tasks); _folderName = "taskfolder" + ZimbraSeleniumProperties.getUniqueString(); // Create folder DialogCreateTaskFolder createTaskFolderDialog = (DialogCreateTaskFolder) app.zPageTasks.zToolbarPressPulldown(Button.B_NEW, Button.O_NEW_TASKFOLDER); createTaskFolderDialog.zEnterFolderName(_folderName); createTaskFolderDialog.zClickButton(Button.B_OK); _folderIsCreated = true; SleepUtil.sleepVerySmall(); // refresh task page app.zTreeTasks.zTreeItem(Action.A_LEFTCLICK, taskFolder); // Make sure the task folder was created on the ZCS server FolderItem folder = FolderItem.importFromSOAP(app.zGetActiveAccount(), _folderName); ZAssert.assertNotNull(folder, "Verify task folder is created"); ZAssert.assertEquals( folder.getName(), _folderName, "Verify the server and client folder names match"); }
@Test( description = "Create a new tasklist by clicking 'Create a new task' on task folders tree", groups = {"sanity"}) public void CreateTaskFolder_01() throws HarnessException { ZimbraAccount account = app.zGetActiveAccount(); FolderItem taskFolder = FolderItem.importFromSOAP(account, SystemFolder.Tasks); _folderName = "taskfolder" + ZimbraSeleniumProperties.getUniqueString(); // Create folder // DialogCreateTaskFolder createTaskFolderDialog // =(DialogCreateTaskFolder)app.zTreeTasks.zPressButton(Button.B_TREE_NEWTASKLIST); DialogCreateTaskFolder createTaskFolderDialog = (DialogCreateTaskFolder) app.zTreeTasks.zPressPulldown(Button.B_TREE_FOLDERS_OPTIONS, Button.B_TREE_NEWTASKLIST); createTaskFolderDialog.zEnterFolderName(_folderName); createTaskFolderDialog.zClickButton(Button.B_OK); _folderIsCreated = true; SleepUtil.sleepVerySmall(); // refresh task page app.zTreeTasks.zTreeItem(Action.A_LEFTCLICK, taskFolder); // Make sure the task folder was created on the ZCS server FolderItem folder = FolderItem.importFromSOAP(app.zGetActiveAccount(), _folderName); ZAssert.assertNotNull(folder, "Verify task folder is created"); ZAssert.assertEquals( folder.getName(), _folderName, "Verify the server and client folder names match"); }
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 = "Double tag a contact ", groups = {"functional"}) public void DoubleTag() throws HarnessException { // Create a new tag TagItem tagItem = TagItem.CreateUsingSoap(app); // Create a contact via Soap then select ContactItem contactItem = app.zPageAddressbook.createUsingSOAPSelectContact(app, Action.A_LEFTCLICK); // select the tag app.zPageAddressbook.zToolbarPressPulldown(Button.B_TAG, tagItem); Verify(contactItem, tagItem.getName()); // create a new tag name String tagName = "tag" + ZimbraSeleniumProperties.getUniqueString(); // click Tag Contact->New Tag DialogTag dialogTag = (DialogTag) app.zPageAddressbook.zListItem( Action.A_RIGHTCLICK, Button.B_TAG, Button.O_TAG_NEWTAG, contactItem.fileAs); dialogTag.zSetTagName(tagName); dialogTag.zClickButton(Button.B_OK); Verify(contactItem, tagName); }
@Bugs(ids = "82807") @Test( description = "Hover over an image attachment", dataProvider = "DataProviderMimeWithImageAttachments", groups = {"functional"}) public void HoverOverAttachment_01(String subject, String path) throws HarnessException { // -- DATA final String mimeFile = ZimbraSeleniumProperties.getBaseDirectory() + path; LmtpInject.injectFile(app.zGetActiveAccount().EmailAddress, new File(mimeFile)); // -- GUI // Click on Get Mail to refresh the folder list app.zPageMail.zToolbarPressButton(Button.B_GETMAIL); // Select the message DisplayMail display = (DisplayMail) app.zPageMail.zListItem(Action.A_LEFTCLICK, subject); List<AttachmentItem> attachments = display.zListGetAttachments(); ZAssert.assertEquals(attachments.size(), 1, "Verify the attachment appears"); TooltipImage tooltip = (TooltipImage) display.zListAttachmentItem(Action.A_HOVEROVER, attachments.get(0)); // -- VERIFICATION ZAssert.assertTrue(tooltip.zIsActive(), "Verify the tooltip shows"); ZAssert.assertNotNull(tooltip.zGetField(Field.URL), "Verify the image URL"); }
@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"); }
@Test( description = "D1 Enhancement : Create a contact group with 3 contacts", groups = {"functional"}) public void CreateContactGroupWith3Contacts() throws HarnessException { // -- Data // Create a contact ContactItem contact1 = ContactItem.createContactItem(app.zGetActiveAccount()); ContactItem contact2 = ContactItem.createContactItem(app.zGetActiveAccount()); ContactItem contact3 = ContactItem.createContactItem(app.zGetActiveAccount()); // Create a contact group String groupname = "group" + ZimbraSeleniumProperties.getUniqueString(); // -- GUI // Refresh app.zPageAddressbook.zRefresh(); // Check 3 contact items app.zPageAddressbook.zListItem(Action.A_CHECKBOX, contact1.getName()); app.zPageAddressbook.zListItem(Action.A_CHECKBOX, contact2.getName()); app.zPageAddressbook.zListItem(Action.A_CHECKBOX, contact3.getName()); // Right click on one contact -> Group -> Existing Group Name DialogNewContactGroup dialog = (DialogNewContactGroup) app.zPageAddressbook.zListItem( Action.A_RIGHTCLICK, Button.B_CONTACTGROUP, Button.O_NEW_CONTACTGROUP, contact1.getName()); dialog.zEnterGroupName(groupname); dialog.zClickButton(Button.B_OK); // -- Verification // Verify the contact group is created ContactGroupItem actual = ContactGroupItem.importFromSOAP(app.zGetActiveAccount(), groupname); ZAssert.assertNotNull(actual, "Verify the contact group is created"); // Verify the contact group contains the contact ZAssert.assertContains( actual.getMemberList(), new ContactGroupItem.MemberItemContact(contact1), "Verify the contact group conatins the contact"); ZAssert.assertContains( actual.getMemberList(), new ContactGroupItem.MemberItemContact(contact2), "Verify the contact group conatins the contact"); ZAssert.assertContains( actual.getMemberList(), new ContactGroupItem.MemberItemContact(contact3), "Verify the contact group conatins the contact"); }
@Test( description = "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 }
@Bugs(ids = "66393") @Test( description = "Auto save a basic draft (subject only)", groups = {"smoke"}) public void AutoSaveDraftMail_01() throws HarnessException { // Create the message data to be sent String subject = "subject" + ZimbraSeleniumProperties.getUniqueString(); String body = "body" + ZimbraSeleniumProperties.getUniqueString(); FormMailNew mailform = null; try { // Open the new mail form mailform = (FormMailNew) app.zPageMail.zToolbarPressButton(Button.B_NEW); ZAssert.assertNotNull(mailform, "Verify the new form opened"); // Fill out the form with the data mailform.zFillField(Field.Subject, subject); mailform.zFillField(Field.Body, body); // Wait for twice the amount SleepUtil.sleep(PrefAutoSaveDraftInterval * 2 * 1000); // Get the message from the server FolderItem draftsFolder = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Drafts); MailItem draft = MailItem.importFromSOAP(app.zGetActiveAccount(), "subject:(" + subject + ")"); // Verify the draft data matches ZAssert.assertEquals(draft.dSubject, subject, "Verify the subject field is correct"); ZAssert.assertEquals( draft.dFolderId, draftsFolder.getId(), "Verify the draft is saved in the drafts folder"); } finally { if ((mailform != null) && (mailform.zIsActive())) { // Close out the draft mailform.zToolbarPressButton(Button.B_SAVE_DRAFT); mailform.zToolbarPressButton(Button.B_CANCEL); } } }
@Bugs(ids = "69132") @Test( description = "View a multi-day appointment in the month view", groups = {"functional"}) public void GetAppointment_02() throws HarnessException { // Create an appointment on the server String subject = "appointment" + ZimbraSeleniumProperties.getUniqueString(); AppointmentItem.createAppointmentAllDay( app.zGetActiveAccount(), Calendar.getInstance(), 2, subject, "content" + ZimbraSeleniumProperties.getUniqueString(), "location" + ZimbraSeleniumProperties.getUniqueString(), null); // Refresh the calendar app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH); // Verify appointment displayed in month view ZAssert.assertEquals( app.zPageCalendar.sIsElementPresent(app.zPageCalendar.zGetAllDayApptLocator(subject)), true, "Verify appointment present in month view"); // Below code works fine for single-day all day but for multi-day all day appointment it fails // because it finds empty cell // List<AppointmentItem> items = app.zPageCalendar.zListGetAppointments(); // ZAssert.assertNotNull(items, "Get the list of appointments"); // Verify the appointment is in the view // AppointmentItem found = null; // for(AppointmentItem item : items) { // if ( item.getSubject().equals(subject) ) { // found = item; // break; // } // } // ZAssert.assertNotNull(found, "Verify the new appointment appears in the view"); }
@Test( description = "Rename a folder - set to an invalid name with ':'", groups = {"functional"}) public void RenameFolder_02() throws HarnessException { FolderItem inbox = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Inbox); ZAssert.assertNotNull(inbox, "Verify the inbox is available"); // Create the subfolder String name1 = "folder" + ZimbraSeleniumProperties.getUniqueString(); app.zGetActiveAccount() .soapSend( "<CreateFolderRequest xmlns='urn:zimbraMail'>" + "<folder name='" + name1 + "' l='" + inbox.getId() + "'/>" + "</CreateFolderRequest>"); FolderItem subfolder1 = FolderItem.importFromSOAP(app.zGetActiveAccount(), name1); ZAssert.assertNotNull(subfolder1, "Verify the subfolder is available"); // Click on Get Mail to refresh the folder list app.zPageMail.zToolbarPressButton(Button.B_GETMAIL); // Rename the folder using context menu DialogRenameFolder dialog = (DialogRenameFolder) app.zTreeMail.zTreeItem(Action.A_RIGHTCLICK, Button.B_RENAME, subfolder1); ZAssert.assertNotNull(dialog, "Verify the dialog opened"); // Set the name, click OK String name2 = "folder:folder" + ZimbraSeleniumProperties.getUniqueString(); dialog.zSetNewName(name2); dialog.zClickButton(Button.B_OK); DialogError error = app.zPageMain.zGetErrorDialog(DialogErrorID.InvalidFolderName); ZAssert.assertTrue(error.zIsActive(), "Verify the error dialog appears"); error.zClickButton(Button.B_OK); }
// -------------------------------------------------------------------------- // SECTION 3: TEST-METHODS // -------------------------------------------------------------------------- @Test( dataProvider = "mailDataProvider", groups = {"smoke", "full"}, retryAnalyzer = RetryFailedTests.class) public void addingAttachFromMsgToBriefcaseFolder( String to, String cc, String bcc, String subject, String body, String attachments) throws Exception { if (SelNGBase.isExecutionARetry.get()) handleRetry1(); checkForSkipException("all", "na", "46702", "can not move attachment to briefcase folder"); zGoToApplication("Mail"); page.zComposeView.zNavigateToMailCompose(); page.zComposeView.zSendMailToSelfAndVerify( ClientSessionFactory.session().currentUserName(), cc, bcc, subject, body, attachments); obj.zMessageItem.zClick(subject); SleepUtil.sleep(2000); if (ZimbraSeleniumProperties.getStringProperty("browser").equals("IE")) { Assert.assertTrue( ClientSessionFactory.session() .selenium() .isElementPresent( "xpath=//div[contains(@id,'zlif__CLV') and contains(@class,'ImgAttachment')]"), "Attachment symbol does not found"); } else { obj.zMessageItem.zVerifyHasAttachment(subject); } // obj.zMessageItem.zVerifyHasAttachment(subject); if (ZimbraSeleniumProperties.getStringProperty("locale").equals("nl")) { ClientSessionFactory.session().selenium().click("link=Aktetas"); } else { ClientSessionFactory.session().selenium().click("link=" + localize(locator.briefcase)); } obj.zFolder.zClickInDlgByName( localize(locator.briefcase), localize(locator.addToBriefcaseTitle)); obj.zButton.zClickInDlgByName(localize(locator.ok), localize(locator.addToBriefcaseTitle)); zGoToApplication("Briefcase"); obj.zFolder.zClick(page.zBriefcaseApp.zBriefcaseFolder); obj.zBriefcaseItem.zExists(attachments); SelNGBase.needReset.set(false); }
@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"); }
@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 = "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"); }
@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 = "69132") @Test( description = "View a basic appointment in the month view", groups = {"functional"}) public void GetAppointment_01() throws HarnessException { // Create an appointment on the server String subject = "appointment" + ZimbraSeleniumProperties.getUniqueString(); AppointmentItem.createAppointmentAllDay( app.zGetActiveAccount(), Calendar.getInstance(), 1, subject, "content" + ZimbraSeleniumProperties.getUniqueString(), "location" + ZimbraSeleniumProperties.getUniqueString(), null); // Refresh the calendar app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH); // Get the list of appointments in the current view List<AppointmentItem> items = app.zPageCalendar.zListGetAppointments(); ZAssert.assertNotNull(items, "Get the list of appointments"); // Verify the appointment is in the view AppointmentItem found = null; for (AppointmentItem item : items) { if (item.getSubject().equals(subject)) { found = item; break; } } ZAssert.assertNotNull(found, "Verify the new appointment appears in the view"); }
@Test( description = "Measure the time to load the Calendar, month view, 100 appointment", groups = {"performance"}) public void ZmCalendarApp_03() throws HarnessException { // What is today? Calendar today = Calendar.getInstance(); // Import 100 appointments using Calendar.ics and REST String filename = ZimbraSeleniumProperties.getBaseDirectory() + "/data/public/ics/calendar05/Calendar.ics"; File file = null; // Modify the ICS in two ways: // 1. Make the current account the organizer // 2. Make the dates equal to this month file = RestUtil.FileUtils.replaceInFile( "*****@*****.**", app.zGetActiveAccount().EmailAddress, new File(filename)); file = RestUtil.FileUtils.replaceInFile( "201111", (new SimpleDateFormat("yyyyMM")).format(today.getTime()), file); RestUtil rest = new RestUtil(); rest.setAuthentication(app.zGetActiveAccount()); rest.setPath("/service/home/~/Calendar"); rest.setQueryParameter("fmt", "ics"); rest.setUploadFile(file); rest.doPost(); // Start the perf token PerfToken token = PerfMetrics.startTimestamp( PerfKey.ZmCalendarApp, "Load the calendar app, month view, 100 appointment"); // Go to calendar // app.zPageCalendar.zNavigateTo(); app.zPageCalendar.zClickAt("css=td[id='zb__App__Calendar_title']", ""); PerfMetrics.waitTimestamp(token); // Wait for the app to load app.zPageCalendar.zWaitForActive(); }
@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"); }