diff --git a/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php b/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php
index 50fe122f908a59777c3cdbec6494dd39f95706b5..2726daa6cf68f57967c61f8b1f74b9d9ebdf3eed 100644
--- a/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php
+++ b/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php
@@ -416,6 +416,13 @@ protected function installDefaultThemeFromClassProperty(ContainerInterface $cont
     // Use the install profile to determine the default theme if configured and
     // not already specified.
     $profile = $container->getParameter('install_profile');
+
+    $default_sync_path = drupal_get_path('profile', $profile) . '/config/sync';
+    $profile_config_storage = new FileStorage($default_sync_path, StorageInterface::DEFAULT_COLLECTION);
+    if (!isset($this->defaultTheme) && $profile_config_storage->exists('system.theme')) {
+      $this->defaultTheme = $profile_config_storage->read('system.theme')['default'];
+    }
+
     $default_install_path = drupal_get_path('profile', $profile) . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY;
     $profile_config_storage = new FileStorage($default_install_path, StorageInterface::DEFAULT_COLLECTION);
     if (!isset($this->defaultTheme) && $profile_config_storage->exists('system.theme')) {
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigMultilingualTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigMultilingualTest.php
index 2feb840693d7c2dbd2beb8aca2acd1bad2fbf2e8..db05d32031e6c7f3109184217f26e489f472473b 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigMultilingualTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigMultilingualTest.php
@@ -9,11 +9,6 @@
  */
 class InstallerExistingConfigMultilingualTest extends InstallerExistingConfigTestBase {
 
-  /**
-   * {@inheritdoc}
-   */
-  protected $defaultTheme = 'stark';
-
   /**
    * {@inheritdoc}
    */
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php
index 42d1c11f6cb08eb9da932bac6a1646482c8d86d5..4ac68d4e8637c48883e872b796bc3ebc819de984 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php
@@ -9,11 +9,6 @@
  */
 class InstallerExistingConfigNoSystemSiteTest extends InstallerExistingConfigTestBase {
 
-  /**
-   * {@inheritdoc}
-   */
-  protected $defaultTheme = 'stark';
-
   /**
    * {@inheritdoc}
    */
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstall.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstall.php
index 09f377415353c05fee7e76ed5d8105137ae262e4..2d9d6cdfc121c4480fecdf4e60047033456619e5 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstall.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstall.php
@@ -11,11 +11,6 @@ class InstallerExistingConfigProfileHookInstall extends InstallerExistingConfigT
 
   protected $profile = 'config_profile_with_hook_install';
 
-  /**
-   * {@inheritdoc}
-   */
-  protected $defaultTheme = 'stark';
-
   /**
    * {@inheritdoc}
    */
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTest.php
index 01e71cf8561444c855f74d29d50a711fbbe20a67..c1e75a87aeb4bc63e158e9dd44bcd1ccf3da30ae 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTest.php
@@ -9,11 +9,6 @@
  */
 class InstallerExistingConfigTest extends InstallerExistingConfigTestBase {
 
-  /**
-   * {@inheritdoc}
-   */
-  protected $defaultTheme = 'stark';
-
   /**
    * {@inheritdoc}
    */