diff --git a/core/modules/file/src/Tests/FileFieldTestBase.php b/core/modules/file/src/Tests/FileFieldTestBase.php
index ba34c8f42b..12ab12390e 100644
--- a/core/modules/file/src/Tests/FileFieldTestBase.php
+++ b/core/modules/file/src/Tests/FileFieldTestBase.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\file\Tests;
 
+@trigger_error('The ' . __NAMESPACE__ . '\FileFieldTestBase is scheduled for removal in Drupal 9.0.0. Instead, use \Drupal\Tests\file\Functional\FileFieldTestBase', E_USER_DEPRECATED);
+
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\file\FileInterface;
diff --git a/core/modules/file/src/Tests/FileFieldValidateTest.php b/core/modules/file/src/Tests/FileFieldValidateTest.php
index be96f3c587..257f9c806b 100644
--- a/core/modules/file/src/Tests/FileFieldValidateTest.php
+++ b/core/modules/file/src/Tests/FileFieldValidateTest.php
@@ -2,10 +2,6 @@
 
 namespace Drupal\file\Tests;
 
-use Drupal\Core\Field\FieldStorageDefinitionInterface;
-use Drupal\field\Entity\FieldConfig;
-use Drupal\file\Entity\File;
-
 /**
  * Tests validation functions such as file type, max file size, max size per
  * node, and required.
@@ -14,179 +10,6 @@
  */
 class FileFieldValidateTest extends FileFieldTestBase {
 
-  /**
-   * Tests the required property on file fields.
-   */
-  public function testRequired() {
-    $node_storage = $this->container->get('entity.manager')->getStorage('node');
-    $type_name = 'article';
-    $field_name = strtolower($this->randomMachineName());
-    $storage = $this->createFileField($field_name, 'node', $type_name, [], ['required' => '1']);
-    $field = FieldConfig::loadByName('node', $type_name, $field_name);
-
-    $test_file = $this->getTestFile('text');
-
-    // Try to post a new node without uploading a file.
-    $edit = [];
-    $edit['title[0][value]'] = $this->randomMachineName();
-    $this->drupalPostForm('node/add/' . $type_name, $edit, t('Save'));
-    $this->assertRaw(t('@title field is required.', ['@title' => $field->getLabel()]), 'Node save failed when required file field was empty.');
-
-    // Create a new node with the uploaded file.
-    $nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
-    $this->assertTrue($nid !== FALSE, format_string('uploadNodeFile(@test_file, @field_name, @type_name) succeeded', ['@test_file' => $test_file->getFileUri(), '@field_name' => $field_name, '@type_name' => $type_name]));
-
-    $node_storage->resetCache([$nid]);
-    $node = $node_storage->load($nid);
-
-    $node_file = File::load($node->{$field_name}->target_id);
-    $this->assertFileExists($node_file, 'File exists after uploading to the required field.');
-    $this->assertFileEntryExists($node_file, 'File entry exists after uploading to the required field.');
-
-    // Try again with a multiple value field.
-    $storage->delete();
-    $this->createFileField($field_name, 'node', $type_name, ['cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED], ['required' => '1']);
-
-    // Try to post a new node without uploading a file in the multivalue field.
-    $edit = [];
-    $edit['title[0][value]'] = $this->randomMachineName();
-    $this->drupalPostForm('node/add/' . $type_name, $edit, t('Save'));
-    $this->assertRaw(t('@title field is required.', ['@title' => $field->getLabel()]), 'Node save failed when required multiple value file field was empty.');
-
-    // Create a new node with the uploaded file into the multivalue field.
-    $nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
-    $node_storage->resetCache([$nid]);
-    $node = $node_storage->load($nid);
-    $node_file = File::load($node->{$field_name}->target_id);
-    $this->assertFileExists($node_file, 'File exists after uploading to the required multiple value field.');
-    $this->assertFileEntryExists($node_file, 'File entry exists after uploading to the required multiple value field.');
-  }
-
-  /**
-   * Tests the max file size validator.
-   */
-  public function testFileMaxSize() {
-    $node_storage = $this->container->get('entity.manager')->getStorage('node');
-    $type_name = 'article';
-    $field_name = strtolower($this->randomMachineName());
-    $this->createFileField($field_name, 'node', $type_name, [], ['required' => '1']);
-
-    // 128KB.
-    $small_file = $this->getTestFile('text', 131072);
-    // 1.2MB
-    $large_file = $this->getTestFile('text', 1310720);
-
-    // Test uploading both a large and small file with different increments.
-    $sizes = [
-      '1M' => 1048576,
-      '1024K' => 1048576,
-      '1048576' => 1048576,
-    ];
-
-    foreach ($sizes as $max_filesize => $file_limit) {
-      // Set the max file upload size.
-      $this->updateFileField($field_name, $type_name, ['max_filesize' => $max_filesize]);
-
-      // Create a new node with the small file, which should pass.
-      $nid = $this->uploadNodeFile($small_file, $field_name, $type_name);
-      $node_storage->resetCache([$nid]);
-      $node = $node_storage->load($nid);
-      $node_file = File::load($node->{$field_name}->target_id);
-      $this->assertFileExists($node_file, format_string('File exists after uploading a file (%filesize) under the max limit (%maxsize).', ['%filesize' => format_size($small_file->getSize()), '%maxsize' => $max_filesize]));
-      $this->assertFileEntryExists($node_file, format_string('File entry exists after uploading a file (%filesize) under the max limit (%maxsize).', ['%filesize' => format_size($small_file->getSize()), '%maxsize' => $max_filesize]));
-
-      // Check that uploading the large file fails (1M limit).
-      $this->uploadNodeFile($large_file, $field_name, $type_name);
-      $error_message = t('The file is %filesize exceeding the maximum file size of %maxsize.', ['%filesize' => format_size($large_file->getSize()), '%maxsize' => format_size($file_limit)]);
-      $this->assertRaw($error_message, format_string('Node save failed when file (%filesize) exceeded the max upload size (%maxsize).', ['%filesize' => format_size($large_file->getSize()), '%maxsize' => $max_filesize]));
-    }
-
-    // Turn off the max filesize.
-    $this->updateFileField($field_name, $type_name, ['max_filesize' => '']);
-
-    // Upload the big file successfully.
-    $nid = $this->uploadNodeFile($large_file, $field_name, $type_name);
-    $node_storage->resetCache([$nid]);
-    $node = $node_storage->load($nid);
-    $node_file = File::load($node->{$field_name}->target_id);
-    $this->assertFileExists($node_file, format_string('File exists after uploading a file (%filesize) with no max limit.', ['%filesize' => format_size($large_file->getSize())]));
-    $this->assertFileEntryExists($node_file, format_string('File entry exists after uploading a file (%filesize) with no max limit.', ['%filesize' => format_size($large_file->getSize())]));
-  }
-
-  /**
-   * Tests file extension checking.
-   */
-  public function testFileExtension() {
-    $node_storage = $this->container->get('entity.manager')->getStorage('node');
-    $type_name = 'article';
-    $field_name = strtolower($this->randomMachineName());
-    $this->createFileField($field_name, 'node', $type_name);
-
-    $test_file = $this->getTestFile('image');
-    list(, $test_file_extension) = explode('.', $test_file->getFilename());
-
-    // Disable extension checking.
-    $this->updateFileField($field_name, $type_name, ['file_extensions' => '']);
-
-    // Check that the file can be uploaded with no extension checking.
-    $nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
-    $node_storage->resetCache([$nid]);
-    $node = $node_storage->load($nid);
-    $node_file = File::load($node->{$field_name}->target_id);
-    $this->assertFileExists($node_file, 'File exists after uploading a file with no extension checking.');
-    $this->assertFileEntryExists($node_file, 'File entry exists after uploading a file with no extension checking.');
-
-    // Enable extension checking for text files.
-    $this->updateFileField($field_name, $type_name, ['file_extensions' => 'txt']);
-
-    // Check that the file with the wrong extension cannot be uploaded.
-    $this->uploadNodeFile($test_file, $field_name, $type_name);
-    $error_message = t('Only files with the following extensions are allowed: %files-allowed.', ['%files-allowed' => 'txt']);
-    $this->assertRaw($error_message, 'Node save failed when file uploaded with the wrong extension.');
-
-    // Enable extension checking for text and image files.
-    $this->updateFileField($field_name, $type_name, ['file_extensions' => "txt $test_file_extension"]);
-
-    // Check that the file can be uploaded with extension checking.
-    $nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
-    $node_storage->resetCache([$nid]);
-    $node = $node_storage->load($nid);
-    $node_file = File::load($node->{$field_name}->target_id);
-    $this->assertFileExists($node_file, 'File exists after uploading a file with extension checking.');
-    $this->assertFileEntryExists($node_file, 'File entry exists after uploading a file with extension checking.');
-  }
-
-  /**
-   * Checks that a file can always be removed if it does not pass validation.
-   */
-  public function testFileRemoval() {
-    $node_storage = $this->container->get('entity.manager')->getStorage('node');
-    $type_name = 'article';
-    $field_name = 'file_test';
-    $this->createFileField($field_name, 'node', $type_name);
-
-    $test_file = $this->getTestFile('image');
-
-    // Disable extension checking.
-    $this->updateFileField($field_name, $type_name, ['file_extensions' => '']);
-
-    // Check that the file can be uploaded with no extension checking.
-    $nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
-    $node_storage->resetCache([$nid]);
-    $node = $node_storage->load($nid);
-    $node_file = File::load($node->{$field_name}->target_id);
-    $this->assertFileExists($node_file, 'File exists after uploading a file with no extension checking.');
-    $this->assertFileEntryExists($node_file, 'File entry exists after uploading a file with no extension checking.');
-
-    // Enable extension checking for text files.
-    $this->updateFileField($field_name, $type_name, ['file_extensions' => 'txt']);
-
-    // Check that the file can still be removed.
-    $this->removeNodeFile($nid);
-    $this->assertNoText('Only files with the following extensions are allowed: txt.');
-    $this->assertText('Article ' . $node->getTitle() . ' has been updated.');
-  }
-
   /**
    * Test the validation message is displayed only once for ajax uploads.
    */
diff --git a/core/modules/file/src/Tests/FileManagedTestBase.php b/core/modules/file/src/Tests/FileManagedTestBase.php
index 879e1c4e94..fde651dca6 100644
--- a/core/modules/file/src/Tests/FileManagedTestBase.php
+++ b/core/modules/file/src/Tests/FileManagedTestBase.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\file\Tests;
 
+@trigger_error('The ' . __NAMESPACE__ . '\FileManagedTestBase is scheduled for removal in Drupal 9.0.0. Instead, use \Drupal\Tests\file\Functional\FileManagedTestBase', E_USER_DEPRECATED);
+
 use Drupal\file\Entity\File;
 use Drupal\file\FileInterface;
 use Drupal\simpletest\WebTestBase;
diff --git a/core/modules/file/src/Tests/DownloadTest.php b/core/modules/file/tests/src/Functional/DownloadTest.php
similarity index 85%
rename from core/modules/file/src/Tests/DownloadTest.php
rename to core/modules/file/tests/src/Functional/DownloadTest.php
index 8f85f09f96..704c9db190 100644
--- a/core/modules/file/src/Tests/DownloadTest.php
+++ b/core/modules/file/tests/src/Functional/DownloadTest.php
@@ -1,6 +1,9 @@
 <?php
 
-namespace Drupal\file\Tests;
+namespace Drupal\Tests\file\Functional;
+
+use Drupal\Core\Site\Settings;
+use GuzzleHttp\Exception\RequestException;
 
 /**
  * Tests for download/file transfer functions.
@@ -25,16 +28,16 @@ public function testPublicFileTransfer() {
     // encoded.
     $filename = $GLOBALS['base_url'] . '/' . \Drupal::service('stream_wrapper_manager')->getViaScheme('public')->getDirectoryPath() . '/' . rawurlencode($file->getFilename());
     $this->assertEqual($filename, $url, 'Correctly generated a URL for a created file.');
-    $this->drupalHead($url);
-    $this->assertResponse(200, 'Confirmed that the generated URL is correct by downloading the created file.');
-
+    $http_client = \Drupal::httpClient();
+    $response = $http_client->head($url);
+    $this->assertEquals(200, $response->getStatusCode(), 'Confirmed that the generated URL is correct by downloading the created file.');
     // Test generating a URL to a shipped file (i.e. a file that is part of
     // Drupal core, a module or a theme, for example a JavaScript file).
     $filepath = 'core/assets/vendor/jquery/jquery.min.js';
     $url = file_create_url($filepath);
     $this->assertEqual($GLOBALS['base_url'] . '/' . $filepath, $url, 'Correctly generated a URL for a shipped file.');
-    $this->drupalHead($url);
-    $this->assertResponse(200, 'Confirmed that the generated URL is correct by downloading the shipped file.');
+    $response = $http_client->head($url);
+    $this->assertEquals(200, $response->getStatusCode(), 'Confirmed that the generated URL is correct by downloading the shipped file.');
   }
 
   /**
@@ -70,17 +73,19 @@ protected function doPrivateFileTransferTest() {
     $this->assertResponse(200, 'Correctly allowed access to a file when file_test provides headers.');
 
     // Test that the file transferred correctly.
-    $this->assertEqual($contents, $this->content, 'Contents of the file are correct.');
+    $this->assertSame($contents, $this->getSession()->getPage()->getContent(), 'Contents of the file are correct.');
+
+    $http_client = $this->getSession()->getDriver()->getClient()->getClient();
 
     // Deny access to all downloads via a -1 header.
     file_test_set_return('download', -1);
-    $this->drupalHead($url);
-    $this->assertResponse(403, 'Correctly denied access to a file when file_test sets the header to -1.');
+    $response = $http_client->head($url, ['http_errors' => FALSE]);
+    $this->assertSame(403, $response->getStatusCode(), 'Correctly denied access to a file when file_test sets the header to -1.');
 
     // Try non-existent file.
     $url = file_create_url('private://' . $this->randomMachineName());
-    $this->drupalHead($url);
-    $this->assertResponse(404, 'Correctly returned 404 response for a non-existent file.');
+    $response = $http_client->head($url, ['http_errors' => FALSE]);
+    $this->assertSame(404, $response->getStatusCode(), 'Correctly returned 404 response for a non-existent file.');
   }
 
   /**
diff --git a/core/modules/file/src/Tests/FileFieldAnonymousSubmissionTest.php b/core/modules/file/tests/src/Functional/FileFieldAnonymousSubmissionTest.php
similarity index 99%
rename from core/modules/file/src/Tests/FileFieldAnonymousSubmissionTest.php
rename to core/modules/file/tests/src/Functional/FileFieldAnonymousSubmissionTest.php
index 66d87cd7e8..9f004abba7 100644
--- a/core/modules/file/src/Tests/FileFieldAnonymousSubmissionTest.php
+++ b/core/modules/file/tests/src/Functional/FileFieldAnonymousSubmissionTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\file\Tests;
+namespace Drupal\Tests\file\Functional;
 
 use Drupal\node\Entity\Node;
 use Drupal\user\RoleInterface;
diff --git a/core/modules/file/src/Tests/FileFieldDisplayTest.php b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php
similarity index 95%
rename from core/modules/file/src/Tests/FileFieldDisplayTest.php
rename to core/modules/file/tests/src/Functional/FileFieldDisplayTest.php
index 2b3786b0a5..6333a3e4c9 100644
--- a/core/modules/file/src/Tests/FileFieldDisplayTest.php
+++ b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\file\Tests;
+namespace Drupal\Tests\file\Functional;
 
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\file\Entity\File;
@@ -97,15 +97,17 @@ public function testNodeDisplay() {
     // Test that fields appear as expected after during the preview.
     // Add a second file.
     $name = 'files[' . $field_name . '_1][]';
-    $edit[$name] = \Drupal::service('file_system')->realpath($test_file->getFileUri());
+    $edit_upload[$name] = \Drupal::service('file_system')->realpath($test_file->getFileUri());
+    $this->drupalPostForm('node/' . $nid . '/edit', $edit_upload, t('Upload'));
 
     // Uncheck the display checkboxes and go to the preview.
     $edit[$field_name . '[0][display]'] = FALSE;
     $edit[$field_name . '[1][display]'] = FALSE;
-    $this->drupalPostForm("node/$nid/edit", $edit, t('Preview'));
+    $this->drupalPostForm(NULL, $edit, t('Preview'));
     $this->clickLink(t('Back to content editing'));
     $this->assertRaw($field_name . '[0][display]', 'First file appears as expected.');
     $this->assertRaw($field_name . '[1][display]', 'Second file appears as expected.');
+    $this->assertSession()->responseContains($field_name . '[1][description]', 'Description of second file appears as expected.');
   }
 
   /**
diff --git a/core/modules/file/src/Tests/FileFieldFormatterAccessTest.php b/core/modules/file/tests/src/Functional/FileFieldFormatterAccessTest.php
similarity index 95%
rename from core/modules/file/src/Tests/FileFieldFormatterAccessTest.php
rename to core/modules/file/tests/src/Functional/FileFieldFormatterAccessTest.php
index 68bb0473ef..5fbbdf14ff 100644
--- a/core/modules/file/src/Tests/FileFieldFormatterAccessTest.php
+++ b/core/modules/file/tests/src/Functional/FileFieldFormatterAccessTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\file\Tests;
+namespace Drupal\Tests\file\Functional;
 
 /**
  * Tests file formatter access.
diff --git a/core/modules/file/src/Tests/FileFieldPathTest.php b/core/modules/file/tests/src/Functional/FileFieldPathTest.php
similarity index 99%
rename from core/modules/file/src/Tests/FileFieldPathTest.php
rename to core/modules/file/tests/src/Functional/FileFieldPathTest.php
index 300b92c3ca..f4eabd457a 100644
--- a/core/modules/file/src/Tests/FileFieldPathTest.php
+++ b/core/modules/file/tests/src/Functional/FileFieldPathTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\file\Tests;
+namespace Drupal\Tests\file\Functional;
 
 use Drupal\file\Entity\File;
 
diff --git a/core/modules/file/src/Tests/FileFieldRSSContentTest.php b/core/modules/file/tests/src/Functional/FileFieldRSSContentTest.php
similarity index 89%
rename from core/modules/file/src/Tests/FileFieldRSSContentTest.php
rename to core/modules/file/tests/src/Functional/FileFieldRSSContentTest.php
index af2b5f2b3e..26d14dbfb4 100644
--- a/core/modules/file/src/Tests/FileFieldRSSContentTest.php
+++ b/core/modules/file/tests/src/Functional/FileFieldRSSContentTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\file\Tests;
+namespace Drupal\Tests\file\Functional;
 
 use Drupal\file\Entity\File;
 
@@ -60,12 +60,12 @@ public function testFileFieldRSSContent() {
     $this->drupalGet('rss.xml');
     $uploaded_filename = str_replace('public://', '', $node_file->getFileUri());
     $selector = sprintf(
-      'enclosure[url="%s"][length="%s"][type="%s"]',
+      'enclosure[@url="%s"][@length="%s"][@type="%s"]',
       file_create_url("public://$uploaded_filename", ['absolute' => TRUE]),
       $node_file->getSize(),
       $node_file->getMimeType()
     );
-    $this->assertTrue(!empty($this->cssSelect($selector)), 'File field RSS enclosure is displayed when viewing the RSS feed.');
+    $this->assertNotNull($this->getSession()->getDriver()->find('xpath', $selector), 'File field RSS enclosure is displayed when viewing the RSS feed.');
   }
 
 }
diff --git a/core/modules/file/src/Tests/FileFieldRevisionTest.php b/core/modules/file/tests/src/Functional/FileFieldRevisionTest.php
similarity index 99%
rename from core/modules/file/src/Tests/FileFieldRevisionTest.php
rename to core/modules/file/tests/src/Functional/FileFieldRevisionTest.php
index 04fbcb8767..6f05136cca 100644
--- a/core/modules/file/src/Tests/FileFieldRevisionTest.php
+++ b/core/modules/file/tests/src/Functional/FileFieldRevisionTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\file\Tests;
+namespace Drupal\Tests\file\Functional;
 
 use Drupal\file\Entity\File;
 
diff --git a/core/modules/file/tests/src/Functional/FileFieldTestBase.php b/core/modules/file/tests/src/Functional/FileFieldTestBase.php
index f3d1c22b46..1cd5072bac 100644
--- a/core/modules/file/tests/src/Functional/FileFieldTestBase.php
+++ b/core/modules/file/tests/src/Functional/FileFieldTestBase.php
@@ -7,6 +7,7 @@
 use Drupal\file\FileInterface;
 use Drupal\Tests\BrowserTestBase;
 use Drupal\file\Entity\File;
+use Drupal\Tests\TestFileCreationTrait;
 
 /**
  * Provides methods specifically for testing File module's field handling.
@@ -15,6 +16,10 @@
 
   use FileFieldCreationTrait;
 
+  use TestFileCreationTrait {
+    getTestFiles as drupalGetTestFiles;
+  }
+
   /**
   * Modules to enable.
   *
@@ -156,7 +161,8 @@ public function uploadNodeFiles(array $files, $field_name, $nid_or_type, $new_re
         $edit[$name][] = $file_path;
       }
     }
-    $this->drupalPostForm("node/$nid/edit", $edit, t('Save and keep published'));
+
+    $this->drupalPostForm("node/$nid/edit", $edit, t('Save'));
 
     return $nid;
   }
@@ -172,7 +178,7 @@ public function removeNodeFile($nid, $new_revision = TRUE) {
     ];
 
     $this->drupalPostForm('node/' . $nid . '/edit', [], t('Remove'));
-    $this->drupalPostForm(NULL, $edit, t('Save and keep published'));
+    $this->drupalPostForm(NULL, $edit, t('Save'));
   }
 
   /**
@@ -185,7 +191,7 @@ public function replaceNodeFile($file, $field_name, $nid, $new_revision = TRUE)
     ];
 
     $this->drupalPostForm('node/' . $nid . '/edit', [], t('Remove'));
-    $this->drupalPostForm(NULL, $edit, t('Save and keep published'));
+    $this->drupalPostForm(NULL, $edit, t('Save'));
   }
 
   /**
diff --git a/core/modules/file/src/Tests/FileFieldValidateTest.php b/core/modules/file/tests/src/Functional/FileFieldValidateTest.php
similarity index 91%
copy from core/modules/file/src/Tests/FileFieldValidateTest.php
copy to core/modules/file/tests/src/Functional/FileFieldValidateTest.php
index be96f3c587..c307ce0fb2 100644
--- a/core/modules/file/src/Tests/FileFieldValidateTest.php
+++ b/core/modules/file/tests/src/Functional/FileFieldValidateTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\file\Tests;
+namespace Drupal\Tests\file\Functional;
 
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\field\Entity\FieldConfig;
@@ -187,25 +187,4 @@ public function testFileRemoval() {
     $this->assertText('Article ' . $node->getTitle() . ' has been updated.');
   }
 
-  /**
-   * Test the validation message is displayed only once for ajax uploads.
-   */
-  public function testAJAXValidationMessage() {
-    $field_name = strtolower($this->randomMachineName());
-    $this->createFileField($field_name, 'node', 'article');
-
-    $this->drupalGet('node/add/article');
-    /** @var \Drupal\file\FileInterface $image_file */
-    $image_file = $this->getTestFile('image');
-    $edit = [
-      'files[' . $field_name . '_0]' => $this->container->get('file_system')->realpath($image_file->getFileUri()),
-      'title[0][value]' => $this->randomMachineName(),
-    ];
-    $this->drupalPostAjaxForm(NULL, $edit, $field_name . '_0_upload_button');
-    $elements = $this->xpath('//div[contains(@class, :class)]', [
-      ':class' => 'messages--error',
-    ]);
-    $this->assertEqual(count($elements), 1, 'Ajax validation messages are displayed once.');
-  }
-
 }
diff --git a/core/modules/file/src/Tests/FileListingTest.php b/core/modules/file/tests/src/Functional/FileListingTest.php
similarity index 98%
rename from core/modules/file/src/Tests/FileListingTest.php
rename to core/modules/file/tests/src/Functional/FileListingTest.php
index 5c8b834b8b..b1d39b3ad8 100644
--- a/core/modules/file/src/Tests/FileListingTest.php
+++ b/core/modules/file/tests/src/Functional/FileListingTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\file\Tests;
+namespace Drupal\Tests\file\Functional;
 
 use Drupal\node\Entity\Node;
 use Drupal\file\Entity\File;
@@ -127,7 +127,7 @@ public function testFileListingPages() {
     $usage = $this->sumUsages($file_usage->listUsage($file));
     $this->assertRaw('admin/content/files/usage/' . $file->id() . '">' . $usage);
 
-    $result = $this->xpath("//td[contains(@class, 'views-field-status') and contains(text(), :value)]", [':value' => t('Temporary')]);
+    $result = $this->xpath("//td[contains(@class, 'views-field-status') and contains(text(), :value)]", [':value' => 'Temporary']);
     $this->assertEqual(1, count($result), 'Unused file marked as temporary.');
 
     // Test file usage page.
diff --git a/core/modules/file/src/Tests/FileOnTranslatedEntityTest.php b/core/modules/file/tests/src/Functional/FileOnTranslatedEntityTest.php
similarity index 99%
rename from core/modules/file/src/Tests/FileOnTranslatedEntityTest.php
rename to core/modules/file/tests/src/Functional/FileOnTranslatedEntityTest.php
index e72f6d87eb..2e22a69c35 100644
--- a/core/modules/file/src/Tests/FileOnTranslatedEntityTest.php
+++ b/core/modules/file/tests/src/Functional/FileOnTranslatedEntityTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\file\Tests;
+namespace Drupal\Tests\file\Functional;
 
 use Drupal\file\Entity\File;
 
diff --git a/core/modules/file/src/Tests/FilePrivateTest.php b/core/modules/file/tests/src/Functional/FilePrivateTest.php
similarity index 95%
rename from core/modules/file/src/Tests/FilePrivateTest.php
rename to core/modules/file/tests/src/Functional/FilePrivateTest.php
index 88574cb652..368e39165a 100644
--- a/core/modules/file/src/Tests/FilePrivateTest.php
+++ b/core/modules/file/tests/src/Functional/FilePrivateTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\file\Tests;
+namespace Drupal\Tests\file\Functional;
 
 use Drupal\Core\Entity\Plugin\Validation\Constraint\ReferenceAccessConstraint;
 use Drupal\Component\Utility\SafeMarkup;
@@ -82,7 +82,7 @@ public function testPrivateFile() {
     $this->drupalPostForm('node/add/' . $type_name, $edit, t('Save'));
     $new_node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
     $edit[$field_name . '[0][fids]'] = $node_file->id();
-    $this->drupalPostForm('node/' . $new_node->id() . '/edit', $edit, t('Save'));
+    $this->drupalPostFormWithInvalidOptions('node/' . $new_node->id() . '/edit', $edit, t('Save'));
     // Make sure the form submit failed - we stayed on the edit form.
     $this->assertUrl('node/' . $new_node->id() . '/edit');
     // Check that we got the expected constraint form error.
@@ -93,7 +93,7 @@ public function testPrivateFile() {
     $edit = [];
     $edit['title[0][value]'] = $this->randomMachineName();
     $edit[$field_name . '[0][fids]'] = $node_file->id();
-    $this->drupalPostForm('node/add/' . $type_name, $edit, t('Save'));
+    $this->drupalPostFormWithInvalidOptions('node/add/' . $type_name, $edit, t('Save'));
     $new_node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
     $this->assertTrue(empty($new_node), 'Node was not created.');
     $this->assertUrl('node/add/' . $type_name);
@@ -144,9 +144,7 @@ public function testPrivateFile() {
     $this->drupalGet($file_url);
     $this->assertResponse(200, 'Confirmed that the anonymous uploader has access to the temporary file.');
     // Close the prior connection and remove the session cookie.
-    $this->curlClose();
-    $this->curlCookies = [];
-    $this->cookies = [];
+    $this->getSession()->reset();
     $this->drupalGet($file_url);
     $this->assertResponse(403, 'Confirmed that another anonymous user cannot access the temporary file.');
 
@@ -174,9 +172,7 @@ public function testPrivateFile() {
     $this->drupalGet($file_url);
     $this->assertResponse(200, 'Confirmed that the anonymous uploader has access to the file whose references were removed.');
     // Close the prior connection and remove the session cookie.
-    $this->curlClose();
-    $this->curlCookies = [];
-    $this->cookies = [];
+    $this->getSession()->reset();
     $this->drupalGet($file_url);
     $this->assertResponse(403, 'Confirmed that another anonymous user cannot access the file whose references were removed.');
 
@@ -197,9 +193,7 @@ public function testPrivateFile() {
     $this->drupalGet($file_url);
     $this->assertResponse(200, 'Confirmed that the anonymous uploader has access to the permanent file that is referenced by a published node.');
     // Close the prior connection and remove the session cookie.
-    $this->curlClose();
-    $this->curlCookies = [];
-    $this->cookies = [];
+    $this->getSession()->reset();
     $this->drupalGet($file_url);
     $this->assertResponse(200, 'Confirmed that another anonymous user also has access to the permanent file that is referenced by a published node.');
 
@@ -224,9 +218,7 @@ public function testPrivateFile() {
     $this->drupalGet($file_url);
     $this->assertResponse(403, 'Confirmed that the anonymous uploader cannot access the permanent file when it is referenced by an unpublished node.');
     // Close the prior connection and remove the session cookie.
-    $this->curlClose();
-    $this->curlCookies = [];
-    $this->cookies = [];
+    $this->getSession()->reset();
     $this->drupalGet($file_url);
     $this->assertResponse(403, 'Confirmed that another anonymous user cannot access the permanent file when it is referenced by an unpublished node.');
   }
diff --git a/core/modules/file/src/Tests/FileTokenReplaceTest.php b/core/modules/file/tests/src/Functional/FileTokenReplaceTest.php
similarity index 99%
rename from core/modules/file/src/Tests/FileTokenReplaceTest.php
rename to core/modules/file/tests/src/Functional/FileTokenReplaceTest.php
index 5bfa07b9ab..fd955913b9 100644
--- a/core/modules/file/src/Tests/FileTokenReplaceTest.php
+++ b/core/modules/file/tests/src/Functional/FileTokenReplaceTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\file\Tests;
+namespace Drupal\Tests\file\Functional;
 
 use Drupal\Component\Utility\Html;
 use Drupal\Core\Render\BubbleableMetadata;
diff --git a/core/modules/file/src/Tests/PrivateFileOnTranslatedEntityTest.php b/core/modules/file/tests/src/Functional/PrivateFileOnTranslatedEntityTest.php
similarity index 99%
rename from core/modules/file/src/Tests/PrivateFileOnTranslatedEntityTest.php
rename to core/modules/file/tests/src/Functional/PrivateFileOnTranslatedEntityTest.php
index 2712ce09fd..7228e97a91 100644
--- a/core/modules/file/src/Tests/PrivateFileOnTranslatedEntityTest.php
+++ b/core/modules/file/tests/src/Functional/PrivateFileOnTranslatedEntityTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\file\Tests;
+namespace Drupal\Tests\file\Functional;
 
 use Drupal\file\Entity\File;
 use Drupal\node\Entity\Node;
diff --git a/core/modules/file/src/Tests/RemoteFileSaveUploadTest.php b/core/modules/file/tests/src/Functional/RemoteFileSaveUploadTest.php
similarity index 90%
rename from core/modules/file/src/Tests/RemoteFileSaveUploadTest.php
rename to core/modules/file/tests/src/Functional/RemoteFileSaveUploadTest.php
index d468ed326f..e0e4be4b3c 100644
--- a/core/modules/file/src/Tests/RemoteFileSaveUploadTest.php
+++ b/core/modules/file/tests/src/Functional/RemoteFileSaveUploadTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\file\Tests;
+namespace Drupal\Tests\file\Functional;
 
 /**
  * Tests the file uploading functions.
diff --git a/core/modules/file/src/Tests/SaveUploadFormTest.php b/core/modules/file/tests/src/Functional/SaveUploadFormTest.php
similarity index 98%
rename from core/modules/file/src/Tests/SaveUploadFormTest.php
rename to core/modules/file/tests/src/Functional/SaveUploadFormTest.php
index 07ebd1dc24..c7c3f21b8c 100644
--- a/core/modules/file/src/Tests/SaveUploadFormTest.php
+++ b/core/modules/file/tests/src/Functional/SaveUploadFormTest.php
@@ -1,8 +1,9 @@
 <?php
 
-namespace Drupal\file\Tests;
+namespace Drupal\Tests\file\Functional;
 
 use Drupal\file\Entity\File;
+use Drupal\Tests\TestFileCreationTrait;
 
 /**
  * Tests the _file_save_upload_from_form() function.
@@ -13,6 +14,10 @@
  */
 class SaveUploadFormTest extends FileManagedTestBase {
 
+  use TestFileCreationTrait {
+    getTestFiles as drupalGetTestFiles;
+  }
+
   /**
    * Modules to enable.
    *
@@ -446,16 +451,14 @@ public function testCombinedErrorMessages() {
     /** @var \Drupal\Core\File\FileSystemInterface $file_system */
     $file_system = \Drupal::service('file_system');
     $edit = [
-      'files[file_test_upload][]' => [
-        $file_system->realpath($this->phpfile->uri),
-        $file_system->realpath($textfile->uri),
-      ],
+      'files[file_test_upload][0]' => $file_system->realpath($this->phpfile->uri),
+      'files[file_test_upload][1]' => $file_system->realpath($textfile->uri),
       'allow_all_extensions' => FALSE,
       'is_image_file' => TRUE,
       'extensions' => 'jpeg',
     ];
 
-    $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit'));
+    $this->drupalPostFormWithInvalidOptions('file-test/save_upload_from_form_test', $edit, t('Submit'));
     $this->assertResponse(200, 'Received a 200 response for posted test file.');
     $this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.');
 
diff --git a/core/modules/file/src/Tests/SaveUploadTest.php b/core/modules/file/tests/src/Functional/SaveUploadTest.php
similarity index 98%
rename from core/modules/file/src/Tests/SaveUploadTest.php
rename to core/modules/file/tests/src/Functional/SaveUploadTest.php
index a6e6f9a46a..40f560eec9 100644
--- a/core/modules/file/src/Tests/SaveUploadTest.php
+++ b/core/modules/file/tests/src/Functional/SaveUploadTest.php
@@ -1,8 +1,9 @@
 <?php
 
-namespace Drupal\file\Tests;
+namespace Drupal\Tests\file\Functional;
 
 use Drupal\file\Entity\File;
+use Drupal\Tests\TestFileCreationTrait;
 
 /**
  * Tests the file_save_upload() function.
@@ -10,6 +11,11 @@
  * @group file
  */
 class SaveUploadTest extends FileManagedTestBase {
+
+  use TestFileCreationTrait {
+    getTestFiles as drupalGetTestFiles;
+  }
+
   /**
    * Modules to enable.
    *
diff --git a/core/modules/file/src/Tests/Views/RelationshipUserFileDataTest.php b/core/modules/file/tests/src/Functional/Views/RelationshipUserFileDataTest.php
similarity index 96%
rename from core/modules/file/src/Tests/Views/RelationshipUserFileDataTest.php
rename to core/modules/file/tests/src/Functional/Views/RelationshipUserFileDataTest.php
index 45e016d169..0169e0a6d8 100644
--- a/core/modules/file/src/Tests/Views/RelationshipUserFileDataTest.php
+++ b/core/modules/file/tests/src/Functional/Views/RelationshipUserFileDataTest.php
@@ -1,10 +1,10 @@
 <?php
 
-namespace Drupal\file\Tests\Views;
+namespace Drupal\Tests\file\Functional\Views;
 
 use Drupal\field\Entity\FieldConfig;
 use Drupal\file\Entity\File;
-use Drupal\views\Tests\ViewTestBase;
+use Drupal\Tests\views\Functional\ViewTestBase;
 use Drupal\views\Views;
 use Drupal\views\Tests\ViewTestData;
 use Drupal\field\Entity\FieldStorageConfig;
diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php
index 087419054a..60298ef359 100644
--- a/core/tests/Drupal/Tests/BrowserTestBase.php
+++ b/core/tests/Drupal/Tests/BrowserTestBase.php
@@ -1361,4 +1361,42 @@ protected function checkForMetaRefresh() {
     return FALSE;
   }
 
+  /**
+   * Executes form request with invalid options.
+   *
+   * @param \Drupal\Core\Url|string $path
+   *   Location of the post form.
+   * @param array $edit
+   *   Field data in an associative array.
+   * @param string|object $submit
+   *   Value of the submit button whose click is to be emulated.
+   *
+   * @throws \Behat\Mink\Exception\ElementNotFoundException
+   *
+   * @todo: Remove after https://www.drupal.org/project/drupal/issues/2917885
+   */
+  protected function drupalPostFormWithInvalidOptions($path, $edit, $submit) {
+    if ($path !== NULL) {
+      $this->drupalGet($path);
+    }
+
+    $edit_params = [];
+    $edit_files = [];
+    foreach ($edit as $key => $value) {
+      if (strpos($key, 'files') === 0) {
+        $edit_files[$key] = $value;
+      }
+      else {
+        $edit_params[$key] = $value;
+      }
+    }
+
+    $submit_xpath = $this->assertSession()->buttonExists((string) $submit)->getXpath();
+    $client = $this->getSession()->getDriver()->getClient();
+    $form = $client->getCrawler()->filterXPath($submit_xpath)->form();
+    $params = array_replace_recursive($form->getPhpValues(), $edit_params);
+    $files = array_replace_recursive($form->getPhpFiles(), $edit_files);
+    $client->request($form->getMethod(), $form->getUri(), $params, $files);
+  }
+
 }
