Problem/Motivation
The FunctionalJavascript test testTheSteppersQuantityIsBooked, in modules/yoyaku_calendar/tests/src/FunctionalJavascript/OfferStepperTest.php, fails intermittently, and reddens the phpunit job of merge requests that change nothing under yoyaku_calendar. Seen red on the job for #3616297: Offer an area whose places the house gives out, which touches no file in that submodule; retrying the same job on the same commit passed.
What it is
A read taken after the "View cart" submit could land on the page the submit was pressed from rather than on the page it brought back. Both carry the same offer card, so waitForElement matches straight away against the document being left, and the element handle it returns dies under WebDriver as the rebuilt page arrives. That is the WebDriver StaleElementReference in the job log.
Measured by stamping the pre-submit document and watching for the stamp to go: in one run out of three concurrent ones, pressButton returned with the old document still in place for another 71 milliseconds. The quantity itself was never wrong: fourteen samples all read 2, present within 2 to 226 milliseconds. An earlier reading of this issue suggested the value came back wrong under load. That is not what the measurements show, and this summary is corrected accordingly.
Under heavier load, six concurrent runs of the single test, chromedriver times out receiving messages from the renderer. That is the machine running out of room rather than this failure, and no test change addresses it.
Proposed resolution
Pin every read after a real submit to the page that came back: stamp the document, press, and wait for the stamp to be gone. The helper's poll tolerates the one exception a read can throw as the document is replaced, and fails with a sentence naming the timeout when no new page arrives. The read then re-finds the field instead of using a handle taken earlier.
Remaining tasks
- Review the merge request.
AI-Generated: Yes (Claude Code was used to help draft this issue summary and to write the test change on the merge request. I reviewed and ran the work myself before posting it, including the measurements quoted above.)
Issue fork yoyaku-3616873
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
mably commentedComment #5
mably commentedComment #7
mably commented