Search in sources :

Example 1 with UserDirectoryPage

use of org.xwiki.user.directory.test.po.UserDirectoryPage in project xwiki-platform by xwiki.

the class UserDirectoryTest method verifyUserIsListed.

@Test
public void verifyUserIsListed() {
    // Delete possible existing user
    getUtil().deletePage("XWiki", "test");
    UserDirectoryPage page = UserDirectoryPage.gotoPage();
    // Verify that the user directory is empty when there's no user in the wiki
    LiveTableElement liveTableElement = page.getUserDirectoryLiveTable();
    assertEquals(0, liveTableElement.getRowCount());
    // Add a user and verify it's visible in the livetable
    getUtil().createUserAndLogin("test", "testtest", "first_name", "John", "last_name", "Doe");
    // Go back to the user directory page since the user creation navigated to another page
    page = UserDirectoryPage.gotoPage();
    assertEquals(1, liveTableElement.getRowCount());
    assertTrue(liveTableElement.hasRow("User ID", "test"));
    assertTrue(liveTableElement.hasRow("First Name", "John"));
    assertTrue(liveTableElement.hasRow("Last Name", "Doe"));
    // Log out to verify the livetable works in guest view too
    getUtil().forceGuestUser();
    assertEquals(1, liveTableElement.getRowCount());
    assertTrue(liveTableElement.hasRow("User ID", "test"));
    assertTrue(liveTableElement.hasRow("First Name", "John"));
    assertTrue(liveTableElement.hasRow("Last Name", "Doe"));
}
Also used : LiveTableElement(org.xwiki.test.ui.po.LiveTableElement) UserDirectoryPage(org.xwiki.user.directory.test.po.UserDirectoryPage) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 AbstractTest (org.xwiki.test.ui.AbstractTest)1 LiveTableElement (org.xwiki.test.ui.po.LiveTableElement)1 UserDirectoryPage (org.xwiki.user.directory.test.po.UserDirectoryPage)1