diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php index 1a31d69..e51f3e8 100644 --- a/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php @@ -53,14 +53,21 @@ public function testFilterCriteriaDialog() { // Add a new filter group. $create_new_filter_group = $page->findById('views-add-group-link'); $this->assertTrue($create_new_filter_group->isVisible(), 'Add group link found.'); - $this->clickLink('Create new filter group'); + $create_new_filter_group->click(); + $assert_session->assertWaitOnAjaxRequest(); // Assert the existence of the new filter group by checking the remove group // link. - $this->assertJsCondition('jQuery("a:contains(\'Remove group\')").is(":visible")'); + $remove_link = $page->findLink('Remove group'); + while (!$remove_link) { + $create_new_filter_group->click(); + $assert_session->assertWaitOnAjaxRequest(); + $remove_link = $page->findLink('Remove group'); + } + $this->assertTrue($remove_link->isVisible(), 'New group found.'); - // Remove the group again and assert that the group is not present anymore. - $this->clickLink('Remove group'); + // Remove the group again and assert the group is not present anymore. + $remove_link->click(); $assert_session->assertWaitOnAjaxRequest(); $remove_link = $page->findLink('Remove group'); $this->assertEmpty($remove_link, 'Remove button not available'); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php index 63ffde1..d5156ee 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php @@ -99,7 +99,7 @@ protected function assertElementNotVisible($css_selector, $message = '') { * @param string $condition * JS condition to wait until it becomes TRUE. * @param int $timeout - * (Optional) Timeout in milliseconds, defaults to 100,000 (100 seconds). + * (Optional) Timeout in milliseconds, defaults to 10000. * @param string $message * (optional) A message to display with the assertion. If left blank, a * default message will be displayed. @@ -108,12 +108,9 @@ protected function assertElementNotVisible($css_selector, $message = '') { * * @see \Behat\Mink\Driver\DriverInterface::evaluateScript() */ - protected function assertJsCondition($condition, $timeout = 100000, $message = '') { + protected function assertJsCondition($condition, $timeout = 10000, $message = '') { $message = $message ?: "Javascript condition met:\n" . $condition; - $start = microtime(TRUE); $result = $this->getSession()->getDriver()->wait($timeout, $condition); - $time = microtime(TRUE) - $start; - $message .= "\nwait seconds: $time"; $this->assertTrue($result, $message); }