public boolean hasOneUnlinkedCharlieText() { PageElement availableEntitiesMessage = elementFinder.find(By.id("available-entities-msg")); Poller.waitUntil(availableEntitiesMessage.timed().getText(), Matchers.containsString("There is one un-linked 'Charlie' available for this user.")); return true; }
/** * Sets a new parent page in the advanced tab */ public MovePageDialog setNewParentPage(final String newParentPage) { waitUntilTrue("Input element visible", newParentPageInput.timed().isVisible()); newParentPageInput.type(newParentPage); driver.executeScript("AJS.$('#" + newParentPageId + "').blur()"); waitUntil("Breadcrumb should be updated to " + newParentPage, getBreadCrumbText(), containsString(newParentPage)); return this; }
/** * Wait for the TinyMCE editor in the comments section to be ready, as we'd get JS errors otherwise if we try to * insert text too early. */ @WaitUntil public void waitForTinyMCE() { waitUntil("waiting for AJS.Rte.BootstrapManager.isInitComplete()", jsQueryFactory.forBooleanJavascript( "return AJS && AJS.Rte && AJS.Rte.BootstrapManager && AJS.Rte.BootstrapManager.isInitComplete()"), is(true), by(timeouts.timeoutFor(TimeoutType.SLOW_PAGE_LOAD))); Poller.waitUntilFalse("waiting for editor container to be visible", loadingContainerVisibleCondition()); }
public void waitToFinish() { Poller.waitUntil("Setup hasn't finished.", submitButton.timed().isVisible(), is(true), Poller.by(5, TimeUnit.MINUTES)); } }
public void typeAndSetNewParentPage(final String newParentPage) { Poller.waitUntilTrue(newParentPageInput.timed().isVisible()); newParentPageInput.clear(); newParentPageInput.type(newParentPage); waitUntilTrue(newParentPageDropDown.timed().isVisible()); // Using WebDriver in Chrome, if there is an error message in the dialog, clicking on the dropdown won't work. We need to send keys to the // input field in order to select the space from the dropdown. WebElement newPageInputWebElement = driver.findElement(By.id(newParentPageInput.getAttribute("id"))); newPageInputWebElement.sendKeys(Keys.DOWN); newPageInputWebElement.sendKeys(Keys.ENTER); waitUntil(getBreadCrumbText(), containsString(newParentPage)); }
public BlueprintAddSpaceForm appendToNameAndWaitForValidation(final CharSequence extraText, final CharSequence expectedKey) { appendToName(extraText); // wait for the page load time to be bigger. Poller.waitUntil(Conditions.forSupplier(() -> expectedKey.equals(getKey()) && expectedKey.equals(spaceKey.getAttribute("data-validated-value")) && extraText.equals(name.getAttribute("data-validated-value"))), is(true), by(30, TimeUnit.SECONDS)); return this; }
@SuppressWarnings("OptionalGetWithoutIsPresent") private DropDownItem getAction(String action) { waitUntil(action + " action not present", getActions(), hasItem(hasAction(action))); return toStream(getActions().now()).filter(DropDownItem.hasAction(action)).findFirst().get(); }
public void confirm() { Poller.waitUntil("Projects have not been created within some time.", submit.timed().isEnabled(), is(true), by(30, TimeUnit.SECONDS)); submit.click(); }
@WaitUntil public void waitForFooter() { waitUntil("Timed out waiting for footer", body.find(By.id("footer")).timed().isPresent(), is(true), Poller.by(10, TimeUnit.SECONDS)); } }
public ApplicationSetupPage submit() { submitButton.click(); //waiting for plugin system to restart Poller.waitUntil(isAt(), is(false), Poller.by(5, MINUTES)); return pageBinder.bind(ApplicationSetupPage.class); }
protected void waitWhileSubmitting() { final TimedCondition timedCondition = loading.timed().hasClass(FORM_SUBMITTING_CLASS); Poller.waitUntil(timedCondition, Matchers.is(false),by(timeouts.timeoutFor(TimeoutType.AJAX_ACTION))); }
@WaitUntil public void waitUntilSummaryTableLoaded() { waitUntil("Couldn't load summary table in time", summaryTable.timed().hasText("Generating page properties report"), Matchers.is(FALSE), by(10000)); }
public void approvePullRequest() { approveButton.click(); try { Poller.waitUntil(approveButton.timed().hasText("Approve"), is(false), by(15000)); } catch (AssertionError e) { // we will continue in hope that Bitbucket did its job } }
public void declinePullRequest() { rejectButton.click(); DeclinePullRequestDialog declinePullRequestDialog = elementFinder.find(By.id("bb-reject-pullrequest-dialog"), DeclinePullRequestDialog.class); declinePullRequestDialog.decline("Test decline reason"); try { Poller.waitUntil(declinePullRequestDialog.timed().isPresent(), is(false), by(15000)); } catch (AssertionError e) { // ignoring time out, Bitbucket probably didn't close the dialog } }
public static List<PageElement> findAll(String timeoutMessage, By by, PageElementFinder elementFinder) { Poller.waitUntil( timeoutMessage, elementFinder.find(by).timed().isPresent(), is(true), Poller.by(20000)); return elementFinder.findAll(by); } }
public void waitUntilAccessHasBeenGrantedSuccessfully() { waitUntil( pageElementFinder.find(By.cssSelector(".aui-flag .aui-message-success")).timed().isVisible(), is(true), by(3, TimeUnit.SECONDS) ); waitUntil( pageElementFinder.find(By.cssSelector(".grant-access-dialog")).timed().isVisible(), is(false), by(1, TimeUnit.SECONDS) ); }
@WaitUntil public void doWaitUntilTinyMceIsInit() { this.editor = pageBinder.bind(Editor.class); waitUntil(getCollaborativeEditorStatus(), isOneOf("off", "failed", "on", "connected", "fake"), by(LONG_WAIT)); if ("failed".equals(getCollaborativeEditorStatus().now())) { executor.executeScript("AJS.trigger('synchrony.connected.fake');"); waitUntil("Waiting for fake collaborative editor to become active.", getCollaborativeEditorStatus(), is("fake"), by(LONG_WAIT)); } if (!"off".equals(getCollaborativeEditorStatus().now())) { statusIndicator = pageBinder.bind(StatusIndicator.class); } }
public void addReply(final String comment) { int originalCommentCount = getNumberOfReply(); this.typeComment(comment); saveButton.click(); waitUntilEditorClose(); waitUntil(Queries.forSupplier(timeouts, () -> getNumberOfReply()), is(originalCommentCount + 1)); }
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; } }
public ViewPage goToIndexPageAndCheckContent(Space space, String expectedIndexPageTitle, Content... expectedListedPages) { Content indexPage = getIndexPage(space, expectedIndexPageTitle); ViewPage indexPageView = product.viewPage(indexPage); assertThat("Incorrect index page title", indexPageView.getTitle(), is(expectedIndexPageTitle)); waitUntil("Index page content did not contain expected page titles", indexPageView.getMainContent().timed().getText(), listedPageTitlesMatcher(expectedListedPages)); return indexPageView; }