Search in sources :

Example 1 with OfficeImporterPage

use of org.xwiki.officeimporter.test.po.OfficeImporterPage in project xwiki-platform by xwiki.

the class OfficeImporterTest method testChildNamingMethodInputVisibility.

/**
 * Depending on if the target page is terminal or not, the "childNamingMethod" input is displayed or not.
 */
@Test
public void testChildNamingMethodInputVisibility() {
    DocumentReference testDocument = new DocumentReference("xwiki", Arrays.asList(getTestClassName()), getTestMethodName());
    // Cleaning
    getUtil().deletePage(testDocument);
    // 1: create a terminal page
    CreatePagePage createPagePage = getUtil().gotoPage(testDocument).createPage();
    createPagePage.setType("office");
    createPagePage.setTerminalPage(true);
    createPagePage.clickCreate();
    OfficeImporterPage officeImporterPage = new OfficeImporterPage();
    // Test
    assertTrue(officeImporterPage.isChildPagesNamingMethodDisplayed());
    // 2: create a non terminal page
    createPagePage = getUtil().gotoPage(testDocument).createPage();
    createPagePage.setType("office");
    createPagePage.setTerminalPage(false);
    createPagePage.clickCreate();
    officeImporterPage = new OfficeImporterPage();
    // Test
    assertFalse(officeImporterPage.isChildPagesNamingMethodDisplayed());
}
Also used : CreatePagePage(org.xwiki.test.ui.po.CreatePagePage) OfficeImporterPage(org.xwiki.officeimporter.test.po.OfficeImporterPage) DocumentReference(org.xwiki.model.reference.DocumentReference) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 2 with OfficeImporterPage

use of org.xwiki.officeimporter.test.po.OfficeImporterPage in project xwiki-platform by xwiki.

the class OfficeImporterTest method importFile.

/**
 * Import an office file in the wiki.
 *
 * @param fileName name of the file to import (the file should be located in test /resources/ folder)
 * @param splitByHeadings either the option splitByHeadings should be use or not
 * @return the result page
 */
private ViewPage importFile(String fileName, boolean splitByHeadings) {
    ViewPage page = getUtil().gotoPage(new DocumentReference("xwiki", Arrays.asList(getTestClassName(), getTestMethodName()), "WebHome"));
    CreatePagePage createPage = page.createPage();
    createPage.setType("office");
    createPage.clickCreate();
    OfficeImporterPage officeImporterPage = new OfficeImporterPage();
    officeImporterPage.setFile(new File(getClass().getResource(fileName).getPath()));
    officeImporterPage.setFilterStyle(true);
    officeImporterPage.setSplitDocument(splitByHeadings);
    OfficeImporterResultPage officeImporterResultPage = officeImporterPage.clickImport();
    assertEquals("Conversion succeeded. You can view the result, or you can Go back to convert another document.", officeImporterResultPage.getMessage());
    return officeImporterResultPage.viewResult();
}
Also used : CreatePagePage(org.xwiki.test.ui.po.CreatePagePage) OfficeImporterPage(org.xwiki.officeimporter.test.po.OfficeImporterPage) OfficeImporterResultPage(org.xwiki.officeimporter.test.po.OfficeImporterResultPage) ViewPage(org.xwiki.test.ui.po.ViewPage) File(java.io.File) DocumentReference(org.xwiki.model.reference.DocumentReference)

Aggregations

DocumentReference (org.xwiki.model.reference.DocumentReference)2 OfficeImporterPage (org.xwiki.officeimporter.test.po.OfficeImporterPage)2 CreatePagePage (org.xwiki.test.ui.po.CreatePagePage)2 File (java.io.File)1 Test (org.junit.Test)1 OfficeImporterResultPage (org.xwiki.officeimporter.test.po.OfficeImporterResultPage)1 AbstractTest (org.xwiki.test.ui.AbstractTest)1 ViewPage (org.xwiki.test.ui.po.ViewPage)1