- Issue created by @catch
- First commit to issue fork.
- 🇦🇺Australia acbramley
Funnily enough encountered this one again while testing 🐛 [random test failure] EditorSecurityTest::testEditorXssFilterOverride Active
There were 2 failures in the same area though. IMO we could probably just remove the
$this->assertTrue($page->hasCheckedField('options[expose_button][checkbox][checkbox]'));
assert, why do we need to assert that the expose checkbox is still checked after clicking it in a test that is testing specific filter (entity reference) stuff? We already do$assert->waitForField('options[expose][multiple]');
straight after.In any case, we can simply do an ajax wait instead since the checkbox triggers it. I'll set up 2 other MRs to run the tests 7500 times to see how many fails we get.
- 🇦🇺Australia acbramley
MR to review: https://git.drupalcode.org/project/drupal/-/merge_requests/11282/diffs
Repeat with fix: https://git.drupalcode.org/issue/drupal-3502658/-/jobs/4660496
Repeat without fix: https://git.drupalcode.org/issue/drupal-3502658/-/jobs/4660409 - 🇦🇺Australia acbramley
Maybe 7500 runs was too much, both timed out before they could finish.
However, the without fix job failed over 120 times
The with fix job did not fail.I think this is good to go
- 🇺🇸United States dww
Great work here! The change is exactly the right fix for random fails in JS tests: if we're trying to use an element, we need to wait for the AJAX request to complete before we proceed. As @catch's initial attempt shows, we can't just wait on the field itself -- it's already there. 😅 We need to wait on the AJAX request that clicking that field triggers.
The 2 repeat MRs show that the fix is indeed solving the problem.
Nothing left to improve. RTBC.
Thanks!
-Derek - 🇫🇷France nod_ Lille
Committed and pushed 8610d622f11 to 11.x and 43c52bdf4a4 to 10.5.x and 750f5decb21 to 11.1.x and d5035b8d3c0 to 10.4.x. Thanks!
- 🇬🇧United Kingdom catch
I think we should have used
assertExpectedAjaxRequest()
here (see https://www.drupal.org/node/3401201 → and the issue for why), but as long as this fixes most of the random test failures it's a massive step forwards and we have other usages to convert still so it can happen alongside those. - 🇦🇺Australia acbramley
Woops, I always forget about that one. Happy to follow up with changing it over.
- Status changed to Fixed
19 days ago 7:39am 29 March 2025 Automatically closed - issue fixed for 2 weeks with no activity.
- 🇦🇺Australia mstrelan
Opened 🐛 [random test failure] FilterEntityReferenceTest (again) Active as this test can still randomly fail