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());
}
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();
}
Aggregations