diff --git a/composer.lock b/composer.lock
index 486675c..3ddcf38 100644
--- a/composer.lock
+++ b/composer.lock
@@ -3149,30 +3149,27 @@
         },
         {
             "name": "jcalderonzumba/mink-phantomjs-driver",
-            "version": "v0.3.1",
+            "version": "v0.3.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/jcalderonzumba/MinkPhantomJSDriver.git",
-                "reference": "782892dbea4af7d04024374672b3790b6c008def"
+                "reference": "008f43670e94acd39273d15add1e7348eb23848d"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/jcalderonzumba/MinkPhantomJSDriver/zipball/782892dbea4af7d04024374672b3790b6c008def",
-                "reference": "782892dbea4af7d04024374672b3790b6c008def",
+                "url": "https://packagist.phpcomposer.com/files/jcalderonzumba/MinkPhantomJSDriver/008f43670e94acd39273d15add1e7348eb23848d.zip",
+                "reference": "008f43670e94acd39273d15add1e7348eb23848d",
                 "shasum": ""
             },
             "require": {
-                "behat/mink": "~1.6",
+                "behat/mink": "~1.7",
                 "jcalderonzumba/gastonjs": "~1.0",
                 "php": ">=5.4",
                 "twig/twig": "~1.20|~2.0"
             },
             "require-dev": {
-                "phpunit/phpunit": "~4.6",
-                "silex/silex": "~1.2",
-                "symfony/css-selector": "~2.1",
-                "symfony/phpunit-bridge": "~2.7",
-                "symfony/process": "~2.3"
+                "mink/driver-testsuite": "dev-master",
+                "phpunit/phpunit": "~4.6"
             },
             "type": "mink-driver",
             "extra": {
@@ -3206,7 +3203,7 @@
                 "phantomjs",
                 "testing"
             ],
-            "time": "2015-12-04T13:55:02+00:00"
+            "time": "2016-12-01T10:57:30+00:00"
         },
         {
             "name": "mikey179/vfsStream",
diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php
index e48487a..d449e87 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->waitForId('views-add-group-link');
     $this->assertTrue($create_new_filter_group->isVisible(), 'Add group link found.');
     $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');
+    $remove_link = $assert_session->waitForElementVisible('named', array(
+      'link',
+      'Remove group'
+    ));
+
+    // 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..bd435e3 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 test 50 times.
+  $test_list = array_fill(0, 50, '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();
