@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)");
  }
Example #2
0
  @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");
  }
Example #3
0
  @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");
  }
  /**
   * Click on the folder in the dialog tree
   *
   * @param folder
   * @throws HarnessException
   */
  public void zClickTreeFolder(FolderItem folder) throws HarnessException {
    logger.info(myPageName() + " zClickTreeFolder(" + folder + ")");

    tracer.trace("Click on tree briefcase with name " + folder.getName());

    if (folder == null) throw new HarnessException("folder must not be null");

    String locator =
        "css=div[id='"
            + Locators.zDialogId
            + "'] td[id='zti__ZmChooseFolderDialog_Mail__"
            + folder.getId()
            + "_textCell']";

    if (!this.sIsElementPresent(locator))
      throw new HarnessException("unable to find folder in tree " + locator);

    this.zClick(locator);

    this.zWaitForBusyOverlay();
  }
  /**
   * Click on the folder in the dialog tree
   *
   * @param folder
   * @throws HarnessException
   */
  public void zClickTreeFolder(FolderItem folder) throws HarnessException {
    logger.info(myPageName() + " zClickTreeFolder(" + folder + ")");

    tracer.trace("Click on tree folder with name " + folder.getName());

    if (folder == null) throw new HarnessException("folder must not be null");

    String locator =
        Locators.zDialogLocator
            + " td[id='zti__ZmChooseFolderDialog_Mail__"
            + folder.getId()
            + "_textCell']";

    if (!this.sIsElementPresent(locator))
      throw new HarnessException("unable to find folder in tree " + locator);

    // For some reason, the text doesn't get entered on the first try
    this.zClick(locator);

    // Is this sleep necessary?
    SleepUtil.sleepSmall();
  }
  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;
  }