diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php
index e51f3e8..2958633 100644
--- a/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php
+++ b/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php
@@ -53,17 +53,15 @@ 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.');
+    // Wait 500ms just for kicks - maybe the link is visible but the JS behavior
+    // for it has not been attached yet?
+    $this->getSession()->wait(500);
     $create_new_filter_group->click();
     $assert_session->assertWaitOnAjaxRequest();
 
     // Assert the existence of the new filter group by checking the remove group
     // link.
     $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 the group is not present anymore.
