Problem/Motivation
Observed in #3315319-9: Random fails in Drupal\Tests\ckeditor5\FunctionalJavascript\AdminUiTest and Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5Test and in #3315490-24: Random fail in Drupal\Tests\layout_builder\FunctionalJavascript\InlineBlockPrivateFilesTest: many tests wait too little (not for enough AJAX responses to arrive) or too much (waiting for an AJAX response that will never come because no AJAX request was triggered, hence waiting for the default timeout of 10 seconds for no reason at all).
Proposed resolution
Make ::assertWaitOnAjaxRequest()
deterministic by making it assert the number of expected AJAX responses. Do not impede the DX by defaulting to incrementing a static variable per test method, but allow explicit testing.
Remaining tasks
User interface changes
None.
API changes
TBD
Data model changes
None.
Release notes snippet
TBD