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

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

Status: Active » Needs review

The 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 that waitForText('Dog'), jQuery.active === 1 and "Bear" is still on the page — the filter request is still in flight and the DOM is stale. The following waitForNoText('Bear') then races that request; under load it loses, which is the reported failure.

WidgetViewsTest already handles the same filter correctly — press "Apply filters", assertWaitOnAjaxRequest(), then assert. Aligned this one to match.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Think it makes sense to just check for the text after the Ajax.

catch’s picture

Status: Reviewed & tested by the community » Needs work

We should try to use https://www.drupal.org/node/3401201 assertExpectedAjaxRequest() here.

velmir_taky’s picture

Status: Needs work » Needs review

Switched 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; ExposedFilterAJAXTest uses 1 only because its filter sits on a fresh page). Confirmed deterministic locally, and it also asserts nothing else fired between the two applies.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

@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.

catch’s picture

Status: Reviewed & tested by the community » Fixed

So 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.

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.

  • catch committed b2307c25 on main
    fix: #3613225 [random test failure] EntityReferenceWidgetTest::...

Status: Fixed » Closed (fixed)

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