You are here

protected function AwaitTrait::awaitAjax in Lightning Core 8

Same name and namespace in other branches
  1. 8.5 tests/contexts/AwaitTrait.inc \Acquia\LightningExtension\Context\AwaitTrait::awaitAjax()
  2. 8.2 tests/contexts/AwaitTrait.inc \Acquia\LightningExtension\Context\AwaitTrait::awaitAjax()
  3. 8.3 tests/contexts/AwaitTrait.inc \Acquia\LightningExtension\Context\AwaitTrait::awaitAjax()
  4. 8.4 tests/contexts/AwaitTrait.inc \Acquia\LightningExtension\Context\AwaitTrait::awaitAjax()

Waits for AJAX to finish.

If the Mink context is unavailable, or the current driver does not support waiting for a JavaScript condition, waits $timeout seconds and returns.

Parameters

int $timeout: (optional) How many seconds to wait.

1 call to AwaitTrait::awaitAjax()
ViewsContext::applyExposedFilters in tests/contexts/ViewsContext.behat.inc
Submits exposed Views filters.

File

tests/contexts/AwaitTrait.inc, line 54

Class

AwaitTrait

Namespace

Acquia\LightningExtension\Context

Code

protected function awaitAjax($timeout = 10) {

  /** @var MinkContext $context */
  $context = $this
    ->getContext(MinkContext::class);
  if ($context) {
    try {
      return $context
        ->iWaitForAjaxToFinish();
    } catch (UnsupportedDriverActionException $e) {

      // Fall through to sleep().
    }
  }
  sleep($timeout);
}