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

XWIKI-22221: Saving from Inplace Edit mode, after switching to Source, breaks the content

  * Ensure that an edition failure won't block other test because of the
    alert when leaving edition
parent b7805664
No related branches found
No related tags found
No related merge requests found
......@@ -23,12 +23,14 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.Alert;
import org.openqa.selenium.Keys;
import org.openqa.selenium.UnhandledAlertException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.xwiki.ckeditor.test.po.AutocompleteDropdown;
......@@ -61,6 +63,18 @@ void beforeEach(TestUtils setup, TestReference testReference)
setup.createPage(testReference, "before\n\n== Section ==\n\nafter", "test title");
}
@AfterEach
void afterEach(TestUtils setup, TestReference testReference)
{
// We might have an alert in case one test failed during an edition, in which case we just want to get rid of
// the alert to move to next page.
try {
setup.gotoPage(testReference);
} catch (UnhandledAlertException e) {
setup.getDriver().switchTo().alert().accept();
}
}
@Test
@Order(1)
void editInplace(TestUtils setup, TestReference testReference)
......
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