Closed (fixed)
Project:
Drupal core
Version:
9.3.x-dev
Component:
ckeditor5.module
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Nov 2021 at 08:52 UTC
Updated:
29 Mar 2022 at 14:02 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
lauriiiComment #3
lauriiiHere's patch from #2 without the
drupalci.ymlchanges.Comment #4
wim leersFascinating!
So your theory is … that the file upload did not properly finish? 🤔
Comment #5
lauriii#4 that's right.
We should probably remove this since the image upload is not a Drupal Ajax request meaning that this doesn't do what we expect it to do.
Comment #6
mondrakeBumping to critical, this is rather consistently failing on 9.4.x HEAD for Postgres
Comment #7
lauriiiThis implements the change I proposed in #5.
Comment #8
bnjmnmThis is a pretty unambiguous improvement. The test had been calling
$assert_session->assertWaitOnAjaxRequest();to wait for the completion of the image upload/render before advancing. However, that process is not handled by an AJAX request.assertWaitOnAjaxRequest()introduces a brief wait, long enough to be sufficient for tests to sometimes pass, particularly in faster environments. It's not surprising that this use of$assert_session->assertWaitOnAjaxRequest();is causing intermittent failures.By changing this to
$this->assertNotEmpty($assert_session->waitForElement('css', '.ck-content img[data-entity-uuid]'));, the test is actually waiting for the upload/render to complete before advancing. Waiting for an element to appear/disappear is preferable toassertWaitOnAjaxRequest();even in situations where Ajax requests are being used, so this is a welcome change, and one I'm glad @lauriii spotted.Comment #9
wim leers+1000!
Wow.
What a find.
Image uploads in CKEditor 5 are handled slightly differently than in CKEditor 4; they're uploaded by the CKEditor 5 plugin itself, not via a clunky Drupal-owned, AJAX-powered
EditorImageDialog. That's whyassertWaitOnAjaxRequest()is not sufficient in this case. It went unnoticed all this time just because only PostgreSQL tests happen to be slower… 🤯Epic find, @lauriii!
Agreed with RTBC.
Comment #12
catchCommitted/pushed to 9.4.x and cherry-picked to 9.3.x, thanks!
Comment #14
grevil commentedHey guys, I know this issue is closed, but I just stumbled upon it and was wondering how it is possible to run "waitForElement()" on $assert_session?
$assert_session is initialized with,
$assert_session = $this->assertSession();and "$this->assertSession()" will return a "\Drupal\Tests\WebAssert" Object.But in https://api.drupal.org/api/drupal/core%21tests%21Drupal%21Tests%21WebAss..., there is not a single note about "waitForElement()". Am I missing something? Or is it just not documented yet?