diff --git a/core/modules/toolbar/src/Tests/ToolbarCacheContextsTest.php b/core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php
similarity index 97%
rename from core/modules/toolbar/src/Tests/ToolbarCacheContextsTest.php
rename to core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php
index 6995d59..2f6f92d 100644
--- a/core/modules/toolbar/src/Tests/ToolbarCacheContextsTest.php
+++ b/core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php
@@ -1,11 +1,11 @@
 <?php
 
-namespace Drupal\toolbar\Tests;
+namespace Drupal\Tests\toolbar\Functional;
 
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
-use Drupal\simpletest\WebTestBase;
 use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait;
+use Drupal\Tests\BrowserTestBase;
 
 
 /**
@@ -13,7 +13,7 @@
  *
  * @group toolbar
  */
-class ToolbarCacheContextsTest extends WebTestBase {
+class ToolbarCacheContextsTest extends BrowserTestBase {
 
   use AssertPageCacheContextsAndTagsTrait;
 
diff --git a/core/modules/toolbar/src/Tests/ToolbarMenuTranslationTest.php b/core/modules/toolbar/tests/src/Functional/ToolbarMenuTranslationTest.php
similarity index 94%
rename from core/modules/toolbar/src/Tests/ToolbarMenuTranslationTest.php
rename to core/modules/toolbar/tests/src/Functional/ToolbarMenuTranslationTest.php
index f4d6a11..995d49e 100644
--- a/core/modules/toolbar/src/Tests/ToolbarMenuTranslationTest.php
+++ b/core/modules/toolbar/tests/src/Functional/ToolbarMenuTranslationTest.php
@@ -1,15 +1,15 @@
 <?php
 
-namespace Drupal\toolbar\Tests;
+namespace Drupal\Tests\toolbar\Functional;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 
 /**
  * Tests that the toolbar icon class remains for translated menu items.
  *
  * @group toolbar
  */
-class ToolbarMenuTranslationTest extends WebTestBase {
+class ToolbarMenuTranslationTest extends BrowserTestBase {
 
   /**
    * A user with permission to access the administrative toolbar.
@@ -66,7 +66,7 @@ public function testToolbarClasses() {
     // Translate the menu item.
     $menu_item_translated = $this->randomMachineName();
     $textarea = current($this->xpath('//textarea'));
-    $lid = (string) $textarea[0]['name'];
+    $lid = (string) $textarea->getAttribute('name');
     $edit = [
       $lid => $menu_item_translated,
     ];
diff --git a/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php b/core/modules/toolbar/tests/src/FunctionalJavascript/ToolbarAdminMenuTest.php
similarity index 96%
rename from core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php
rename to core/modules/toolbar/tests/src/FunctionalJavascript/ToolbarAdminMenuTest.php
index dd4b5c4..e5d20ea 100644
--- a/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php
+++ b/core/modules/toolbar/tests/src/FunctionalJavascript/ToolbarAdminMenuTest.php
@@ -1,11 +1,12 @@
 <?php
 
-namespace Drupal\toolbar\Tests;
+namespace Drupal\Tests\toolbar\FunctionalJavascript;
 
+use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Core\Url;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\language\Entity\ConfigurableLanguage;
-use Drupal\simpletest\WebTestBase;
 use Drupal\user\RoleInterface;
 
 /**
@@ -25,7 +26,7 @@
  *
  * @group toolbar
  */
-class ToolbarAdminMenuTest extends WebTestBase {
+class ToolbarAdminMenuTest extends JavascriptTestBase {
 
   /**
    * A user with permission to access the administrative toolbar.
@@ -297,7 +298,7 @@ public function testLocaleTranslationSubtreesHashCacheClear() {
     // Assume this is the only result.
     // Translate the string to a random string.
     $textarea = current($this->xpath('//textarea'));
-    $lid = (string) $textarea[0]['name'];
+    $lid = (string) $textarea->getAttribute('name');
     $edit = [
       $lid => $translation,
     ];
@@ -330,7 +331,8 @@ public function testSubtreesJsonRequest() {
     // Request a new page to refresh the drupalSettings object.
     $subtrees_hash = $this->getSubtreesHash();
 
-    $ajax_result = $this->drupalGetAjax('toolbar/subtrees/' . $subtrees_hash);
+    $this->drupalGet('toolbar/subtrees/' . $subtrees_hash, ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]);
+    $ajax_result = json_decode($this->xpath('//textarea')[0]->getValue(), TRUE);
     $this->assertResponse('200');
     $this->assertEqual($ajax_result[0]['command'], 'setToolbarSubtrees', 'Subtrees response uses the correct command.');
     $this->assertEqual(array_keys($ajax_result[0]['subtrees']), ['system-admin_content', 'system-admin_structure', 'system-themes_page', 'system-modules_list', 'system-admin_config', 'entity-user-collection', 'front'], 'Correct subtrees returned.');
