private static ExpectedCondition<Boolean> requestIsFinished() { return new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver webDriver) { try { executeAsyncScript(getWaitForRequestToFinishScript()); return true; } catch (ScriptTimeoutException e) { return false; } } @Override public String toString() { return "wait for angular request to finish"; } }; }
@Override protected Object invoke(FixtureInteraction interaction, Method method, Object[] arguments) throws Throwable { Object result = super.invoke(interaction, method, arguments); if (shouldWaitForAjax()) { try { waitForJsfAjaxImpl(true); } catch (ScriptTimeoutException e) { if (ignoreImplicitAjaxWaitTimeouts) { // log message but do not throw System.err.println("Timeout while waiting for ajax call after: " + method.getName() + " with arguments: " + Arrays.toString(arguments)); String msg = createAjaxTimeoutMessage(e); System.err.println("Exception not forwarded to wiki: " + msg); } else { throw createAjaxTimeout(e); } } } return result; }
public void waitForJsfAjax() { try { waitForJsfAjaxImpl(false); } catch (ScriptTimeoutException e) { throw createAjaxTimeout(e); } }
protected AjaxTimeout createAjaxTimeout(ScriptTimeoutException e) { return new AjaxTimeout(createAjaxTimeoutMessage(e), e); }
protected String createAjaxTimeoutMessage(ScriptTimeoutException e) { String messageBase = "Did not detect completion of RichFaces ajax call: " + e.getMessage(); return getSlimFixtureExceptionMessage("timeouts", "rfAjaxTimeout", messageBase, e); }
public AjaxTimeout(String message, ScriptTimeoutException e) { super(false, message, e); }