diff --git a/core/misc/dialog/dialog.position.js b/core/misc/dialog/dialog.position.js
index e3c058f..c5cf60e 100644
--- a/core/misc/dialog/dialog.position.js
+++ b/core/misc/dialog/dialog.position.js
@@ -91,17 +91,7 @@
 
   $(window).on({
     'dialog:aftercreate': function (event, dialog, $element, settings) {
-      var autoResize = debounce(resetSize, 20);
-      var eventData = {settings: settings, $element: $element};
-      if (settings.autoResize === true || settings.autoResize === 'true') {
-        $element
-          .dialog('option', {resizable: false, draggable: false})
-          .dialog('widget').css('position', 'fixed');
-        $(window)
-          .on('resize.dialogResize scroll.dialogResize', eventData, autoResize)
-          .trigger('resize.dialogResize');
-        $(document).on('drupalViewportOffsetChange.dialogResize', eventData, autoResize);
-      }
+
     },
     'dialog:beforeclose': function (event, dialog, $element) {
       $(window).off('.dialogResize');
diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php
index e48487a..fdeeeb3 100644
--- a/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php
+++ b/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php
@@ -48,21 +48,31 @@ public function testFilterCriteriaDialog() {
     $add_link = $page->findById('views-rearrange-filter');
     $this->assertTrue($add_link->isVisible(), 'And/Or Rearrange button found.');
     $add_link->click();
-    $assert_session->assertWaitOnAjaxRequest();
 
     // Add a new filter group.
-    $create_new_filter_group = $page->findById('views-add-group-link');
+    $create_new_filter_group = $assert_session->waitForElementVisible('css', '#views-add-group-link');
     $this->assertTrue($create_new_filter_group->isVisible(), 'Add group link found.');
     $create_new_filter_group->click();
     $assert_session->assertWaitOnAjaxRequest();
 
+
+    $page->findById('views-add-group-link')->click();
     // Assert the existence of the new filter group by checking the remove group
     // link.
-    $remove_link = $page->findLink('Remove group');
+    $remove_link = $assert_session->waitForElementVisible('css', '.views-remove-group-link');
+
+    // The call to assertWaitOnAjaxRequest is required in this case because this
+    // will make the test wait on the additional javascript files loaded in the
+    // triggered ajax call.
+    $assert_session->assertWaitOnAjaxRequest();
+
     $this->assertTrue($remove_link->isVisible(), 'New group found.');
 
     // Remove the group again and assert the group is not present anymore.
     $remove_link->click();
+
+    // Use assertWaitOnAjaxRequest because the we cannot use the waitFor..
+    // methods to check something is not there.
     $assert_session->assertWaitOnAjaxRequest();
     $remove_link = $page->findLink('Remove group');
     $this->assertEmpty($remove_link, 'Remove button not available');
diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh
index 9e832a5..f9bab4d 100755
--- a/core/scripts/run-tests.sh
+++ b/core/scripts/run-tests.sh
@@ -142,6 +142,14 @@
 
 $test_list = simpletest_script_get_test_list();
 
+if (in_array('Drupal\Tests\views_ui\FunctionalJavascript\FilterCriteriaTest', $test_list)) {
+  // Do the quick test, try 20 times.
+  $test_list = array_fill(0, 20, 'Drupal\Tests\views_ui\FunctionalJavascript\FilterCriteriaTest');
+}
+else {
+  $test_list = [];
+}
+
 // Try to allocate unlimited time to run the tests.
 drupal_set_time_limit(0);
 simpletest_script_reporter_init();
