You are here

protected function AwaitTrait::awaitAjax in Lightning Core 8.3

Same name and namespace in other branches
  1. 8.5 tests/contexts/AwaitTrait.inc \Acquia\LightningExtension\Context\AwaitTrait::awaitAjax()
  2. 8 tests/contexts/AwaitTrait.inc \Acquia\LightningExtension\Context\AwaitTrait::awaitAjax()
  3. 8.2 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 61

Class

AwaitTrait
@internal This is an internal part of Lightning Core's testing system and may be changed or removed at any time without warning. It should not be extended, instantiated, or used in any way by external code! If you need to use this functionality,…

Namespace

Acquia\LightningExtension\Context

Code

protected function awaitAjax($timeout = 10) {

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

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