Problem/Motivation
https://git.drupalcode.org/project/drupal/-/jobs/11167172#L550
✘ Widget
┐
├ "Bear" was found but shouldn't be there.
├ Failed asserting that a boolean is not empty.
│
│ /builds/core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php:90
│ /builds/core/modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php:249
┴
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3613225
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:
- 3613225-random-test-failure
changes, plain diff MR !16529
Comments
Comment #4
velmir_taky commentedThe exposed Name filter submits over AJAX, but the test never waits for it —
waitForText('Dog')can't sync it, since"Dog"is on the page both before and after filtering. Measured it directly: right after thatwaitForText('Dog'),jQuery.active === 1and"Bear"is still on the page — the filter request is still in flight and the DOM is stale. The followingwaitForNoText('Bear')then races that request; under load it loses, which is the reported failure.WidgetViewsTestalready handles the same filter correctly — press "Apply filters",assertWaitOnAjaxRequest(), then assert. Aligned this one to match.Comment #5
smustgrave commentedThink it makes sense to just check for the text after the Ajax.
Comment #6
catchWe should try to use https://www.drupal.org/node/3401201 assertExpectedAjaxRequest() here.
Comment #7
velmir_taky commentedSwitched both waits to
assertExpectedAjaxRequest().The counts are cumulative for the page, so with the media library dialog already open they land at 9 and 10 (same pattern as
HtmxDynamicFormTest;ExposedFilterAJAXTestuses 1 only because its filter sits on a fresh page). Confirmed deterministic locally, and it also asserts nothing else fired between the two applies.Comment #8
smustgrave commented@catch will let you decide but testWidgetPreview in the same file is marked skipped and suspect the same fix could be applied. Which would make #3569225: [random test failure] EntityReferenceWidgetTest::testWidgetPreview obsolete.
Comment #9
catchSo that looks better but it means we have 8 AJAX requests which aren't asserted.
I think we can resolve that in #3569225: [random test failure] EntityReferenceWidgetTest::testWidgetPreview though so going ahead here - this test is failing quite frequently on HEAD.