diff --git a/core/modules/system/tests/src/Functional/System/ThemeTest.php b/core/modules/system/tests/src/Functional/System/ThemeTest.php
index 19574c4d9e10fd6a6414ba36ed4e7ae3e91053b1..e63d96f23c7acaf3bdaa74bd7db19d31a4f961d6 100644
--- a/core/modules/system/tests/src/Functional/System/ThemeTest.php
+++ b/core/modules/system/tests/src/Functional/System/ThemeTest.php
@@ -423,7 +423,7 @@ public function testInvalidTheme() {
   public function testUninstallingThemes() {
     // Install olivero.
     \Drupal::service('theme_installer')->install(['olivero']);
-    // Set up claro as the admin theme.
+    // Set up Claro as the admin theme.
     \Drupal::service('theme_installer')->install(['claro']);
     $edit = [
       'admin_theme' => 'claro',
@@ -431,6 +431,7 @@ public function testUninstallingThemes() {
     ];
     $this->drupalGet('admin/appearance');
     $this->submitForm($edit, 'Save configuration');
+
     // Set olivero as the default theme.
     $this->cssSelect('a[title="Set Olivero as default theme"]')[0]->click();
     // Check that claro cannot be uninstalled as it is the admin theme.
diff --git a/core/modules/system/tests/src/Functional/Theme/EntityFilteringThemeTest.php b/core/modules/system/tests/src/Functional/Theme/EntityFilteringThemeTest.php
index 820554fa0714e454a879c18b3e21752768250af3..54f39af75c9893ffc59843063dde7239becfe453 100644
--- a/core/modules/system/tests/src/Functional/Theme/EntityFilteringThemeTest.php
+++ b/core/modules/system/tests/src/Functional/Theme/EntityFilteringThemeTest.php
@@ -6,6 +6,7 @@
 use Drupal\Core\Extension\ExtensionDiscovery;
 use Drupal\comment\CommentInterface;
 use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
+use Drupal\Core\Extension\ExtensionLifecycle;
 use Drupal\node\NodeInterface;
 use Drupal\comment\Entity\Comment;
 use Drupal\taxonomy\Entity\Term;
@@ -87,6 +88,15 @@ protected function setUp(): void {
     // Install all available non-testing themes.
     $listing = new ExtensionDiscovery(\Drupal::root());
     $this->themes = $listing->scan('theme', FALSE);
+    /** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
+    $theme_data = \Drupal::service('theme_handler')->rebuildThemeData();
+    foreach (array_keys($this->themes) as $theme) {
+      // Skip obsolete and deprecated themes.
+      $info = $theme_data[$theme]->info;
+      if ($info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::OBSOLETE || $info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::DEPRECATED) {
+        unset($this->themes[$theme]);
+      }
+    }
     \Drupal::service('theme_installer')->install(array_keys($this->themes));
 
     // Create a test user.
diff --git a/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php b/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php
index 36d2942b2ca0648254e48bd002e40185e43a59a2..71ed51e3b564d3f95fcd803d6a639b92664229a4 100644
--- a/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php
@@ -60,10 +60,9 @@ class ResolvedLibraryDefinitionsFilesMatchTest extends KernelTestBase {
    * @var string[]
    */
   protected $allThemes = [
-    'bartik',
+    'claro',
     'classy',
     'olivero',
-    'seven',
     'stable',
     'stark',
   ];