You are here

protected function StockWebDriverTestBase::assertJsCondition in Commerce Stock 8

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 StockWebDriverTestBase::assertJsCondition()
StockWebDriverTestBase::waitForAjaxToFinish in tests/src/FunctionalJavascript/StockWebDriverTestBase.php
Waits for jQuery to become active and animations to complete.

File

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

Class

StockWebDriverTestBase
Defines base class for commerce stock test cases.

Namespace

Drupal\Tests\commerce_stock\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);
}