Problem/Motivation

https://git.drupalcode.org/issue/drupal-3583486/-/jobs/11292797#L539

✘ Full html
  ┐
  ├ Behat\Mink\Exception\ExpectationException: The string "⬅️✌️➡️NASA is an acronym." was not found anywhere in the HTML response of the current page.
  │
  │ /builds/vendor/behat/mink/src/WebAssert.php:888
  │ /builds/vendor/behat/mink/src/WebAssert.php:363
  │ /builds/core/tests/Drupal/Tests/WebAssert.php:569
  │ /builds/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5AllowedTagsTest.php:466
  ┴

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3614519

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kentr created an issue. See original summary.

velmir_taky made their first commit to this issue’s fork.

velmir_taky’s picture

smustgrave’s picture

velmir_taky’s picture

Reproduced locally - testFullHtml is quite racy on a fast box (~7/8 runs failed for me), and not only at line 466.

Root cause: saving the node is a plain form submit that redirects to the rendered entity. That navigation isn't tracked by assertWaitOnAjaxRequest(), and nothing waits for it, so the next step runs against the wrong page. It shows up in two ways:
- the responseContains() right after a save reads the still-open edit page (the reported line 466), and
- the drupalGet('...manage/full_html') after the first save loses the race to the save redirect - the browser ends up back on the node instead, so roles[authenticated] isn't found. Confirmed from the browser output (page was "My test content", not the format form).

There's already a waitForText('NASA is an acronym.') after one of the saves, so the pattern was there - I just applied it to every node save in the test and pulled it into a small saveNodeAndWait() helper so the wait isn't copy-pasted. The first save renders via Plain Text (tags escaped), so it waits on the title instead.

Stats (local, testFullHtml run in a loop, same box):

Before (current main):

15 runs -> 5 passed, 10 failed
  failed at line 439 (checkField('roles[authenticated]')): 6
  failed at line 464 (responseContains):                    4

After (this MR):

15 runs -> 15 passed, 0 failed
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Thank you for providing that :) Stats LGTM.

catch’s picture

Status: Reviewed & tested by the community » Needs review

I think it would be clearer to have the ::waitForText() calls inline (as is the case with one call that was replaced by the helper).

velmir_taky’s picture

Inlined the waitForText() calls and dropped the helper, thanks.

catch’s picture

Status: Needs review » Reviewed & tested by the community

Thanks I think that looks good now.

godotislate’s picture

Ran the repeat test, set for 1000: https://git.drupalcode.org/issue/drupal-3614519/-/jobs/11325976
The job exceeded the 30min limit after ~500 times, and in that period, the test failed once. Since the job timed out, there's no have any report about the test failure though.

  • catch committed dd283a43 on 11.x
    fix: #3614519 [random test failure] CKEditor5AllowedTagsTest::...

  • catch committed a1eb6504 on main
    fix: #3614519 [random test failure] CKEditor5AllowedTagsTest::...
catch’s picture

Version: main » 11.x-dev
Status: Reviewed & tested by the community » Fixed

Since this is failing a lot more than that currently, let's get this in, but might need to open an new issue if it keeps failing 1/500 times.

Committed/pushed to main and 11.x, thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

kentr’s picture

There's another failure in the same test, but it looked like a different problem to me: #3616199: [random test failure] CKEditor5AllowedTagsTest::testFullHtml

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.