use of org.xwiki.index.test.po.SpaceIndexPage in project xwiki-platform by xwiki.
the class SpacesTest method spacesMacro.
@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void spacesMacro() {
// Create a page with special characters in space name
// See XE-1228: Broken links displayed in the Spaces widget if a space name contains a colon
// See XE-1298: Spaces macro doesn't list spaces that contain a colon in their name
String spaceName = getTestClassName() + ":" + getTestMethodName() + "&";
String referenceEscapedSpaceName = getTestClassName() + "\\:" + getTestMethodName() + "&";
// Make sure the new space's WebHome page doesn't exist.
getUtil().deletePage(spaceName, "WebHome");
// Create the new space using the UI and verify it leads to the space home page being edited.
SpacesMacroPage macroPage = SpacesMacroPage.gotoPage();
macroPage.getSpacesMacroPane().createSpace(spaceName).clickCreate();
WikiEditPage editPage = new WikiEditPage();
// Verify that space creation uses the space name as the space home page's title
assertEquals(spaceName, editPage.getDocumentTitle());
// Verify that the space created is correct by looking at the generate metadata in the HTML header
// (they contain the space reference amongst other data).
// Note: the value will be escaped since it is the space reference, not the space name.
assertEquals(referenceEscapedSpaceName, editPage.getMetaDataValue("space"));
// Go back to the Spaces Macro page and verify that the link to space index works
// First, save the space's home page
editPage.clickSaveAndContinue();
macroPage = SpacesMacroPage.gotoPage();
macroPage.getSpacesMacroPane().clickSpaceIndex(referenceEscapedSpaceName);
// Assert the content of the space index live table.
LiveTableElement spaceIndexLiveTable = new SpaceIndexPage().getLiveTable();
spaceIndexLiveTable.waitUntilReady();
assertEquals(1, spaceIndexLiveTable.getRowCount());
assertTrue(spaceIndexLiveTable.hasRow("Page", "WebHome"));
assertTrue(spaceIndexLiveTable.hasRow("Space", referenceEscapedSpaceName));
// Go back to the Spaces Macro page and this time verify that the link to the space home page works
macroPage = SpacesMacroPage.gotoPage();
ViewPage spaceHomePage = macroPage.getSpacesMacroPane().clickSpaceHome(referenceEscapedSpaceName);
assertEquals(spaceName, spaceHomePage.getDocumentTitle());
}
Aggregations