function WebDriverTestBase::assertJsCondition
Same name in other branches
- 9 core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php \Drupal\FunctionalJavascriptTests\WebDriverTestBase::assertJsCondition()
- 8.9.x core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php \Drupal\FunctionalJavascriptTests\WebDriverTestBase::assertJsCondition()
- 11.x core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php \Drupal\FunctionalJavascriptTests\WebDriverTestBase::assertJsCondition()
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 10000.
string $message: (optional) A message to display with the assertion. If left blank, a default message will be displayed.
Throws
\PHPUnit\Framework\AssertionFailedError
See also
\Behat\Mink\Driver\DriverInterface::evaluateScript()
27 calls to WebDriverTestBase::assertJsCondition()
- AdminAjaxTest::testBodyScroll in core/
modules/ views_ui/ tests/ src/ FunctionalJavascript/ AdminAjaxTest.php - Tests body scroll.
- BigPipeRegressionTest::doTestPlaceholderInParagraph_2802923 in core/
modules/ big_pipe/ tests/ src/ FunctionalJavascript/ BigPipeRegressionTest.php - Ensure default BigPipe placeholder HTML cannot split paragraphs.
- BigPipeRegressionTest::testMultipleClosingBodies_2678662 in core/
modules/ big_pipe/ tests/ src/ FunctionalJavascript/ BigPipeRegressionTest.php - Ensure BigPipe works despite inline JS containing the string "</body>".
- BookJavascriptTest::testBookOrdering in core/
modules/ book/ tests/ src/ FunctionalJavascript/ BookJavascriptTest.php - Tests re-ordering of books.
- BrowserWithJavascriptTest::testAssertJsCondition in core/
tests/ Drupal/ FunctionalJavascriptTests/ BrowserWithJavascriptTest.php
File
-
core/
tests/ Drupal/ FunctionalJavascriptTests/ WebDriverTestBase.php, line 183
Class
- WebDriverTestBase
- Runs a browser test using a driver that supports JavaScript.
Namespace
Drupal\FunctionalJavascriptTestsCode
protected function assertJsCondition($condition, $timeout = 10000, $message = '') {
$message = $message ?: "JavaScript condition met:\n" . $condition;
$result = $this->getSession()
->getDriver()
->wait($timeout, $condition);
$this->assertTrue($result, $message);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.