@Override public boolean matchesSafely(PageElement element) { return element.hasAttribute(attribute, value); }
@Override public boolean apply(PageElement input) { return input.hasAttribute("data-" + attribute, value); } };
/** * @return true if the link is linking to a resource in confluence. */ public boolean isInternalLink() { return execute.onTinyMceIFrame(() -> linkElement.hasAttribute("data-linked-resource-type", "page") || linkElement.hasAttribute("data-linked-resource-type", "space") || linkElement.hasAttribute("data-linked-resource-type", "userinfo") || linkElement.hasAttribute("data-linked-resource-type", "attachment") || linkElement.hasAttribute("data-linked-resource-type", "blogpost")); }
public boolean apply(@Nullable PageElement input) { return input.hasAttribute("style", "display: block"); } });
private boolean isWatcher(List<PageElement> watchers, User user) { for (PageElement watcher : watchers) { if (watcher.hasAttribute("data-username", user.getUsername())) return true; } return false; }
public boolean isDefault() { return getDefaultInput().hasAttribute("checked", Boolean.TRUE.toString()); }
public boolean isPromoted(ItContentBlueprint blueprint) { return getPromoteOrDemoteLink(blueprint).hasAttribute("data-promoted", "true"); }
public boolean isModal() { return getDialog().hasAttribute(MODAL_ATTRIBUTE, "true"); }
private SpaceTemplatesPage togglePromoteUserTemplate(Long id, boolean promote) { By selector = getPromoteOrDemoteLinkSelector(id); PageElement link = getUserTemplateTable().find(selector); if (link.hasAttribute("data-promoted", "true") && !promote) link.click(); else if (link.hasAttribute("data-promoted", "false") && promote) link.click(); return pageBinder.bind(this.getClass(), space); }
private BlueprintSpaceTemplatesPage togglePromoteUserTemplate(Long id, boolean promote) { By selector = getPromoteOrDemoteLinkSelector(id); PageElement link = getUserTemplateTable().find(selector); if (link.hasAttribute("data-promoted", "true") && !promote) link.click(); else if (link.hasAttribute("data-promoted", "false") && promote) link.click(); return pageBinder.bind(this.getClass(), space); }
public boolean isPromoted(long templateId) { By selector = getPromoteOrDemoteLinkSelector(templateId); PageElement link = getUserTemplateTable().find(selector); return link.hasAttribute("data-promoted", "true"); }
public boolean isPromoted(long templateId) { By selector = getPromoteOrDemoteLinkSelector(templateId); PageElement link = getUserTemplateTable().find(selector); return link.hasAttribute("data-promoted", "true"); }
public List<String> getEnabledDefaultOptions() { final List<PageElement> options = defaultOptionElement.findAll(By.tagName("option")); final List<String> types = Lists.newArrayList(); for (PageElement option : options) { final String value = option.getValue(); if (StringUtils.isNotBlank(value)) { if (!option.hasAttribute("disabled", "true")) { types.add(StringUtils.trimToEmpty(option.getText())); } } } return types; }
/** * As of Confluence 5.9.0, the this macro loads its resources asynchronously and so may not be ready immediately. * We detect that and wait if needed. */ private void waitForJsBindingsIfNeeded() { if (updatesPanel.hasAttribute("data-ready-for-interaction", "false")) waiter.until().element(By.cssSelector("#recent-updates[data-ready-for-interaction=true]")).exists().execute(); }
public List<IssueType> getIssueTypes() { List<IssueType> types = Lists.newArrayList(); final List<PageElement> rows = issueTypesTable.findAll(By.cssSelector("tbody tr")); for (PageElement row : rows) { final List<PageElement> all = row.findAll(By.tagName("td")); assertTrue("Not enough columns in the table.", all.size() >= 2); final PageElement nameElement = all.get(0); final PageElement img = nameElement.find(By.tagName("img")); String name = StringUtils.trimToNull(nameElement.find(By.cssSelector("[data-issue-type-field=name]")).getText()); String iconUrl = img == null ? null : img.getAttribute("src"); String description = StringUtils.trimToNull(all.get(0).find(By.cssSelector("div.description")).getText()); boolean subtask = all.get(1).hasAttribute("data-type", "subtask"); types.add(new IssueType(name, description, subtask, AvatarId.fromImageLink(iconUrl))); } return types; }
public <T> T promote(ItContentBlueprint blueprint, Class<T> templatePage, Space space) { PageElement promoteOrDemoteLink = getPromoteOrDemoteLink(blueprint); if (promoteOrDemoteLink.hasAttribute(DATA_PROMOTED, "false")) { promoteOrDemoteLink.click(); Poller.waitUntilTrue(promoteOrDemoteLink.timed().hasAttribute(DATA_PROMOTED, "true")); } return returnBoundPage(templatePage, space); }
public <T> T demote(final ItContentBlueprint blueprint, Class<T> templatePage, Space space) { PageElement promoteOrDemoteLink = getPromoteOrDemoteLink(blueprint); if (promoteOrDemoteLink.hasAttribute(DATA_PROMOTED, "true")) { promoteOrDemoteLink.click(); Poller.waitUntilTrue(promoteOrDemoteLink.timed().hasAttribute(DATA_PROMOTED, "false")); } return returnBoundPage(templatePage, space); }
public ViewPage clickAndCreatePage() { assertFalse(macroButton.hasAttribute("aria-disabled", "true")); // If the new page is successfully created, after the click the browser will go to *another* ViewPage that // has a different pageId. String currentPageId = parentPage.pageId.getAttribute("content"); macroButton.click(); Poller.waitUntilFalse(parentPage.pageId.timed().hasAttribute("content", currentPageId)); return pageBinder.bind(ViewPage.class); }
private <T extends DashboardEntitiesTab> T gotoTab(PageElement link, Class<T> tab, By tabSelector) { if (entitiesPanel.hasAttribute("data-ready-for-interaction", "false")) Poller.waitUntil("wait for global entities panel to load", pageElementFinder.find(By.cssSelector(".aui-tabs.global-entities")).withTimeout(TimeoutType.AJAX_ACTION).timed().hasAttribute("data-ready-for-interaction", "true"), is(true)); link.click(); final T tabPane = pageBinder.bind(tab); assertTrue(tabPane.isVisible()); Poller.waitUntil("wait for dashboard tab to load", pageElementFinder.find(tabSelector).withTimeout(TimeoutType.AJAX_ACTION).timed().hasClass("content-loaded"), is(true)); return tabPane; } }
@Override public void setLicense(String license) { List<PageElement> applicationItems = applicationList.findAll(By.className("application-item")); for (PageElement application : applicationItems) { if (application.hasAttribute("data-application-key", "jira-core")) { applicationCore = application; } } if (applicationCore != null) { applicationCore.find(By.className("license-string-truncated")).click(); PageElement licenseField = applicationCore.find(By.className("license-update-textarea")); setText(licenseField, license); } }