XWIKI-24806: TextAreaImageUploadIT is flickering and its missing edit-mode cleanup fails the rest of AllIT - #6309
Merged
Merged
Conversation
…-mode cleanup fails the rest of AllIT * Discard the unsaved changes after each test, so that a failure no longer leaves an armed beforeunload handler that blocks every test running after it in the shared browser session. * Add CKEditor#discardUnsavedChanges() to the page objects, marking every editor instance on the page as clean. This is what arms the leave confirmation for the comment, the annotation and the in-place property, all edited on a view page where there is no edit mode to leave. * Leave the edit mode for the object editor, which asks for confirmation based on its own form state. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
github-actions Bot
pushed a commit
that referenced
this pull request
Sep 4, 2026
…-mode cleanup fails the rest of AllIT (#6309) * Discard the unsaved changes after each test, so that a failure no longer leaves an armed beforeunload handler that blocks every test running after it in the shared browser session. * Add CKEditor#discardUnsavedChanges() to the page objects, marking every editor instance on the page as clean. This is what arms the leave confirmation for the comment, the annotation and the in-place property, all edited on a view page where there is no edit mode to leave. * Leave the edit mode for the object editor, which asks for confirmation based on its own form state. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> (cherry picked from commit 879250a)
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation and see the Github Action logs for details |
github-actions Bot
pushed a commit
that referenced
this pull request
Sep 4, 2026
…-mode cleanup fails the rest of AllIT (#6309) * Discard the unsaved changes after each test, so that a failure no longer leaves an armed beforeunload handler that blocks every test running after it in the shared browser session. * Add CKEditor#discardUnsavedChanges() to the page objects, marking every editor instance on the page as clean. This is what arms the leave confirmation for the comment, the annotation and the in-place property, all edited on a view page where there is no edit mode to leave. * Leave the edit mode for the object editor, which asks for confirmation based on its own form state. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> (cherry picked from commit 879250a)
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation and see the Github Action logs for details |
vmassol
added a commit
that referenced
this pull request
Sep 4, 2026
…-mode cleanup fails the rest of AllIT (#6309) (#6310) * Discard the unsaved changes after each test, so that a failure no longer leaves an armed beforeunload handler that blocks every test running after it in the shared browser session. * Add CKEditor#discardUnsavedChanges() to the page objects, marking every editor instance on the page as clean. This is what arms the leave confirmation for the comment, the annotation and the in-place property, all edited on a view page where there is no edit mode to leave. * Leave the edit mode for the object editor, which asks for confirmation based on its own form state. (cherry picked from commit 879250a) Co-authored-by: Vincent Massol <vincent@massol.net> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
vmassol
added a commit
that referenced
this pull request
Sep 4, 2026
…-mode cleanup fails the rest of AllIT (#6309) (#6311) * Discard the unsaved changes after each test, so that a failure no longer leaves an armed beforeunload handler that blocks every test running after it in the shared browser session. * Add CKEditor#discardUnsavedChanges() to the page objects, marking every editor instance on the page as clean. This is what arms the leave confirmation for the comment, the annotation and the in-place property, all edited on a view page where there is no edit mode to leave. * Leave the edit mode for the object editor, which asks for confirmation based on its own form state. (cherry picked from commit 879250a) Co-authored-by: Vincent Massol <vincent@massol.net> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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-24806
Changes
Description
TextAreaImageUploadIT, so that a test failing in the middle of an edit no longer leaves the page with an armedbeforeunloadhandler.CKEditor#discardUnsavedChanges()to the CKEditor page objects, marking every editor instance on the current page as clean.Clarifications
AllITruns all its@NestedITs in a single shared browser session, withNestedTextAreaImageUploadITfirst.TextAreaImageUploadIThad no@AfterEach, so when one of its tests failed mid-edit the leave confirmation stayed armed and the next navigation died withUnhandledAlertException: Unexpected beforeunload dialog detected(InvalidArgumentException: Unexpected dialog type beforeunloadon Chrome). Every remaining nested IT then failed in its setup, so a single flickering test produced six failures — see the two builds of 2026-09-03 linked from the issue, one of which also spent 422 s hung on a singledriver.get().The cleanup needs two steps because two different mechanisms ask for confirmation:
TestUtils#maybeLeaveEditMode()is a no-op (window.XWiki.editoris empty). There the confirmation comes from the CKEditorxwiki-saveplugin, whosebeforeunloadhandler testseditor.checkDirty()— hence the newCKEditor#discardUnsavedChanges(), which callsresetDirty()on every instance;dataeditors.jssetswindow.onbeforeunloadfromunsavedChanges), which only leaving the edit mode resets — hence themaybeLeaveEditMode()call, done after the editors are marked clean so that leaving doesn't trigger the dialog itself.This only contains the damage. The underlying flicker —
ckeditor.getToolBar().insertImage()occasionally not opening the image dialog within the 10 s wait, seen on master, stable-17.10.x and stable-18.4.x — is still open on XWIKI-24806.Screenshots & Video
N/A — test-only change, no UI change.
Executed Tests
mvn clean verify -B -ntp -pl xwiki-platform-core/xwiki-platform-edit/xwiki-platform-edit-test/xwiki-platform-edit-test-docker -Pdocker,integration-tests -Dit.test=AllIT— 17 tests, 0 failures, 0 errors.mvn clean install -B -ntp -Plegacy,quality,docker,integration-tests -pl xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-test/xwiki-platform-ckeditor-test-pageobjects— 0 Checkstyle violations, Revapi clean.Expected merging strategy
🤖 Generated with Claude Code