Problem/Motivation
Drupal\Tests\field_ui\FunctionalJavascript\ManageFieldsTest::testAddField failed on an MR that doesn't touch Field UI (#3626907: Random test failures on ThemeSettingsFormTest::testFormSettingsSubmissionHandler, which only changes ThemeSettingsFormTest). Job: https://git.drupalcode.org/issue/drupal-3626907/-/jobs/12525687
Manage Fields (Drupal\Tests\field_ui\FunctionalJavascript\ManageFields) ✘ Add field ├ WebDriver\Exception\MoveTargetOutOfBounds: move target out of bounds ├ (Session info: chrome=133.0.6943.126) │ /builds/vendor/lullabot/mink-selenium2-driver/src/Selenium2Driver.php:982 │ /builds/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php:91 │ /builds/vendor/behat/mink/src/Element/TraversableElement.php:119 │ /builds/core/modules/field_ui/tests/src/FunctionalJavascript/ManageFieldsTest.php:291
The other six tests in the class passed in the same run.
The failing step is the Save click after the dialog moves from choosing the field type to the field settings form:
$buttons = $this->assertSession()->elementExists('css', '.ui-dialog-buttonpane'); $buttons->pressButton('Continue'); $this->assertSession()->assertWaitOnAjaxRequest(); $buttons = $this->assertSession()->elementExists('css', '.ui-dialog-buttonpane'); $buttons->pressButton('Save');
Before clicking, Selenium2Driver::clickOnElement() moves the mouse to the element with a WebDriver pointerMove action. If the Save button's center is outside the viewport at that moment, WebDriver throws MoveTargetOutOfBounds. The likely cause is that the dialog is still being resized or repositioned after the AJAX swap. assertWaitOnAjaxRequest() waits for the request to finish, but not for the dialog to settle.
DrupalSelenium2Driver::click() is meant to smooth over this kind of timing issue: it retries a click for up to 10 seconds when JSWebAssert::isExceptionNotClickable() matches the exception. That method only matches /not (clickable|interactable|visible)/, though, so "move target out of bounds" is rethrown on the first attempt instead of being retried.
Steps to reproduce
Timing-dependent; seen once so far, in the job linked above. Running ManageFieldsTest through the "Repeat Class Test" CI job may reproduce it.
Proposed resolution
Two options, open to discussion:
- Treat "move target out of bounds" as a not-clickable exception in
JSWebAssert::isExceptionNotClickable(), soDrupalSelenium2Driver::click()retries it like the others. This would help any test that clicks an element that is still moving, but it could also hide a real bug where an element never scrolls into view. - Fix only this test: after
Continue, wait for the settings form's Save button to be visible and in place before pressing it.
Remaining tasks
- Agree on an approach.
- MR, with a Repeat Class Test run as evidence.
User interface changes
N/A
Introduced terminology
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
N/A
AI disclosure
Author used Claude Code to trace this failure through the WebDriver stack and AI helped write this issue.
Comments
Comment #2
matthand