Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-25066

LightboxIT fails intermittently with a StaleElementReferenceException when opening the lightbox from the image popover

    XMLWordPrintable

Details

    • Integration
    • Unknown
    • N/A
    • N/A
    • org.xwiki.image.lightbox.test.ui.AllIT$NestedLightboxIT#openImageWithCaptionAndManuallyAddedId

    Description

      Symptom

      Several LightboxIT tests fail intermittently in LightboxPage#openLightboxAtImage: the image popover is displayed, but clicking its "open lightbox" button fails with:

      org.openqa.selenium.StaleElementReferenceException: stale element reference: stale element not found in the current frame
      	at org.xwiki.image.lightbox.test.po.ImagePopover.openLightbox(ImagePopover.java:62)
      	at org.xwiki.image.lightbox.test.po.LightboxPage.openLightboxAtImage(LightboxPage.java:96)
      	at org.xwiki.image.lightbox.test.ui.LightboxIT.openImageWithCaptionAndManuallyAddedId(LightboxIT.java:176)
      

      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).

      Attachments

        Issue Links

          Activity

            People

              vmassol Vincent Massol
              vmassol Vincent Massol
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: