Search in sources :

Example 1 with WikiIndexPage

use of org.xwiki.wiki.test.po.WikiIndexPage in project xwiki-platform by xwiki.

the class WikiTemplateTest method deleteTemplateWiki.

private void deleteTemplateWiki() throws Exception {
    // Go to the template wiki
    WikiIndexPage wikiIndexPage = WikiIndexPage.gotoPage().waitUntilPageIsLoaded();
    WikiLink templateWikiLink = wikiIndexPage.getWikiLink("My new template");
    if (templateWikiLink == null) {
        throw new Exception("The wiki [My new template] is not in the wiki index.");
    }
    DeleteWikiPage deleteWikiPage = wikiIndexPage.deleteWiki(TEMPLATE_WIKI_ID).confirm(TEMPLATE_WIKI_ID);
    assertTrue(deleteWikiPage.hasSuccessMessage());
    // Verify the wiki has been deleted
    wikiIndexPage = WikiIndexPage.gotoPage().waitUntilPageIsLoaded();
    assertNull(wikiIndexPage.getWikiLink("My new template"));
}
Also used : WikiIndexPage(org.xwiki.wiki.test.po.WikiIndexPage) WikiLink(org.xwiki.wiki.test.po.WikiLink) DeleteWikiPage(org.xwiki.wiki.test.po.DeleteWikiPage)

Example 2 with WikiIndexPage

use of org.xwiki.wiki.test.po.WikiIndexPage in project xwiki-platform by xwiki.

the class WikiTemplateTest method createTemplateWiki.

private void createTemplateWiki() throws Exception {
    // Go to the wiki creation wizard
    WikiIndexPage wikiIndexPage = WikiIndexPage.gotoPage();
    CreateWikiPage createWikiPage = wikiIndexPage.createWiki();
    // Full the first step
    createWikiPage.setPrettyName("My new template");
    String wikiName = createWikiPage.getComputedName();
    assertEquals(TEMPLATE_WIKI_ID, wikiName);
    createWikiPage.setDescription("This is the template I do for the tests");
    createWikiPage.setIsTemplate(true);
    assertTrue(createWikiPage.isNextStepEnabled());
    // Second step
    CreateWikiPageStepUser createWikiPageStepUser = createWikiPage.goUserStep();
    // Creation step
    WikiCreationPage wikiCreationPage = createWikiPageStepUser.create();
    assertEquals("Wiki creation", wikiCreationPage.getStepTitle());
    // Ensure there is no error in the log
    assertFalse(wikiCreationPage.hasLogError());
    // Finalization
    WikiHomePage wikiHomePage = wikiCreationPage.finalizeCreation();
    // Go to the created subwiki, and modify the home page content
    wikiHomePage.edit();
    WikiEditPage wikiEditPage = new WikiEditPage();
    wikiEditPage.setContent(TEMPLATE_CONTENT);
    wikiEditPage.clickSaveAndView();
    wikiEditPage.waitUntilPageIsLoaded();
    // Go back to the wiki creation wizard, and verify the template is in the list of templates in the wizard
    createWikiPage = wikiHomePage.createWiki();
    assertTrue(createWikiPage.getTemplateList().contains("mynewtemplate"));
    // Verify the wiki is in the wiki index page.
    wikiIndexPage = WikiIndexPage.gotoPage().waitUntilPageIsLoaded();
    WikiLink wikiLink = wikiIndexPage.getWikiLink("My new template");
    if (wikiLink == null) {
        throw new Exception("The wiki [My new template] is not in the wiki index.");
    }
    assertTrue(wikiLink.getURL().endsWith("/xwiki/wiki/mynewtemplate/view/Main/"));
}
Also used : WikiHomePage(org.xwiki.wiki.test.po.WikiHomePage) WikiIndexPage(org.xwiki.wiki.test.po.WikiIndexPage) CreateWikiPage(org.xwiki.wiki.test.po.CreateWikiPage) CreateWikiPageStepUser(org.xwiki.wiki.test.po.CreateWikiPageStepUser) WikiEditPage(org.xwiki.test.ui.po.editor.WikiEditPage) WikiLink(org.xwiki.wiki.test.po.WikiLink) WikiCreationPage(org.xwiki.wiki.test.po.WikiCreationPage)

Example 3 with WikiIndexPage

use of org.xwiki.wiki.test.po.WikiIndexPage in project xwiki-platform by xwiki.

the class WikiTemplateTest method createWikiFromTemplate.

private void createWikiFromTemplate() {
    // Go to the wiki creation wizard
    WikiIndexPage wikiIndexPage = WikiIndexPage.gotoPage();
    CreateWikiPage createWikiPage = wikiIndexPage.createWiki();
    // First step
    createWikiPage.setPrettyName("My new wiki");
    String wikiName = createWikiPage.getComputedName();
    assertEquals("mynewwiki", wikiName);
    createWikiPage.setTemplate(TEMPLATE_WIKI_ID);
    createWikiPage.setIsTemplate(false);
    createWikiPage.setDescription("My first wiki");
    // Second step
    CreateWikiPageStepUser createWikiPageStepUser = createWikiPage.goUserStep();
    WikiCreationPage wikiCreationPage = createWikiPageStepUser.create();
    assertEquals("Wiki creation", wikiCreationPage.getStepTitle());
    // Wait for the finalize button to be displayed, with a 1 minute limit
    // (it's a lot but we often have problems on ci.xwiki.org).
    wikiCreationPage.waitForFinalizeButton(60);
    // Ensure there is no error in the log
    assertFalse(wikiCreationPage.hasLogError());
    // Finalization
    WikiHomePage wikiHomePage = wikiCreationPage.finalizeCreation();
    // Go the created subwiki and verify the content of the main page is the same than in the template
    assertEquals(wikiHomePage.getContent(), TEMPLATE_CONTENT);
    // Delete the wiki
    DeleteWikiPage deleteWikiPage = wikiHomePage.deleteWiki();
    deleteWikiPage = deleteWikiPage.confirm("");
    assertTrue(deleteWikiPage.hasUserErrorMessage());
    assertTrue(deleteWikiPage.hasWikiDeleteConfirmationInput(""));
    deleteWikiPage = deleteWikiPage.confirm("My new wiki");
    assertTrue(deleteWikiPage.hasUserErrorMessage());
    assertTrue(deleteWikiPage.hasWikiDeleteConfirmationInput("My new wiki"));
    deleteWikiPage = deleteWikiPage.confirm("mynewwiki");
    assertTrue(deleteWikiPage.hasSuccessMessage());
    // Verify the wiki has been deleted
    wikiIndexPage = WikiIndexPage.gotoPage().waitUntilPageIsLoaded();
    assertNull(wikiIndexPage.getWikiLink("My new wiki"));
}
Also used : WikiHomePage(org.xwiki.wiki.test.po.WikiHomePage) WikiIndexPage(org.xwiki.wiki.test.po.WikiIndexPage) CreateWikiPage(org.xwiki.wiki.test.po.CreateWikiPage) CreateWikiPageStepUser(org.xwiki.wiki.test.po.CreateWikiPageStepUser) WikiCreationPage(org.xwiki.wiki.test.po.WikiCreationPage) DeleteWikiPage(org.xwiki.wiki.test.po.DeleteWikiPage)

Aggregations

WikiIndexPage (org.xwiki.wiki.test.po.WikiIndexPage)3 CreateWikiPage (org.xwiki.wiki.test.po.CreateWikiPage)2 CreateWikiPageStepUser (org.xwiki.wiki.test.po.CreateWikiPageStepUser)2 DeleteWikiPage (org.xwiki.wiki.test.po.DeleteWikiPage)2 WikiCreationPage (org.xwiki.wiki.test.po.WikiCreationPage)2 WikiHomePage (org.xwiki.wiki.test.po.WikiHomePage)2 WikiLink (org.xwiki.wiki.test.po.WikiLink)2 WikiEditPage (org.xwiki.test.ui.po.editor.WikiEditPage)1