function JSWebAssert::waitForText
Same name in other branches
- 8.9.x core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php \Drupal\FunctionalJavascriptTests\JSWebAssert::waitForText()
- 10 core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php \Drupal\FunctionalJavascriptTests\JSWebAssert::waitForText()
- 11.x core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php \Drupal\FunctionalJavascriptTests\JSWebAssert::waitForText()
Waits for the specified text and returns TRUE when it is available.
Parameters
string $text: The text to wait for.
int $timeout: (Optional) Timeout in milliseconds, defaults to 10000.
Return value
bool TRUE if found, FALSE if not found.
File
-
core/
tests/ Drupal/ FunctionalJavascriptTests/ JSWebAssert.php, line 138
Class
- JSWebAssert
- Defines a class with methods for asserting presence of elements during tests.
Namespace
Drupal\FunctionalJavascriptTestsCode
public function waitForText($text, $timeout = 10000) {
return (bool) $this->waitForHelper($timeout, function (Element $page) use ($text) {
$actual = preg_replace('/\\s+/u', ' ', $page->getText());
$regex = '/' . preg_quote($text, '/') . '/ui';
return (bool) preg_match($regex, $actual);
});
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.