/** * Waits for the occurrence of a trace with the given key and optionally test argument against given argumentPattern * @param tracer checkpoint. Only traces after this checkpoint will be inspected. * @param key tracer key to watch for * @param argumentPattern test argument of JIRA.trace call(after key argument) */ public void waitFor(final Tracer tracer, final String key, @Nullable final Pattern argumentPattern) { log.debug("Waiting for key " + key + " from position " + tracer.position + wrapArgumentPattern(argumentPattern)); waitUntilTrue(condition(tracer, key, argumentPattern)); }
@WaitUntil public void dialogReady() { Poller.waitUntilTrue(includeChildrenCheckbox.timed().isVisible()); Poller.waitUntilFalse(loading()); }
/** * 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 createBranch(String repository, String baseBranch, String branchName) { repositorySelect.select(Options.value(repository)); waitUntilTrue(branchSelect.timed().isEnabled()); branchSelect.select(Options.value(baseBranch)); this.branchNameField.clear().type(branchName); waitUntilTrue(createBranchButton.timed().isEnabled()); createBranchButton.click(); Poller.waitUntil(createBranchButton.timed().isPresent(), is(false), by(15, TimeUnit.SECONDS)); } }
public void sync() { rootElement.javascript().mouse().mouseover(); final PageElement syncIcon = getSyncIcon(); waitUntilTrue(syncIcon.timed().isPresent()); TimedQuery<Long> lastSync = Queries.forSupplier(timeouts, () -> NumberUtils.toLong(syncIcon.getAttribute("data-last-sync")), TimeoutType.SLOW_PAGE_LOAD); final long lastSyncBefore = lastSync.now(); syncIcon.javascript().mouse().click(); waitUntil(lastSync, greaterThan(lastSyncBefore)); waitUntilFalse(syncIcon.withTimeout(TimeoutType.SLOW_PAGE_LOAD).timed().hasClass("running")); }
/** * Waits until the last breadcrumb is exactly the specified title * * @param title the text that the last breadcrumb should match */ public void waitForLastBreadcrumb(final String title) { Poller.waitUntilTrue(isBreadcrumbsVisible()); Poller.waitUntilEquals(title, breadcrumbs.find(By.cssSelector("a.last")).timed().getText()); }
/** * 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; }
@Override protected void afterAuthenticate() { waitUntilFalse("Delete action did not complete within time frame", deleteButton.timed().isPresent()); } };
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; }
/** * Waits until the recently viewed panel has exactly the specified number of results * * @since 5.8.0 */ public void waitForRecentlyViewedResults(int numberResults) { waitUntilEquals("Expected " + numberResults + " results in recently viewed", numberResults, numberRecentlyViewedResults()); }
@WaitUntil public void doWait() { try { waitUntil(isHereTimed(), is(true), Poller.by(180, TimeUnit.SECONDS)); } catch (AssertionError e) { throw new PageBindingWaitException(format("Page failed to load at expected URL." + "\n\t\tExpected: %s\n\t\tActual: %s", getUrl(), removeStart(driver.getCurrentUrl(), getBaseURL())), this, e); } waitUntilTrue("Expected html tag to be present", elementFinder.find(By.tagName("html")).timed().isPresent()); }
@WaitUntil public void waitUntilLoggedOut() { Poller.waitUntilTrue(message.timed().isVisible()); Poller.waitUntilEquals("You have been successfully logged out.", message.timed().getText()); } }
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 ViewIssuePage cancel() { cancel.click(); waitUntilFalse(commentForm.timed().isPresent()); waitUntilFalse(comment.timed().isPresent()); return parent; }
private static void typeInto(PageElement inputField, String value) { // getting rid of all race conditions inputField.click(); inputField.clear(); waitUntilEquals("", inputField.timed().getValue()); inputField.type(value); waitUntilEquals(value, inputField.timed().getValue()); } }
/** * Adds an item by typing it in and picking the first suggestion. Assumes that the item passed in * will be used as the lozenge label * * @param item the item to add */ public void add(final String item) { addNotWait(item); waitUntilTrue("Expected item " + item + "to be added, but was not", hasItem(item)); }
@WaitUntil final public void ready() { waitUntilTrue(module.timed().isPresent()); waitUntilFalse(module.timed().hasClass("updating")); }
public void switchRenderer(MarkupRenderer renderer) { Poller.waitUntilTrue(isSelectionPanelPresent()); Poller.waitUntilTrue(isSelectionPanelVisible()); List<PageElement> options = selectionPanel.findAll(By.cssSelector("option")); for (PageElement option : options) { if (option.getText().equals(renderer.getRendererInputText())) { option.click(); break; } } Poller.waitUntilEquals(renderer.getRendererInputValue(), selectionPanel.timed().getValue()); }