You are here

protected function CommerceWebDriverTestBase::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.

Overrides WebDriverTestBase::assertJsCondition

See also

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

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

File

tests/src/FunctionalJavascript/CommerceWebDriverTestBase.php, line 166

Class

CommerceWebDriverTestBase
Provides a base class for Commerce functional tests.

Namespace

Drupal\Tests\commerce\FunctionalJavascript

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);
}