Problem/Motivation
Drupal\Tests\layout_builder\FunctionalJavascript\InlineBlockPrivateFilesTest is randomly failing at the moment. The fail is:
1) Drupal\Tests\layout_builder\FunctionalJavascript\InlineBlockPrivateFilesTest::testPrivateFiles
Behat\Mink\Exception\ElementNotFoundException: Form field with id|name|label|value "files[settings_block_form_field_file_0]" not found.
/var/www/html/vendor/behat/mink/src/Element/TraversableElement.php:292
/var/www/html/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockPrivateFilesTest.php:272
/var/www/html/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockPrivateFilesTest.php:177
/var/www/html/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockPrivateFilesTest.php:120
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:726
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | 3315490-21.patch | 1.7 KB | alexpott |
| #22 | 21-22-interdiff.txt | 1.11 KB | alexpott |
| #21 | 3315490-21.patch | 1.7 KB | alexpott |
| #20 | 3315490-20.patch | 6.75 KB | alexpott |
| #19 | 3315490-19.patch | 6.61 KB | alexpott |
Comments
Comment #2
alexpottLet's cause it fail all the time...
Comment #4
alexpottComment #6
alexpottLet's get a screenshot of what happens
Comment #8
alexpottComment #10
alexpottComment #11
alexpottComment #13
alexpottLet's get more info...
Comment #15
alexpottComment #17
alexpottComment #19
alexpottSo the problem is that for some reason clicking on the remove button in replaceFileInBlock doesn't work...
Comment #20
alexpottBorrowing code from \Drupal\Tests\layout_builder\FunctionalJavascript\InlineBlockTestBase::removeInlineBlockFromLayout() which also clicks a remove button in off canvas after opening the setting tray.
Comment #21
alexpottAnother one done.
Comment #22
alexpottLet's use the local variable. Makes no difference to the fix.
Comment #23
alexpottInteresting fail on postgres - so #20 does not 100% fix the issue but it does help in 349/350 instances... Maybe this is good enough to commit here and open a follow-up to make better?
Comment #26
wim leersRemoves one excess "wait on AJAX request" and just waits for the button to be pressed to appear. Makes sense.
This one looks more suspicious: we're waiting for something even though we didn't do anything here, so why wait?
Unless this is a helper method that should always be called after waiting for an AJAX response maybe?
Hah, #23 seems to confirm this.
What would IMHO help here is to use something like
\Drupal\Tests\ckeditor5\FunctionalJavascript\AdminUiTest::getAjaxResponseCount()— that would make these tests deterministic in terms of how many AJAX responses should've been processed at every point. Right now, the code is just sprinkled withassertWaitOnAjaxRequest()at both necessary and unnecessary times; it's both waiting too much and too little, which is why it's so sensitive to timing problems.Opened #3316274: Stabilize FunctionalJavascript testing AJAX: add ::assertExpectedAjaxRequest() for that.
I agree with
🚢
P.S.: ironically, the failures in #21 and #22 are in
Drupal\FunctionalJavascriptTests\Tests\JSWebAssertTest, 100% unrelated to this patch :PComment #27
catchCommitted/pushed to 10.1.x, cherry-picked back through to 9.4.x, thanks!
Comment #29
catch