Problem/Motivation
NodeDeleteConfirmTest failed in 3 of 3 local runs. The failing line changed between runs:
testNodeDelete, line 71:StaleElementReference: stale element not foundtestNodeDelete, line 108:The text "The Article Delete article from views entity operations has been deleted." was not found anywhere in the text of the current page.testNodeTypeDelete, line 125:NoSuchElement: Unable to locate element: {"method":"xpath","selector":"//html"}
The test presses Delete in the confirmation dialog. The form submit loads a new page. pageTextContains() runs before the new page has loaded.
Steps to reproduce
./vendor/bin/phpunit -c core core/modules/node/tests/src/FunctionalJavascript/NodeDeleteConfirmTest.php
Environment: Drupal 12.0-dev (main at 4f9558d85e), Arch Linux, PHP 8.5.11, PHP built-in web server, SQLite 3.54.0, headless Chromium 154.0.8037.97 with chromedriver.
Proposed resolution
Replace the five pageTextContains() calls after a dialog Delete click with statusMessageContainsAfterWait(). With this change, the test passed in 10 of 10 local runs.
Remaining tasks
Review the merge request.
User interface changes
None.
Introduced terminology
None.
API changes
None.
Data model changes
None.
Release notes snippet
None.
Generated with the help of an LLM.
Issue fork drupal-3630734
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
zach schneider commentedThe test checked for the "has been deleted" message right after pressing Delete in the dialog. The dialog submit and redirect can finish after that check runs. The check then fails.
The MR replaces
pageTextContains()withstatusMessageContainsAfterWait()in the 5 places that check a delete message. That method waits up to 10 seconds for the status message to appear.MR !17439 is ready for review.
Comment #4
acbramley commentedAre there any examples of this failing in CI?