@Test( description = "Tag a contact by dnd on an existing tag", groups = {"functional"}) public void DnDOnExistingTag() throws HarnessException { // Create a contact via Soap then select ContactItem contactItem = app.zPageAddressbook.createUsingSOAPSelectContact(app, Action.A_LEFTCLICK); // Create a new tag via soap TagItem tagItem = TagItem.CreateUsingSoap(app); // Refresh to display the new tag app.zPageMain.zToolbarPressButton(Button.B_REFRESH); // Dnd on the new tag app.zPageAddressbook.zDragAndDrop( "css=td#zlif__CNS-main__" + contactItem.getId() + "__fileas:contains(" + contactItem.fileAs + ")", "css=div[id=main_Contacts-parent-TAG] div[id=ztih__main_Contacts__TAG] td[id^=zti__main_Contacts__][id$=_textCell]:contains(" + tagItem.getName() + ")"); Verify(contactItem, tagItem.getName()); }
@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); }
@Test( description = "Right click then click Tag Contact->a tag name", groups = {"functional"}) public void ClickContextMenuTagContactExistingTag() throws HarnessException { // Create a tag TagItem tagItem = TagItem.CreateUsingSoap(app); // Create a contact via Soap then select ContactItem contactItem = app.zPageAddressbook.createUsingSOAPSelectContact(app, Action.A_LEFTCLICK); // click Tag Contact->the tag name app.zPageAddressbook.zListItem(Action.A_RIGHTCLICK, Button.B_TAG, tagItem, contactItem.fileAs); Verify(contactItem, tagItem.getName()); }
@Test( description = "click pulldown menu Tag->A tag name", groups = {"smoke"}) public void ClickPulldownMenuTagExistingTag() throws HarnessException { // Create a contact via Soap then select ContactItem contactItem = app.zPageAddressbook.createUsingSOAPSelectContact(app, Action.A_LEFTCLICK); // Create a tag TagItem tagItem = TagItem.CreateUsingSoap(app); // select the tag app.zPageAddressbook.zToolbarPressPulldown(Button.B_TAG, tagItem); Verify(contactItem, tagItem.getName()); }
@Test( description = "Tag a contact group by dnd on an existing tag", groups = {"functional"}) public void DnDOnExistingTag() throws HarnessException { // -- Data // Create a tag TagItem tagItem = TagItem.CreateUsingSoap(app.zGetActiveAccount()); // Create a contact group via Soap then select ContactGroupItem group = ContactGroupItem.createContactGroupItem(app.zGetActiveAccount()); // -- GUI // Refresh app.zPageAddressbook.zRefresh(); // Dnd on the new tag app.zPageAddressbook.zDragAndDrop( "css=[id=zlif__CNS-main__" + group.getId() + "__fileas]:contains(" + group.getName() + ")", "css=div[id=main_Contacts-parent-TAG] div[id=ztih__main_Contacts__TAG] td[id^=zti__main_Contacts__][id$=_textCell]:contains(" + tagItem.getName() + ")"); // -- Verification app.zGetActiveAccount() .soapSend( "<GetContactsRequest xmlns='urn:zimbraMail' >" + "<cn id='" + group.getId() + "'/>" + "</GetContactsRequest>"); String t = app.zGetActiveAccount().soapSelectValue("//mail:cn", "t"); ZAssert.assertNotNull(t, "Verify the contact has tags"); ZAssert.assertStringContains( t, tagItem.getId(), "Verify the contact is tagged with the correct tag"); }
@Test( description = "click pulldown menu Tag->A tag name", groups = {"smoke"}) public void ClickPulldownMenuTagExistingTag() throws HarnessException { // -- Data // Create a tag TagItem tagItem = TagItem.CreateUsingSoap(app.zGetActiveAccount()); // Create a contact group via Soap then select ContactGroupItem group = ContactGroupItem.createContactGroupItem(app.zGetActiveAccount()); // -- GUI // Refresh app.zPageAddressbook.zRefresh(); // Select the contact group app.zPageAddressbook.zListItem(Action.A_LEFTCLICK, group.getName()); // Tag -> Existing Tag app.zPageAddressbook.zToolbarPressPulldown(Button.B_TAG, tagItem); // -- Verification app.zGetActiveAccount() .soapSend( "<GetContactsRequest xmlns='urn:zimbraMail' >" + "<cn id='" + group.getId() + "'/>" + "</GetContactsRequest>"); String t = app.zGetActiveAccount().soapSelectValue("//mail:cn", "t"); ZAssert.assertNotNull(t, "Verify the contact has tags"); ZAssert.assertStringContains( t, tagItem.getId(), "Verify the contact is tagged with the correct tag"); }
/* (non-Javadoc) * @see framework.ui.AbsTree#zTreeItem(framework.ui.Action, framework.items.FolderItem) */ public AbsPage zTreeItem(Action action, IItem addressbook) throws HarnessException { tracer.trace("Click " + action + " on addressbook " + addressbook); // Validate the arguments if ((action == null) || (addressbook == null)) { throw new HarnessException("Must define an action and addressbook"); } FolderItem folder = null; TagItem tag = null; if (!(addressbook instanceof FolderItem)) { tag = (TagItem) addressbook; // throw new HarnessException("Must use FolderItem as argument, but was "+ // addressbook.getClass()); } else { folder = (FolderItem) addressbook; } AbsPage page = null; String locator = null; if (action == Action.A_LEFTCLICK) { // choose target addressbook to move contact to (done for TouchPad) locator = "css=div[id^='ext-tagview'] div[id^='ext-simplelistitem'] div[id^='ext-element']:contains('" + tag.getName() + "')"; page = null; } else if (action == Action.A_RIGHTCLICK) { locator = "id=zti__main_Contacts__" + folder.getId() + "_textCell"; if (!this.sIsElementPresent(locator)) { throw new HarnessException("Unable to locator folder in tree " + locator); } this.zRightClickAt(locator, ""); zWaitForBusyOverlay(); return (null); } else { throw new HarnessException("Action " + action + " not yet implemented"); } if (locator == null) { throw new HarnessException("no locator defined for action: " + action); } if (!this.sIsElementPresent(locator)) { throw new HarnessException("Unable to locator folder in tree " + locator); } // By default, left click at locator zClick(locator); zWaitForBusyOverlay(); if (page != null) { page.zWaitForActive(); } return (page); }
protected AbsPage zTreeItem(Action action, Button option, TagItem t) throws HarnessException { if ((action == null) || (option == null) || (t == null)) { throw new HarnessException("Must define an action, option, and addressbook"); } AbsPage page = null; String actionLocator = null; String optionLocator = "css=div[id^='ZmActionMenu_contacts_TAG'] "; tracer.trace("processing " + t.getName()); if (action == Action.A_LEFTCLICK) { throw new HarnessException("implement me!"); } else if (action == Action.A_RIGHTCLICK) { actionLocator = "css=td[id^='zti__main_Contacts__']:contains('" + t.getName() + "')"; this.zRightClickAt(actionLocator, ""); this.zWaitForBusyOverlay(); } else { throw new HarnessException("Action " + action + " not yet implemented"); } if (option == Button.B_TREE_NEWTAG) { // optionLocator = "//td[contains(@id,'_left_icon')]/div[contains(@class,'ImgNewTag')]"; // optionLocator="//div[contains(@id,'POPUP_DWT') and // contains(@class,'ZHasSubMenu')]//tbody/tr[@id='POPUP_NEW_TAG']"; // optionLocator = css=div[id='ZmActionMenu_conversationList_TAG'] div[id='NEW_TAG'] // td[id$='_title'] optionLocator += " div[id^='NEW_TAG'] td[id$='_title']"; page = new DialogTag(MyApplication, ((AppAjaxClient) MyApplication).zPageMail); } else if (option == Button.B_DELETE) { // optionLocator = Locators.zDeleteTreeMenuItem; optionLocator += " div[id^='DELETE_WITHOUT_SHORTCUT'] td[id$='_title']"; page = new DialogWarning( DialogWarning.DialogWarningID.DeleteTagWarningMessage, MyApplication, ((AppAjaxClient) MyApplication).zPageAddressbook); } else if (option == Button.B_RENAME) { // optionLocator = Locators.zRenameTreeMenuItem; optionLocator += " div[id^='RENAME_TAG'] td[id$='_title']"; page = new DialogRenameTag(MyApplication, ((AppAjaxClient) MyApplication).zPageAddressbook); } else { throw new HarnessException("button " + option + " not yet implemented"); } if (actionLocator == null) throw new HarnessException("locator is null for action " + action); if (optionLocator == null) throw new HarnessException("locator is null for option " + option); // Default behavior. Click the locator zClickAt(optionLocator, ""); // If there is a busy overlay, wait for that to finish this.zWaitForBusyOverlay(); if (page != null) { // Wait for the page to become active, if it was specified page.zWaitForActive(); } return (page); }