public AbsPage zTreeItem(Action action, IItem item, boolean isRowAdded) throws HarnessException { tracer.trace("Click " + action + " on folder " + item.getName()); String treeItemLocator = Locators.briefcaseTreeView + "]"; AbsPage page = zTreeItem(action, item); zWaitForElementPresent(treeItemLocator); String listItemLocator = "css=div[id^=zl__BDLV][class=DwtListView-Rows]"; if (isRowAdded) listItemLocator += ">div[id^=zli__BDLV][class^=Row]"; zWaitForElementPresent(listItemLocator); return page; }
@Override public AbsPage zTreeItem(Action action, Button option, IItem item) throws HarnessException { // Validate the arguments if ((action == null) || (option == null) || (item == null)) { throw new HarnessException( "zTreeItem(Action, Button, IItem): Must define an action, option, and item"); } logger.info( myPageName() + " zTreeItem(" + action + ", " + option + ", " + item.getName() + ")"); tracer.trace("Click " + action + " then " + option + " on item " + item.getName()); AbsPage page = null; String actionLocator = null; String optionLocator = null; if (item instanceof TagItem) { actionLocator = "css=td[id^=zti__main_Briefcase__]:contains(" + ((TagItem) item).getName() + ")"; } else if (item instanceof FolderItem) { actionLocator = "css=td[id^=zti__main_Briefcase__" + ((FolderItem) item).getId() + "_textCell]"; } else { throw new HarnessException("Must use IItem as argument, but was " + item.getClass()); } zWaitForElementVisible(actionLocator); if (action == Action.A_RIGHTCLICK) { this.zRightClickAt(actionLocator, "0,0"); } else { throw new HarnessException("implement me! " + action + ": not implemented"); } if (option == Button.B_TREE_NEWTAG) { optionLocator = Locators.zNewTagTreeMenuItem; page = new DialogTag(MyApplication, ((AppAjaxClient) MyApplication).zPageBriefcase); } else if (option == Button.B_TREE_RENAMETAG) { optionLocator = Locators.zRenameTagTreeMenuItem; page = new DialogRenameTag(MyApplication, ((AppAjaxClient) MyApplication).zPageBriefcase); } else if (option == Button.B_TREE_DELETE) { optionLocator = Locators.zDeleteTreeMenuItem; if (item instanceof TagItem) { page = new DialogWarning( DialogWarning.DialogWarningID.DeleteTagWarningMessage, MyApplication, ((AppAjaxClient) MyApplication).zPageBriefcase); } } else if (option == Button.B_TREE_NEWFOLDER) { optionLocator = Locators.zNewFolderTreeMenuItem; page = new DialogCreateBriefcaseFolder( MyApplication, ((AppAjaxClient) MyApplication).zPageBriefcase); } else if (option == Button.B_TREE_EDIT_PROPERTIES) { optionLocator = Locators.zEditPropertiesTreeMenuItem; page = new DialogEditProperties(MyApplication, ((AppAjaxClient) MyApplication).zPageBriefcase); } else { throw new HarnessException("button " + option + " not yet implemented"); } this.zWaitForBusyOverlay(); zWaitForElementVisible(optionLocator); // 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); }
@Override public AbsPage zTreeItem(Action action, IItem item) throws HarnessException { // Validate the arguments if ((action == null) || (item == null)) { throw new HarnessException("zTreeItem(Action, IItem): Must define an action, and item"); } logger.info(myPageName() + " zTreeItem(" + action + ", " + item.getName() + ")"); tracer.trace("Click " + action + " on item " + item.getName()); AbsPage page = null; String locator = null; if (item instanceof TagItem) { locator = "css=td[id^=zti__main_Briefcase__]:contains(" + ((TagItem) item).getName() + ")"; } else if (item instanceof FolderItem) { locator = Locators.briefcaseTreeView + ((FolderItem) item).getId() + "_imageCell]"; } else if (item instanceof LinkItem) { page = new DialogFindShares(MyApplication, ((AppAjaxClient) MyApplication).zPageBriefcase); if (ZimbraSeleniumProperties.isWebDriver()) { clickBy(By.id("ztih__main_Briefcase__BRIEFCASE"), By.linkText("Find Shares...")); return page; } else { locator = "css=div[id=ztih__main_Briefcase__BRIEFCASE] a[id$=_addshare_link]"; page = new DialogFindShares(MyApplication, ((AppAjaxClient) MyApplication).zPageBriefcase); } if (!this.sIsElementPresent(locator)) { throw new HarnessException("Unable to locate link in the tree " + locator); } this.sClickAt(locator, "0,0"); zWaitForBusyOverlay(); return page; } else { throw new HarnessException("Must use IItem as argument, but was " + item.getClass()); } if (action == Action.A_LEFTCLICK) { zWaitForBusyOverlay(); // FALL THROUGH } else if (action == Action.A_RIGHTCLICK) { if (!this.sIsElementPresent(locator)) throw new HarnessException("Unable to locate folder in the tree " + locator); // Select the folder this.zRightClickAt(locator, "0,0"); // return a context menu return (new ContextMenu(MyApplication)); } else { throw new HarnessException("Action " + action + " not yet implemented"); } if (!this.sIsElementPresent(locator)) throw new HarnessException("Unable to locate folder in the tree " + locator); // Default behavior. Click the locator zClickAt(locator, "0,0"); // If there is a busy overlay, wait for that to finish zWaitForBusyOverlay(); return (page); }