Symptom Several LightboxIT tests fail intermittently in LightboxPage#openLightboxAtImage: the image popover is displayed, but clicking its "open lightbox" button fails with:
Seen on Environment Tests, each time on Chrome 153 and each time failing 2 tests in the same run:
- stable-18.8.x #19 (2026-09-30): openImageWithCaptionAndManuallyAddedId, openImageWithoutDescription
- stable-18.4.x #137 (2026-09-27): openImageWithoutDescription, verifyDownload
This is a different failure from XWIKI-24532 (a timeout waiting for the popover to show up), which hasn't recurred. stable-18.4.x doesn't have the XWIKI-24532 change, so that change isn't the cause. Cause lightbox.js rebuilds the popover content from #imageToolbarTemplate each time the popover is shown (content is a function returning the template HTML). Any mousemove reaching the image after the popover became visible re-shows it 500ms later, which replaces the .openLightbox button the test has just located. One likely source is a mousemove that Chrome synthesizes after the popover insertion changes the layout under the still pointer. A popover hide (which detaches it) has the same effect. Fix ImagePopover#openLightbox() now catches StaleElementReferenceException/NoSuchElementException, waits for the popover to be displayed again and clicks the new button (up to 3 attempts). |