Enabled/edited CustomAuthFlowCookieTest

This commit is contained in:
Vlasta Ramik 2016-04-28 10:22:02 +02:00
parent acba6cd210
commit 0b875d4688

View file

@ -16,37 +16,34 @@
*/ */
package org.keycloak.testsuite.account.custom; package org.keycloak.testsuite.account.custom;
import org.jboss.arquillian.graphene.page.Page; import java.util.Arrays;
import org.junit.Ignore; import static org.junit.Assert.assertEquals;
import org.junit.Test; import org.junit.Test;
import org.junit.Before; import org.junit.Before;
import org.keycloak.models.AuthenticationExecutionModel.Requirement; import org.keycloak.models.AuthenticationExecutionModel.Requirement;
import static org.keycloak.testsuite.auth.page.AuthRealm.TEST; import org.keycloak.representations.idm.ClientRepresentation;
import org.keycloak.testsuite.console.page.AdminConsole; import static org.keycloak.testsuite.util.OAuthClient.APP_ROOT;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWithLoginUrlOf;
/** /**
* *
* @author <a href="mailto:vramik@redhat.com">Vlastislav Ramik</a> * @author <a href="mailto:vramik@redhat.com">Vlastislav Ramik</a>
*/ */
@Ignore
public class CustomAuthFlowCookieTest extends AbstractCustomAccountManagementTest { public class CustomAuthFlowCookieTest extends AbstractCustomAccountManagementTest {
@Page
private AdminConsole testRealmAdminConsolePage;
@Override
public void setDefaultPageUriParameters() {
super.setDefaultPageUriParameters();
}
@Before @Before
@Override @Override
public void beforeTest() { public void beforeTest() {
super.beforeTest(); super.beforeTest();
testRealmAdminConsolePage.setAdminRealm(TEST);
ClientRepresentation testApp = new ClientRepresentation();
testApp.setClientId("test-app");
testApp.setEnabled(true);
testApp.setBaseUrl(APP_ROOT);
testApp.setRedirectUris(Arrays.asList(new String[]{APP_ROOT + "/*"}));
testApp.setAdminUrl(APP_ROOT + "/logout");
testApp.setSecret("password");
assertEquals(201, testRealmResource().clients().create(testApp).getStatus());
} }
@Test @Test
@ -57,9 +54,9 @@ public class CustomAuthFlowCookieTest extends AbstractCustomAccountManagementTes
testRealmLoginPage.form().login(testUser); testRealmLoginPage.form().login(testUser);
//check SSO is working //check SSO is working
//navigate to realm-management (different client of the same realm) and verify user is logged in //navigate to different client of the same realm and verify user is logged in
testRealmAdminConsolePage.navigateTo(); oauth.openLoginForm();
assertCurrentUrlStartsWith(testRealmAdminConsolePage); assertEquals("AUTH_RESPONSE", driver.getTitle());
} }
@Test @Test
@ -72,8 +69,8 @@ public class CustomAuthFlowCookieTest extends AbstractCustomAccountManagementTes
testRealmLoginPage.form().login(testUser); testRealmLoginPage.form().login(testUser);
//SSO shouln't work //SSO shouln't work
//navigate to realm-management and verify user is not logged in //navigate to different client of the same realm and verify user is not logged in
testRealmAdminConsolePage.navigateTo(); oauth.openLoginForm();
assertCurrentUrlStartsWithLoginUrlOf(testRealmLoginPage); assertEquals("Log in to test", driver.getTitle());
} }
} }