@Test( description = "Edit a folder, change the color (Context menu -> Edit)", groups = {"functional"}) public void ChangeColorOfSystemFolders() throws HarnessException { // -- Data FolderItem contacts = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Contacts); // -- 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, contacts); ZAssert.assertNotNull(dialog, "Verify the dialog opened"); dialog.zSetNewColor(FolderColor.Green); dialog.zClickButton(Button.B_OK); // -- Verification // Get the folder again FolderItem actual = FolderItem.importFromSOAP(app.zGetActiveAccount(), contacts.getName()); ZAssert.assertEquals( actual.getColor(), "3", "Verify the color of the folder is set to green (3)"); }
protected AbsPage zTreeItem(Action action, Button option, FolderItem folderItem) throws HarnessException { AbsPage page = null; String actionLocator = null; String optionLocator = null; if ((action == null) || (option == null) || (folderItem == null)) { throw new HarnessException("Must define an action, option, and addressbook"); } logger.info( myPageName() + " zTreeItem(" + action + ", " + option + "," + folderItem.getName() + ")"); tracer.trace(action + " then " + option + " on Folder Item = " + folderItem.getName()); if (folderItem.getName().equals("USER_ROOT")) { actionLocator = "css=div#ztih__main_Contacts__ADDRBOOK_div"; } else { actionLocator = "css=div#zti__main_Contacts__" + folderItem.getId() + "_div"; } if (action == Action.A_RIGHTCLICK) { if (option == Button.B_TREE_NEWFOLDER) { optionLocator = "css=div[id^='ZmActionMenu_contacts_ADDRBOOK'] div[id^='NEW_ADDRBOOK'] td[id$='_title']"; page = new DialogCreateFolder(MyApplication, ((AppAjaxClient) MyApplication).zPageAddressbook); } else if (option == Button.B_DELETE) { optionLocator = "css=div[id^='ZmActionMenu_contacts_ADDRBOOK'] div[id^='DELETE_WITHOUT_SHORTCUT'] td[id$='_title']"; page = null; } else if (option == Button.B_RENAME) { optionLocator = "css=div[id^='ZmActionMenu_contacts_ADDRBOOK'] div[id^='RENAME_FOLDER'] td[id$='_title']"; page = new DialogRenameFolder(MyApplication, ((AppAjaxClient) MyApplication).zPageAddressbook); } else if (option == Button.B_TREE_EDIT) { optionLocator = "css=div[id^='ZmActionMenu_contacts_ADDRBOOK'] div[id^='EDIT_PROPS'] td[id$='_title']"; page = new DialogEditFolder(MyApplication, ((AppAjaxClient) MyApplication).zPageAddressbook); } else if (option == Button.B_TREE_FOLDER_EMPTY) { optionLocator = "css=div[id^='ZmActionMenu_contacts_ADDRBOOK'] div[id^='EMPTY_FOLDER'] td[id$='_title']"; page = new DialogWarning( DialogWarning.DialogWarningID.EmptyFolderWarningMessage, MyApplication, ((AppAjaxClient) MyApplication).zPageAddressbook); } else if (option == Button.B_SHARE) { optionLocator = "css=div[id='ZmActionMenu_contacts_ADDRBOOK'] div[id='SHARE_ADDRBOOK'] td[id$='_title']"; page = new DialogShare(MyApplication, ((AppAjaxClient) MyApplication).zPageAddressbook); } else { throw new HarnessException("implement action:" + action + " option:" + option); } if (actionLocator != null) { zRightClickAt(actionLocator, "0,0"); zWaitForBusyOverlay(); } if (optionLocator != null) { zClickAt(optionLocator, "0,0"); zWaitForBusyOverlay(); } if (page != null) { page.zWaitForActive(); } return page; } else if (action == Action.A_LEFTCLICK) { if (option == Button.B_TREE_NEWFOLDER) { zClickAt("css=div[class^=ImgNewContactsFolder][class*=ZWidget]", "0,0"); page = new DialogCreateFolder(MyApplication, ((AppAjaxClient) MyApplication).zPageAddressbook); } else { throw new HarnessException("implement action:" + action + " option:" + option); } } else { throw new HarnessException("implement action:" + action + " option:" + option); } if (page != null) { page.zWaitForActive(); } return page; }