Ejemplo n.º 1
0
  public void doLogin(String username, String password) {
    // accessing tag name as workaround for permission denied to access property 'nr@context' issue
    PageElementUtils.permissionDeniedWorkAround(usernameOrEmailInput);

    usernameOrEmailInput.clear().type(username);
    passwordInput.clear().type(password);
    loginButton.click();
  }
Ejemplo n.º 2
0
 public T handleWebLoginIfRequired(String username, String password) {
   if (usernameField.isPresent()) {
     usernameField.type(username);
     passwordField.type(password);
     submitButton.click();
   }
   return nextPage;
 }
 @Override
 public JiraWebSudo authenticateFail(String password) {
   passwordElement.clear();
   if (StringUtils.isNotBlank(password)) {
     passwordElement.type(password);
   }
   submit(submitElement);
   return this;
 }
  AddIssueTypeForm setSubtask(boolean subtask) {
    assertSubstasksEnabled();

    if (subtask) {
      subtaskRadio.click();
    } else {
      issueTypeRadio.click();
    }
    return this;
  }
Ejemplo n.º 5
0
  public void doLogout() {
    // accessing tag name as workaround for permission denied to access property 'nr@context' issue
    PageElementUtils.permissionDeniedWorkAround(usernameOrEmailInput);

    if (userDropdownTriggerLink.isPresent()) {
      // only do the logout if the user drop down is present, i.e., if the user is logged in.
      userDropdownTriggerLink.click();
      logoutLink.click();
    }
  }
Ejemplo n.º 6
0
  @Override
  public TimedCondition isAt() {
    final Conditions.CombinableCondition allElementsCondition =
        Conditions.and(
            nameElement.timed().isPresent(),
            descriptionElement.timed().isPresent(),
            avatarPickerTrigger.timed().isPresent(),
            submitButton.timed().isPresent());

    return allElementsCondition;
  }
  public List<AdvancedApplicationProperty> getApplicationProperties() {
    final List<AdvancedApplicationProperty> applicationProperties = Lists.newArrayList();

    final List<PageElement> rows =
        advancedPropertiesTable.findAll(By.cssSelector(".aui-restfultable-row"));
    for (final PageElement row : rows) {
      applicationProperties.add(
          createApplicationPropertyFromRow(
              By.cssSelector("tr[data-row-key='" + row.getAttribute("data-row-key") + "']")));
    }

    return applicationProperties;
  }
Ejemplo n.º 8
0
 private Iterable<Workflow> parseWorkflowTable(PageElement table, final WorkflowStatus status) {
   if (!table.isPresent()) {
     return Collections.emptyList();
   }
   final List<PageElement> rows = table.findAll(By.cssSelector("tbody tr"));
   return transform(
       rows,
       new Function<PageElement, Workflow>() {
         @Override
         public Workflow apply(PageElement input) {
           List<PageElement> columns = input.findAll(By.tagName("td"));
           return new Workflow(columns, status);
         }
       });
 }
Ejemplo n.º 9
0
  public EditUserDetailsPage setUserAsInactive() {
    if (getIsActiveUser()) {
      activeUser.click();
    }

    return this;
  }
Ejemplo n.º 10
0
  public EditUserDetailsPage setUserAsActive() {
    if (!getIsActiveUser()) {
      activeUser.select();
    }

    return this;
  }
Ejemplo n.º 11
0
  public EditIssueTypePage setAvatar(final String id) {
    avatarPickerTrigger.click();
    final AvatarDialog avatarDialog = binder.bind(AvatarDialog.class, "project-avatar-picker");
    avatarDialog.setAvatar(id);

    return this;
  }
Ejemplo n.º 12
0
  public List<String> getProjects() {
    openDialog();

    String href = getTriggerElement().getAttribute("href");
    int triggerTargetStart = href.indexOf("#");

    String dialogId = "inline-dialog-" + href.substring(triggerTargetStart + 1);

    PageElement dialog = elementFinder.find(By.id(dialogId));
    assertTrue("The dialog did not appear to open.", dialog.isPresent());

    List<PageElement> elements = dialog.findAll(By.tagName("li"));
    List<String> projects = new ArrayList<String>(elements.size());
    for (PageElement element : elements) {
      projects.add(element.getText());
    }

    closeDialog();

    return projects;
  }
 @Init
 public void init() {
   formElement = locator.find(formLocator);
   nameElement = formElement.find(By.name("name"));
   descriptionElement = formElement.find(By.name("description"));
   addButton = formElement.find(By.name("Add"));
   issueTypeRadio = formElement.find(By.cssSelector("input.radio[value='']"));
   subtaskRadio = formElement.find(By.cssSelector("input.radio[value='jira_subtask']"));
   cancelLink = formElement.find(By.cssSelector("a.cancel"));
   iconPicker = pageBinder.bind(IconPicker.class, "issue-type-icon-picker");
 }
Ejemplo n.º 14
0
    public Workflow(List<PageElement> columns, WorkflowStatus status) {
      if (columns == null || columns.size() < 5) {
        throw new IllegalArgumentException("Not valid workflow row");
      }
      final PageElement nameElement = columns.get(0);
      name = nameElement.find(By.tagName("strong")).getText();
      description = nameElement.find(By.className("secondary-text")).getText();
      boolean isDraft = nameElement.find(By.tagName("img")).isPresent();
      numberOfSteps = Integer.parseInt(columns.get(3).getText());
      this.status = isDraft ? WorkflowStatus.DRAFT : status;

      final PageElement operationsElements = columns.get(4);
      copyElement = operationsElements.find(By.id(String.format("copy_%s", name)));
    }
Ejemplo n.º 15
0
 public CopyWorkflowDialog openCopyDialog() {
   assertTrue("The workflow does not have a copy operation.", hasCopyOperation());
   copyElement.click();
   return pageBinder.bind(CopyWorkflowDialog.class, getName());
 }
Ejemplo n.º 16
0
 public boolean hasCopyOperation() {
   return copyElement.isPresent();
 }
Ejemplo n.º 17
0
 private void toggleModule(PageElement element) {
   element.find(By.tagName("h3")).click();
 }
 /**
  * Clicks the specified operation in the drop down.
  *
  * @param operation the link text to click
  */
 public void click(final String operation) {
   rootMenuElement.find(By.linkText(operation)).click();
 }
Ejemplo n.º 19
0
 private boolean isModuleOpen(PageElement moduleElement) {
   return moduleElement.isPresent() && !moduleElement.hasClass("collapsed");
 }
Ejemplo n.º 20
0
 public ViewUserPage cancelUpdatePassword() {
   cancel.click();
   return pageBinder.bind(ViewUserPage.class, username);
 }
 boolean isSubtasksEnabled() {
   return issueTypeRadio.isPresent() && subtaskRadio.isPresent();
 }
Ejemplo n.º 22
0
 public EditUserPasswordPage fillPasswordFields(String newPassword) {
   password.clear().type(newPassword);
   confirm.clear().type(newPassword);
   return this;
 }
Ejemplo n.º 23
0
 public ViewUserPage updatePassword() {
   update.click();
   return pageBinder.bind(ViewUserPage.class, username);
 }
Ejemplo n.º 24
0
 @Override
 public TimedCondition isAt() {
   return update.timed().isPresent();
 }
 /**
  * Checks if the drop down has the specified operation
  *
  * @param operation the link text used to check for operation existence, e.g. "Edit Details"
  * @return true, if a link with the specified link text exists
  */
 public boolean hasOperation(final String operation) {
   PageElement menuItem = rootMenuElement.find(By.linkText(operation));
   return menuItem.isPresent() && menuItem.isVisible();
 }
 /** Closes the drop down by pressing esc. */
 public void close() {
   rootMenuElement.type(Keys.ESCAPE.toString());
 }
Ejemplo n.º 27
0
 @Override
 public TimedCondition isAt() {
   return Conditions.and(header.timed().isPresent(), addWorkflowLink.timed().isPresent());
 }
 @Override
 public <T> T cancel(Class<T> expectedPage, Object... args) {
   cancelLink.click();
   return binder.bind(expectedPage, args);
 }
Ejemplo n.º 29
0
 public AddWorkflowDialog openAddWorkflowDialog() {
   addWorkflowLink.click();
   return pageBinder.bind(AddWorkflowDialog.class);
 }
 public DeleteOperation clickDelete() {
   rootMenuElement.find(By.className("project-config-operations-delete")).click();
   return binder.bind(DeleteOperation.class, id);
 }