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(); }
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; }
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(); } }
@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; }
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); } }); }
public EditUserDetailsPage setUserAsInactive() { if (getIsActiveUser()) { activeUser.click(); } return this; }
public EditUserDetailsPage setUserAsActive() { if (!getIsActiveUser()) { activeUser.select(); } return this; }
public EditIssueTypePage setAvatar(final String id) { avatarPickerTrigger.click(); final AvatarDialog avatarDialog = binder.bind(AvatarDialog.class, "project-avatar-picker"); avatarDialog.setAvatar(id); return this; }
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"); }
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))); }
public CopyWorkflowDialog openCopyDialog() { assertTrue("The workflow does not have a copy operation.", hasCopyOperation()); copyElement.click(); return pageBinder.bind(CopyWorkflowDialog.class, getName()); }
public boolean hasCopyOperation() { return copyElement.isPresent(); }
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(); }
private boolean isModuleOpen(PageElement moduleElement) { return moduleElement.isPresent() && !moduleElement.hasClass("collapsed"); }
public ViewUserPage cancelUpdatePassword() { cancel.click(); return pageBinder.bind(ViewUserPage.class, username); }
boolean isSubtasksEnabled() { return issueTypeRadio.isPresent() && subtaskRadio.isPresent(); }
public EditUserPasswordPage fillPasswordFields(String newPassword) { password.clear().type(newPassword); confirm.clear().type(newPassword); return this; }
public ViewUserPage updatePassword() { update.click(); return pageBinder.bind(ViewUserPage.class, username); }
@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()); }
@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); }
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); }