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

SyntaxHighlightingIT#highlightContent is flickering

    XMLWordPrintable

Details

    • Unknown
    • org.xwiki.test.ui.docker.AllIT$NestedSyntaxHighlightingIT#highlightContent

    Description

      The functional test org.xwiki.test.ui.docker.AllIT$NestedSyntaxHighlightingIT#highlightContent fails intermittently on ci.xwiki.org.

      Occurrence

      • Seen in https://ci.xwiki.org/job/XWiki/job/xwiki-platform/job/stable-18.4.x/217/testReport/ (commit 89eec5c383f), environment: default configuration of the main job (Jetty standalone, HSQLDB, Firefox).
      • History: 1 failure in 20 builds of the stable-18.4.x main job; passes on master, stable-18.8.x and stable-17.10.x.
      • Local verification on 89eec5c383f: the whole module passed with the CI Maven options, and the test passed 20/20 when repeated alone.

      Error

      org.openqa.selenium.StaleElementReferenceException: The element with the reference c05dbaa3-40f9-4054-a91f-3114388bef4f is stale; either its node document is not the active document, or it is no longer connected to the DOM
      	at org.xwiki.test.ui.docker.SyntaxHighlightingIT.getLines(SyntaxHighlightingIT.java:99)
      	at org.xwiki.test.ui.docker.SyntaxHighlightingIT.highlightContent(SyntaxHighlightingIT.java:88)
      

      Analysis

      SyntaxHighlightingIT#getLines finds the pre.CodeMirror-line elements without waiting and then calls getText() on each. CodeMirror replaces those nodes on every re-render (after the input is processed, after the highlighting pass, on refresh), so when a re-render happens between the lookup and the read the element is stale. The assertion right after typing (assertEquals(List.of(CONTENT, ADDED_CONTENT), getLines(driver))) also does not wait for the expected state.

      Possible fix

      Wait until getLines() returns the expected lines, retrying on StaleElementReferenceException (same for getMacroMarkers).

      Attachments

        Activity

          People

            Unassigned Unassigned
            mleduc Manuel Leduc
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: