Skip to content
Snippets Groups Projects
Commit 42f86082 authored by Simon Urli's avatar Simon Urli
Browse files

XWIKI-22442: Tests are not running properly with Firefox 129.0

  * The problem was only related to tests related to ckeditor and the
    handling of the confirmation dialog when leaving it, so I replaced
all that logic with a simple click on cancel for leaving the editor.
parent 9ea0efb5
No related branches found
No related tags found
No related merge requests found
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
import org.xwiki.test.docker.junit5.TestConfiguration; import org.xwiki.test.docker.junit5.TestConfiguration;
import org.xwiki.test.docker.junit5.TestReference; import org.xwiki.test.docker.junit5.TestReference;
import org.xwiki.test.ui.TestUtils; import org.xwiki.test.ui.TestUtils;
import org.xwiki.test.ui.po.ViewPage;
import org.xwiki.test.ui.po.editor.WYSIWYGEditPage; import org.xwiki.test.ui.po.editor.WYSIWYGEditPage;
import org.xwiki.test.ui.po.editor.WikiEditPage;
/** /**
* Base class for CKEditor integration tests. * Base class for CKEditor integration tests.
...@@ -95,35 +95,8 @@ protected void setSource(String source) ...@@ -95,35 +95,8 @@ protected void setSource(String source)
protected void maybeLeaveEditMode(TestUtils setup, TestReference testReference) protected void maybeLeaveEditMode(TestUtils setup, TestReference testReference)
{ {
try {
// Dismiss the page leave confirmation modal if already open. We have to do this because we need to insert
// the page reload marker, see below, which is not possible while the modal is open.
setup.getDriver().switchTo().alert().dismiss();
} catch (Exception e) {
// The page leave confirmation modal wasn't open.
}
if (setup.isInWYSIWYGEditMode() || setup.isInWikiEditMode()) { if (setup.isInWYSIWYGEditMode() || setup.isInWikiEditMode()) {
// Leaving the edit mode with unsaved changes triggers the confirmation alert which stops the navigation. new WikiEditPage().clickCancel();
// Selenium doesn't wait for the new web page to be loaded after the alert is handled so we have to do this
// ourselves. Adding the page reload marker helps us detect when the new web page is loaded after the
// confirmation alert is handled.
setup.getDriver().addPageNotYetReloadedMarker();
// We pass the action because we don't want this call to wait for view mode to be loaded. We do our own wait
// (after handling the confirmation alert), as mentioned above.
setup.gotoPage(testReference, "view");
try {
// Confirm the page leave (discard unsaved changes) if we are asked for.
setup.getDriver().switchTo().alert().accept();
} catch (Exception e) {
// The page leave confirmation hasn't been shown, probably because there were no unsaved changes.
}
// Wait for the new web page to be loaded.
setup.getDriver().waitUntilPageIsReloaded();
new ViewPage();
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment