diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php b/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php index 94a9108..ae67c52 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php @@ -26,7 +26,21 @@ class JSWebAssert extends WebAssert { * be displayed. */ public function assertWaitOnAjaxRequest($timeout = 10000, $message = 'Unable to complete AJAX request.') { - $result = $this->session->wait($timeout, '(typeof(jQuery)=="undefined" || (0 === jQuery.active && 0 === jQuery(\':animated\').length))'); + $condition = <<session->wait($timeout, $condition); if (!$result) { throw new \RuntimeException($message); } @@ -38,9 +52,9 @@ public function assertWaitOnAjaxRequest($timeout = 10000, $message = 'Unable to * @see https://api.jqueryui.com/autocomplete/#option-delay */ public function waitOnAutocomplete() { - // Drupal is using the default delay value of 300 milliseconds. - $this->session->wait(300); - $this->assertWaitOnAjaxRequest(); + // Wait for the autocomplete to be visible. + $condition = "(jQuery('.ui-autocomplete:visible li').length > 0)"; + return $this->session->wait(10000, $condition); } /**