use of org.xwiki.index.test.po.AllDocsPage in project xwiki-platform by xwiki.
the class AllDocsTest method tableViewTabActions.
@Test
public void tableViewTabActions() throws Exception {
// Test 1: Verify that the Action column is displayed only for logged in users
// Create a test user
getUtil().createUserAndLogin(getTestClassName() + "_" + getTestMethodName(), "password");
AllDocsPage page = AllDocsPage.gotoPage();
LiveTableElement livetable = page.clickIndexTab();
assertTrue("No Actions column found", livetable.hasColumn("Actions"));
// Logs out to be guest to verify that the Action columns is no longer displayed
getUtil().forceGuestUser();
page = AllDocsPage.gotoPage();
livetable = page.clickIndexTab();
assertFalse("Actions column shouldn't be visible for guests", livetable.hasColumn("Actions"));
// Test 2: Verify filtering works by filtering on the document name
livetable = page.clickIndexTab();
livetable.filterColumn("xwiki-livetable-alldocs-filter-2", getTestMethodName());
// We get one result for the user we've created
assertEquals(1, livetable.getRowCount());
assertTrue(livetable.hasRow("Title", getTestClassName() + "_" + getTestMethodName()));
}
use of org.xwiki.index.test.po.AllDocsPage in project xwiki-platform by xwiki.
the class AllDocsTest method recycleBinTab.
@Test
public void recycleBinTab() throws Exception {
// Create a document and delete it
getUtil().createPageWithAttachment(Arrays.asList(getTestClassName(), "DeleteableSpace"), "document", null, "Document", null, null, "file.txt", getClass().getResourceAsStream("/file.txt"), TestUtils.SUPER_ADMIN_CREDENTIALS);
getUtil().loginAsSuperAdmin();
getUtil().deleteSpace(getTestClassName());
getUtil().gotoPage(AllDocsPage.getURL());
AllDocsPage page = new AllDocsPage();
assertTrue("Deleted documents tab is not visible to Admin", page.hasDeletedDocsTab());
assertTrue("Deleted attachments tab is not visible to Admin", page.hasDeletedAttachmentsTab());
// Logs out to be guest to verify that Deleted attachments/documents are not visible to guests
getUtil().forceGuestUser();
assertFalse("Deleted documents shouldn't be visible to guests", page.hasDeletedDocsTab());
assertFalse("Deleted attachments shouldn't be visible to guests", page.hasDeletedAttachmentsTab());
}
use of org.xwiki.index.test.po.AllDocsPage in project xwiki-platform by xwiki.
the class AllDocsTest method attachmentsTabFilteringAndSorting.
/**
* This test is against XWiki Enterprise XE-701 https://jira.xwiki.org/browse/XE-701 (fixed in 2.5M1) WARN:
* calling isReady() and waitUntilReady() from LiveTableElement.java inside this class fails.
*/
@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 attachmentsTabFilteringAndSorting() throws Exception {
// Create 2 pages with attachments so that this test filter returns only one.
// Note that we need to be logged in.
getUtil().createPageWithAttachment(getTestClassName(), "Page", null, null, "attachment1.txt", new ByteArrayInputStream("attachment content1".getBytes()), TestUtils.SUPER_ADMIN_CREDENTIALS);
getUtil().createPageWithAttachment(getTestClassName(), "OtherPage", null, null, "attachment2.txt", new ByteArrayInputStream("attachment content2".getBytes()), TestUtils.SUPER_ADMIN_CREDENTIALS);
AllDocsPage docsPage = AllDocsPage.gotoPage();
LiveTableElement liveTable = docsPage.clickAttachmentsTab();
// Here we test if all the Columns are displayed.
assertTrue("No Type column found", liveTable.hasColumn("Type"));
assertTrue("No Name column found", liveTable.hasColumn("Name"));
assertTrue("No Location column found", liveTable.hasColumn("Location"));
assertTrue("No Size column found", liveTable.hasColumn("Size"));
assertTrue("No Date column found", liveTable.hasColumn("Date"));
assertTrue("No Author column found", liveTable.hasColumn("Author"));
assertEquals(2, liveTable.getRowCount());
// Filter by attachment file name.
liveTable.filterColumn("xwiki-livetable-allattachments-filter-2", "t1");
assertEquals(1, liveTable.getRowCount());
assertEquals("attachment1.txt", liveTable.getCell(liveTable.getRow(1), 2).getText());
// Clear the filter.
liveTable.filterColumn("xwiki-livetable-allattachments-filter-2", "");
// Filter by attachment location.
liveTable.filterColumn("xwiki-livetable-allattachments-filter-3", "th");
assertEquals(1, liveTable.getRowCount());
assertEquals("AllDocsTestOtherPage", liveTable.getCell(liveTable.getRow(1), 3).getText());
// Clear the filter.
liveTable.filterColumn("xwiki-livetable-allattachments-filter-3", "");
// Sort by attachment file name. The live table should be already sorted by file name ascending. This will
// reverse the order.
assertEquals("attachment2.txt", liveTable.getCell(liveTable.getRow(2), 2).getText());
liveTable.sortBy("Name");
assertEquals(2, liveTable.getRowCount());
assertEquals("attachment2.txt", liveTable.getCell(liveTable.getRow(1), 2).getText());
// Sort by attachment location.
liveTable.sortBy("Location");
assertEquals("AllDocsTestPage", liveTable.getCell(liveTable.getRow(2), 3).getText());
liveTable.sortBy("Location");
assertEquals(2, liveTable.getRowCount());
assertEquals("AllDocsTestPage", liveTable.getCell(liveTable.getRow(1), 3).getText());
}
Aggregations