[Random test failure] Random failure in CKEditor5AllowedTagsTest::testMediaElementAllowedTags

Created on 22 June 2023, over 1 year ago
Updated 16 August 2023, about 1 year ago

Problem/Motivation

From the eternal random failure gold mine that is the qa runs ( https://www.drupal.org/node/3060/qa ):

There was 1 error:

1) Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5AllowedTagsTest::testMediaElementAllowedTags
Behat\Mink\Exception\ElementNotFoundException: Form field with id|name|label|value "filters[media_embed][settings][allowed_view_modes][view_mode_2]" not found.

/var/www/html/vendor/behat/mink/src/Element/TraversableElement.php:207
/var/www/html/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5AllowedTagsTest.php:386
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:728

https://www.drupal.org/pift-ci-job/2696423

Steps to reproduce

This one had me searching for a while...

Over here 📌 [Ignore] In space (and/or this issue), no one can hear patches scream VI Closed: outdated I took a screenshot and dumped the HTML when the ElementNotFoundException is thrown.

The screenshot shows that view_mode_2 is actually not present, there's no AJAXing going on, and the page looks (and turns out to be) completely loaded:

(HTML as txt-file is here )

As it turns out, we start the test by going to the 'admin/config/content/formats/add' page in \Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5TestBase::createNewTextFormat, do some stuff and then create two new EntityViewModes.

This can be appearantly to slow for the page to pick up on it, or at least sometimes to pick up on the last of the two, which then does not get displayed when we enable the embed media option.

Proposed resolution

Move the creation of the two new EntityViewModes to the front of the test.

Also, as already said in #7 🐛 [Random test failure] Random failure in CKEditor5AllowedTagsTest::testMediaElementAllowedTags Fixed , the waitForField without checking its output is basically a convuloted way to add a sleep.

We remove it, replace it with a $assert_session->assertWaitOnAjaxRequest(), since the line before it ($page->clickLink('Embed media')) triggers an AJAX request.

Finally we remove the $assert_session->assertWaitOnAjaxRequest() below the two checkFields in line 387-388, since they don't trigger any AJAX request and waiting on that is useless.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Fixed

Version

10.1

Component
CKEditor 5 

Last updated 1 day ago

Created by

🇳🇱Netherlands spokje

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024