You are here

protected function JavascriptTestTrait::assertJsCondition in Commerce Core 8.2

Waits for the given time or until the given JS condition becomes TRUE.

Parameters

string $condition: JS condition to wait until it becomes TRUE.

int $timeout: (Optional) Timeout in milliseconds, defaults to 1000.

string $message: (optional) A message to display with the assertion. If left blank, a default message will be displayed.

See also

\Behat\Mink\Driver\DriverInterface::evaluateScript()

1 call to JavascriptTestTrait::assertJsCondition()
JavascriptTestTrait::waitForAjaxToFinish in tests/src/Traits/JavascriptTestTrait.php
Waits for jQuery to become active and animations to complete.

File

tests/src/Traits/JavascriptTestTrait.php, line 47

Class

JavascriptTestTrait
Allows tests using BrowserTest run with Javascript enabled.

Namespace

Drupal\Tests\commerce\Traits

Code

protected function assertJsCondition($condition, $timeout = 1000, $message = '') {
  $message = $message ?: "Javascript condition met:\n" . $condition;
  $result = $this
    ->getSession()
    ->getDriver()
    ->wait($timeout, $condition);
  $this
    ->assertNotEmpty($result, $message);
}