Search in sources :

Example 1 with OfficeImporterResultPage

use of org.xwiki.officeimporter.test.po.OfficeImporterResultPage 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

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