XWIKI-23126: NavigationPanelAdministrationIT#navigationPanelAdministration is flickering - #6042
Merged
Merged
Conversation
…ation is flickering The exclude()/include() drag-and-drop actions and getPageByTitle() (used by isPinned/pinPage/unpinPage/dragBefore) read the jsTree DOM immediately, with no wait for the client-side JS mutation (or the tree's initial AJAX load after a page reload) to be reflected, causing the test to sometimes observe the tree mid-mutation or before it's ready. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation and see the Github Action logs for details |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira URL
https://jira.xwiki.org/browse/XWIKI-23126
Changes
Description
NavigationPanelAdministrationPage(page object used byNavigationPanelAdministrationIT) that caused the test to intermittently read the navigation tree mid-mutation or before it had finished (re)loading.Clarifications
Investigated via Develocity (
community.develocity.cloud): over the last 30 days the test failed in ~4.2% of its 718 runs (30 failures + 1 flaky), spread acrossmasterandstable-16.10.x, multiple browsers/DBs/CI agents — ruling out CI infra as the cause. The failures fell into a few related assertion-mismatch signatures aroundgetNavigationTree().getTopLevelPages()flip-flopping between the real page list,[], and the"No pages found"placeholder, plus oneNoSuchElementExceptioninisPinned().Root cause, confirmed by reading the client-side JS (
PanelsCode/NavigationConfigurationSheet.xml) and the page objects:exclude()/include()perform a Selenium drag-and-drop that triggers purely client-side, synchronous jQuery/jsTree DOM mutations (show_node/hide_node/create_node+ the"No pages found"placeholder toggle) — there's no server round-trip. ButNavigationPanelAdministrationPagereturned immediately after the drag-and-drop call, before that mutation was necessarily reflected in the DOM, so a caller reading the tree right after could observe a mix of pre- and post-mutation state.getPageByTitle()(used byisPinned/pinPage/unpinPage/dragBefore) searched the tree without first waiting for it to be ready, which raced with the tree's initial AJAX load right after a page reload (saveAndReload()), producing the observedNoSuchElementException.getNavigationTree()'s existingwaitForIt()doesn't help here: it only waits for.jstree-container-ulto exist andaria-busy != "true", andaria-busyis only toggled during the tree's initial load — it becomes a permanent no-op for every later mutation.This is a reopened manifestation of the previously "fixed" XWIKI-21606 — that earlier fix (March 2025) was incomplete, since it didn't add real synchronization after
exclude/include/pin/dragBefore.Fix:
exclude()/include()now wait (waitUntilTopLevelPagesState) until the dragged pages have actually become hidden/visible in the tree before returning, andgetPageByTitle()now waits for the tree to finish (re)loading (getNavigationTree()) before searching it.Out of scope: a separate, distinct test-isolation issue was also observed in the Develocity data (extra top-level pages leaking in from sibling nested tests in the same
AllITsuite) — unrelated to this DOM-timing race, not fixed here.Screenshots & Video
N/A (test-only change, no product UI change).
Executed Tests
mvn clean verify -pl .../xwiki-platform-panels-test-pageobjects -Plegacy— compiles cleanly, 0 Checkstyle violations.@Testwith@RepeatedTest(value = N, failureThreshold = 1)onnavigationPanelAdministrationand running it against a real Docker/Firefox instance:mvn clean install -pl .../xwiki-platform-panels-test-docker -Plegacy,integration-tests,docker -Dit.test=AllIT$NestedNavigationPanelAdministrationIT#navigationPanelAdministration -Dxwiki.test.ui.browser=firefox@RepeatedTestchange was reverted before this PR; only the actual page-object fix is included.Expected merging strategy
🤖 Generated with Claude Code