Skip to main content

Waits

DrevOps\BehatSteps\Steps\Web\WaitTrait - Source, Example, Helpers

Wait for a period of time or for AJAX to finish.

  • Wait a fixed number of seconds.
  • Wait for jQuery and Drupal AJAX activity to settle, on demand or around every step that navigates or submits.

    A wait on jQuery.active alone misses Drupal.ajax updates, so an assertion following a click can read the page before the update applies. The wait here watches both, and a page without Drupal takes the jQuery check alone.

    Skip the automatic waits with tag: @behat-steps-skip:WaitTrait.

Options​

OptionTypeDefaultTagDescription
wait.enabledbooleanTRUE@behat-steps-skip:WaitTraitWait for AJAX around every navigating or submitting step of a @javascript scenario.
wait.ajax_timeoutinteger5-Maximum time, in seconds, to wait for AJAX calls to complete.

Steps​

@When I wait for AJAX to finish

Wait for the AJAX calls to finish, using the configured timeout

When I wait for AJAX to finish
@When I wait for :seconds second(s)

Wait for a specified number of seconds

When I wait for 5 seconds
When I wait for 1 second
@When I wait for :seconds second(s) for AJAX to finish

Wait for the AJAX calls to finish

When I wait for 5 seconds for AJAX to finish
When I wait for 1 second for AJAX to finish