Search in sources :

Example 1 with DeletePageOutcomePage

use of org.xwiki.test.ui.po.DeletePageOutcomePage in project xwiki-platform by xwiki.

the class DeletePageTest method deleteOkWhenConfirming.

@Test
public void deleteOkWhenConfirming() {
    ConfirmationPage confirmationPage = this.viewPage.delete();
    // This tests for regression of XWIKI-1388
    assertNotNull("The interface should not show the user as logged out while deleting page", confirmationPage.getCurrentUser());
    confirmationPage.clickYes();
    DeletingPage deletingPage = new DeletingPage();
    deletingPage.waitUntilIsTerminated();
    // Note: it's better to wait instead of using isSuccess() since there could be some timeframe between
    // the hiding of the progress UI and the display of the success message.
    deletingPage.waitUntilSuccessMessage();
    assertEquals(CONFIRMATION, deletingPage.getSuccessMessage());
    DeletePageOutcomePage deleteOutcome = deletingPage.getDeletePageOutcomePage();
    assertEquals(LOGGED_USERNAME, deleteOutcome.getPageDeleter());
    assertEquals(DOCUMENT_NOT_FOUND, deleteOutcome.getMessage());
}
Also used : DeletingPage(org.xwiki.test.ui.po.DeletingPage) ConfirmationPage(org.xwiki.test.ui.po.ConfirmationPage) DeletePageOutcomePage(org.xwiki.test.ui.po.DeletePageOutcomePage) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 2 with DeletePageOutcomePage

use of org.xwiki.test.ui.po.DeletePageOutcomePage in project xwiki-platform by xwiki.

the class DeletePageTest method deleteTerminalAndNonTerminalPages.

/**
 * Verify that when you delete a terminal and a non terminal page sharing the same location, both deleted versions
 * are present in the recycle bin list when you hit the location afterwards.
 * @see: "XWIKI-12563: Cannot restore a terminal page from its location"
 * @since 7.2RC1
 */
@Test
public void deleteTerminalAndNonTerminalPages() {
    DocumentReference terminalPageRef = new DocumentReference("xwiki", Arrays.asList(getTestClassName()), getTestMethodName());
    DocumentReference nonTerminalPageRef = new DocumentReference("xwiki", Arrays.asList(getTestClassName(), getTestMethodName()), "WebHome");
    // Clean up.
    getUtil().deletePage(terminalPageRef);
    getUtil().deletePage(nonTerminalPageRef);
    // Create the non terminal page.
    ViewPage nonTerminalPage = getUtil().createPage(nonTerminalPageRef, "Content", "Title");
    // Delete it
    nonTerminalPage.delete().clickYes();
    DeletingPage deletingPage = new DeletingPage();
    deletingPage.waitUntilIsTerminated();
    // Look at the recycle bin
    DeletePageOutcomePage deletePageOutcomePage = deletingPage.getDeletePageOutcomePage();
    assertFalse(deletePageOutcomePage.hasTerminalPagesInRecycleBin());
    // Create the terminal page.
    ViewPage terminalPage = getUtil().createPage(terminalPageRef, "Content", "Title");
    // Delete it
    terminalPage.delete().clickYes();
    deletingPage.waitUntilIsTerminated();
    // Look at the recycle bin
    deletePageOutcomePage = deletingPage.getDeletePageOutcomePage();
    assertTrue(deletePageOutcomePage.hasTerminalPagesInRecycleBin());
    // Delete both version in the recycle bin
    deletePageOutcomePage.clickDeletePage();
    deletePageOutcomePage.clickDeleteTerminalPage();
}
Also used : DeletingPage(org.xwiki.test.ui.po.DeletingPage) ViewPage(org.xwiki.test.ui.po.ViewPage) DeletePageOutcomePage(org.xwiki.test.ui.po.DeletePageOutcomePage) DocumentReference(org.xwiki.model.reference.DocumentReference) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Aggregations

Test (org.junit.Test)2 AbstractTest (org.xwiki.test.ui.AbstractTest)2 DeletePageOutcomePage (org.xwiki.test.ui.po.DeletePageOutcomePage)2 DeletingPage (org.xwiki.test.ui.po.DeletingPage)2 DocumentReference (org.xwiki.model.reference.DocumentReference)1 ConfirmationPage (org.xwiki.test.ui.po.ConfirmationPage)1 ViewPage (org.xwiki.test.ui.po.ViewPage)1