Package org.xwiki.test.ui.administration.elements

Examples of org.xwiki.test.ui.administration.elements.GlobalRightsAdministrationSectionPage


        getDriver().navigate().refresh();
    }

    private void setRightsOnGuest(Right right, State state)
    {
        GlobalRightsAdministrationSectionPage globalRights = new GlobalRightsAdministrationSectionPage();
        globalRights.gotoPage();
        globalRights.getEditRightsPane().switchToUsers();
        globalRights.getEditRightsPane().setGuestRight(right, state);
    }
View Full Code Here


    public void testRedirectBackAfterLogin()
    {
        try {
            // Test setup: disallow view right for unauthenticated users. We need to be logged as admin in order to
            // do that. Since this is not what we are testing use the fast way to log in
            GlobalRightsAdministrationSectionPage grasp = new GlobalRightsAdministrationSectionPage();
            getDriver().get(getUtil().getURLToLoginAsAdminAndGotoPage(grasp.getURL()));
            getUtil().recacheSecretToken();
            grasp.forceAuthenticatedView();

            // Go to a page, log out and expire session by removing cookies, log in again and verify that the user is
            // redirected to the initial page.
            ViewPage page = getUtil().gotoPage("SomeSpace", "SomePage");
            page.logout();
            // Since view is disallowed for unauthenticated users, at this point we see a log in page.
            LoginPage loginPage = new LoginPage();
            // Remove all cookie to simulate a session expiry
            getDriver().manage().deleteAllCookies();
            loginPage.loginAsAdmin();

            // We use startsWith since the URL contains a jsessionid and a srid.
            Assert.assertTrue(getDriver().getCurrentUrl().startsWith(getUtil().getURL("SomeSpace", "SomePage")));
        } finally {
            GlobalRightsAdministrationSectionPage grasp = new GlobalRightsAdministrationSectionPage();
            grasp.gotoPage();
            if (!grasp.isAuthenticated()) {
                getDriver().get(getUtil().getURLToLoginAsAdminAndGotoPage(grasp.getURL()));
            }
            grasp.unforceAuthenticatedView();
        }
    }
View Full Code Here

TOP

Related Classes of org.xwiki.test.ui.administration.elements.GlobalRightsAdministrationSectionPage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.