From 29349880c6c2a916937800236b56d77cd385dcf3 Mon Sep 17 00:00:00 2001 From: catch Date: Wed, 26 Oct 2022 15:36:58 +0100 Subject: [PATCH] Issue #3317330 by Wim Leers, nod_: Random failure in ImageTest::testAltTextRequired (cherry picked from commit e9d3e92f882e2301c2c03b018b44b3a86cb78171) --- .../ckeditor5/tests/src/FunctionalJavascript/ImageTest.php | 2 ++ .../tests/src/FunctionalJavascript/ImageTestBase.php | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTest.php b/core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTest.php index ec957bb8c98..2701e48dd95 100644 --- a/core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTest.php +++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTest.php @@ -124,6 +124,8 @@ class ImageTest extends ImageTestBase { $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)); + // Wait for the image to be uploaded and rendered by CKEditor 5. + $this->assertNotEmpty($this->assertSession()->waitForElementVisible('css', '.ck-widget.image > img[src*="' . $image->filename . '"]')); } /** diff --git a/core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestBase.php b/core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestBase.php index 42863411758..e92aea760e8 100644 --- a/core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestBase.php +++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestBase.php @@ -89,6 +89,8 @@ abstract class ImageTestBase extends CKEditor5TestBase { $src_input = $panel->find('css', 'input[type=text]'); $src_input->setValue($src); $panel->find('xpath', "//button[span[text()='Insert']]")->click(); + // Wait for the image to be uploaded and rendered by CKEditor 5. + $this->assertNotEmpty($this->assertSession()->waitForElementVisible('css', '.ck-widget.image > img[src="' . $src . '"]')); } /** @@ -435,8 +437,7 @@ abstract class ImageTestBase extends CKEditor5TestBase { $this->drupalGet($this->host->toUrl('edit-form')); $this->waitForEditor(); $this->addImage(); - $this->assertNotEmpty($assert_session->waitForElementVisible('css', '.ck-widget.image')); - $this->assertNotEmpty($assert_session->waitForElementVisible('css', '.ck-balloon-panel')); + $this->assertNotEmpty($assert_session->waitForElementVisible('css', '.ck-text-alternative-form')); $this->assertVisibleBalloon('.ck-text-alternative-form'); }