diff --git a/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5Test.php b/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5Test.php
index deb37c9455fb596ec4b67718b1664749fafa1ff0..f68274ddc67b5f816d530d615061db384f58e636 100644
--- a/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5Test.php
+++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5Test.php
@@ -381,7 +381,10 @@ public function testEditorFileReferenceIntegration() {
     $this->assertNotEmpty($image_upload_field = $page->find('css', '.ck-file-dialog-button input[type="file"]'));
     $image = $this->getTestFiles('image')[0];
     $image_upload_field->attachFile($this->container->get('file_system')->realpath($image->uri));
-    $assert_session->assertWaitOnAjaxRequest();
+    // Wait until preview for the image has rendered to ensure that the image
+    // upload has completed and the image has been downcast.
+    // @see https://www.drupal.org/project/drupal/issues/3250587
+    $this->assertNotEmpty($assert_session->waitForElement('css', '.ck-content img[data-entity-uuid]'));
     $page->pressButton('Save');
 
     $uploaded_image = File::load(1);