예제 #1
0
  /**
   * Create a new space
   *
   * @param name
   * @param desc
   * @param visibility
   * @param registration
   * @param groupPath
   * @param childGroupName
   * @param params
   */
  public void addNewSpace(
      String name,
      String desc,
      String visibility,
      String registration,
      String groupPath,
      String childGroupName,
      int... params) {
    info("-- Adding a new space --");
    int iTimeout = params.length > 0 ? params[0] : DEFAULT_TIMEOUT;
    if (waitForAndGetElement(ELEMENT_ADDNEWSPACE_BUTTON, 3000, 0, 2) != null) {
      clickByJavascript(ELEMENT_ADDNEWSPACE_BUTTON);
    } else {
      clickByJavascript(By.cssSelector("i[class ~= 'uiIconSocSimplePlus']"));
    }

    waitForAndGetElement(ELEMENT_ADDNEWSPACE_FORM);
    type(ELEMENT_SPACE_NAME_INPUT, name, true);
    type(ELEMENT_SPACE_DESCRIPTION_INPUT, desc, true);
    switchTabs(ELEMENT_ACCESS_TAB);

    if (visibility != "") {
      info("-- Set visibility --");
      if (visibility.equals("Visible")) {
        check(ELEMENT_ACCESS_EDIT_VISIBLE, 2);
      } else if (visibility.equals("Hidden")) {
        check(ELEMENT_ACCESS_EDIT_HIDDEN, 2);
      }
    }

    if (registration != "") {
      info("-- Set Registration --");
      if (registration.equals("Open")) {
        check(ELEMENT_ACCESS_EDIT_REGISTRATION_OPEN, 2);
      } else if (registration.equals("Validation")) {
        check(ELEMENT_ACCESS_EDIT_REGISTRATION_VALIDATION, 2);
      } else if (registration.equals("Close")) {
        check(ELEMENT_ACCESS_EDIT_REGISTRATION_CLOSE, 2);
      }
    }

    if (groupPath != "" && childGroupName != "") {
      switchTabs(ELEMENT_USER_GROUP_TAB);
      addUserGroupToInvite(groupPath, childGroupName);
    }
    clickButton("Create");
    waitForAndGetElement(By.linkText(name), iTimeout);
    waitForElementNotPresent(ELEMENT_ADDNEWSPACE_FORM);
    Utils.pause(1000);
    // waitForElementPresent(By.xpath("//div[contains(@class,'UISpaceName')]/a[@title='"
    // + name + "']"), iTimeout);
  }
예제 #2
0
 /**
  * addNewSpace
  *
  * @param name
  * @param desc
  * @param params
  */
 public void addNewSpace(String name, String desc, int... params) {
   int iTimeout = params.length > 0 ? params[0] : DEFAULT_TIMEOUT;
   if (waitForAndGetElement(ELEMENT_ADDNEWSPACE_BUTTON, 3000, 0, 2) != null) {
     click(ELEMENT_ADDNEWSPACE_BUTTON);
   } else {
     click(By.xpath("//*[contains(@class, 'uiIconSocSimplePlus')]"));
   }
   waitForAndGetElement(ELEMENT_ADDNEWSPACE_FORM);
   type(ELEMENT_SPACE_NAME_INPUT, name, true);
   type(ELEMENT_SPACE_DESCRIPTION_INPUT, desc, true);
   clickButton("Create");
   waitForAndGetElement(By.linkText(name), iTimeout);
   Utils.pause(3000);
 }