Problem/Motivation
PHPUnit Test failed to complete; Error: PHPUnit 9.6.8 by Sebastian Bergmann
and contributors.
Testing Drupal\FunctionalJavascriptTests\Ajax\ThrobberTest
.E 2 / 2
(100%)
Time: 00:37.165, Memory: 4.00 MB
There was 1 error:
1)
Drupal\FunctionalJavascriptTests\Ajax\ThrobberTest::testProgressThrobberPosition
Behat\Mink\Exception\ElementNotFoundException: Element matching xpath
"//div[contains(@class,
"dropbutton-wrapper")]/following-sibling::div[contains(@class,
"ajax-progress-throbber")]" not found.
/builds/project/drupal/vendor/behat/mink/src/WebAssert.php:418
/builds/project/drupal/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php:109
/builds/project/drupal/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
ERRORS!
Tests: 2, Assertions: 18, Errors: 1.
Steps to reproduce
Proposed resolution
- Wait for elements that are more specific than (an already present) link text.
- Place hold_test_response at the appropriate position.
- Don't use root user just because it "conveniently" has all permissions.
- Don't use a separate method to prevent a full init and destroy of a testsite for testing one throbber.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|
Issue fork drupal-3387772
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
Comment #3
spokjeComment #4
smustgrave commentedSeems like a simple update and didn't break anything!
Comment #5
catchThis seems good, I'm also seeing random test failures in HEAD on gitlab for this test: https://git.drupalcode.org/project/drupal/-/jobs/113782
Including the one on the pipeline for this MR: https://git.drupalcode.org/issue/drupal-3387772/-/jobs/93792
We probably need to fix that at the same time as this, otherwise it's hard to show this issue hasn't introduced a new failure.
Comment #6
spokjeComment #7
spokjeComment #9
spokjeComment #10
spokjeComment #11
spokjeComment #12
spokjeComment #13
spokjeWell, that wasn't the most "inspired" test I've encountered.
Extra joy-bonus for 100% failing to pass locally.
Anyway, let's see if this is any better.
Comment #14
spokjeOne (per usual)
SQLSTATE[HY000]: General error: 5 database is lockedexception in the SQLite run in 10.000 runs vs 3 actual failures in 5000 runs of the current test.Actual fix in the MR.
Comment #16
spokjeComment #17
spokjeComment #18
spokjeComment #19
spokjeComment #20
smustgrave commentedOpen thread and then can mark.
Comment #21
spokjeGoing to change some stuff and answer thread.
Comment #22
spokjeComment #23
spokjeMoved dropbutton throbber test to the existing test to prevent an extra setup/teardown.
Testing new solution
Comment #24
spokjeComment #25
spokjeWorks, besides the usual SQLite locked DB failure, also seems quite a bit faster:
- Old on PHP 8.2/MySQL 8 1000x
- New 2000x
Comment #26
spokjeAnswering the thread from @catch:
Yes, we do.
We're testing AJAX behaviour _before_ the response arrives and the throbber/whatever is replaced with the actual response.
Somehow
hold_test_responseworks, due to delaying the response by writing to a file it seems.Most of the time we're "saved" by the slowness of Drupal CI and the test is finished before the response arrives. However GitLab seems a tad quicker, thus more random failures on testing this stuff.
The whole methodology is besides non-documented not really deterministic, opened #3390641: Refactor AJAX-testing hold_test test module to do something more along the lines we did in #3375959: Add a way to delay executions in test runner until terminate event completed in the child site.
TLDR: Yes, we need it now and in the future, but we need a better way to temporary delay responses to be able to test "inbetween AJAX response-time" behaviour.
Comment #27
smustgrave commentedAll threads appear to be addressed.
Comment #28
catchCommitted/pushed to 11.x and cherry-picked to 10.1.x, thanks!