diff --git a/core/modules/toolbar/tests/src/FunctionalJavascript/ToolbarStoredStateTest.php b/core/modules/toolbar/tests/src/FunctionalJavascript/ToolbarStoredStateTest.php
index 7e2d7b5e0c3b3d0dcacff1aa973b140b0f1ab82e..b6be1e816e083fd9ff5e212c1bac0994951bc28f 100644
--- a/core/modules/toolbar/tests/src/FunctionalJavascript/ToolbarStoredStateTest.php
+++ b/core/modules/toolbar/tests/src/FunctionalJavascript/ToolbarStoredStateTest.php
@@ -95,6 +95,7 @@ public function testToolbarStoredState(): void {
     $this->assertSame($expected, $toolbar_stored_state);
 
     $this->getSession()->resizeWindow(600, 600);
+    $this->getSession()->wait(1000, "JSON.parse(sessionStorage.getItem('Drupal.toolbar.toolbarState')).isFixed == false");
 
     // Update expected state values to reflect the viewport being at a width
     // that is narrow enough that the toolbar isn't fixed.