Merge branch 'master' of https://github.com/keycloak/keycloak into clients

Conflicts:
	testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/clients/CreateClientForm.java
	testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/FlashMessage.java
	testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/OnOffSwitch.java
	testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/WaitUtils.java
	testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractAuthTest.java
	testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientRolesTest.java
This commit is contained in:
vramik 2015-12-07 15:45:02 +01:00
parent 39856c32d1
commit 44ed912154
11 changed files with 51 additions and 74 deletions

View file

@ -276,7 +276,7 @@ public class CreateClientForm extends Form {
private WebElement logoutRedirectBindingInput;
public void setValues(ClientRepresentation client) {
waitAjaxForElementVisible(fineGrainCollapsor);
waitUntilElement(fineGrainCollapsor).is().visible();
Map<String, String> attributes = client.getAttributes();
samlAuthnStatement.setOn("true".equals(attributes.get(SAML_AUTHNSTATEMENT)));
@ -294,7 +294,7 @@ public class CreateClientForm extends Form {
samlNameIdFormat.selectByVisibleText(attributes.get(SAML_NAME_ID_FORMAT));
fineGrainCollapsor.click();
waitAjaxForElement(consumerServicePostInput);
waitUntilElement(consumerServicePostInput).is().present();
setInputValue(consumerServicePostInput, attributes.get(SAML_ASSERTION_CONSUMER_URL_POST));
setInputValue(consumerServiceRedirectInput, attributes.get(SAML_ASSERTION_CONSUMER_URL_REDIRECT));

View file

@ -50,10 +50,8 @@ public class OnOffSwitch {
}
private void click() {
waitAjaxForElement(root);
actions.moveToElement(root.findElement(By.tagName("label")))
waitUntilElement(root).is().present();
actions.moveToElement(root.findElements(By.tagName("span")).get(0))
actions.moveToElement(root.findElement(By.tagName("label")))
.click().build().perform();
}

View file

@ -95,27 +95,6 @@ public abstract class AbstractAuthTest extends AbstractKeycloakTest {
}
}
public void assertFlashMessageSuccess() {
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
// assertEquals(message, flashMessage.getText());
flashMessage.close();
}
public void assertFlashMessageDanger() {
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isDanger());
// assertEquals(message, flashMessage.getText());
flashMessage.close();
}
public void assertFlashMessageError() {
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isError());
// assertEquals(message, flashMessage.getText());
flashMessage.close();
}
public RealmResource testRealmResource() {
return adminClient.realm(testRealmPage.getAuthRealm());
}

View file

@ -59,40 +59,40 @@ public class ClientClusteringTest extends AbstractClientTest {
clientClusteringPage.form().setNodeReRegistrationTimeout("10", "Seconds");
clientClusteringPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
assertTrue(findClientByClientId(TEST_CLIENT_ID).getNodeReRegistrationTimeout() == 10);
clientClusteringPage.form().setNodeReRegistrationTimeout("10", "Minutes");
clientClusteringPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
assertTrue(findClientByClientId(TEST_CLIENT_ID).getNodeReRegistrationTimeout() == 600);
clientClusteringPage.form().setNodeReRegistrationTimeout("1", "Hours");
clientClusteringPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
assertTrue(findClientByClientId(TEST_CLIENT_ID).getNodeReRegistrationTimeout() == 3600);
clientClusteringPage.form().setNodeReRegistrationTimeout("1", "Days");
clientClusteringPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
assertTrue(findClientByClientId(TEST_CLIENT_ID).getNodeReRegistrationTimeout() == 86400);
clientClusteringPage.form().setNodeReRegistrationTimeout("", "Days");
clientClusteringPage.form().save();
assertFlashMessageDanger();
assertAlertDanger();
clientClusteringPage.form().setNodeReRegistrationTimeout("text", "Days");
clientClusteringPage.form().save();
assertFlashMessageDanger();
assertAlertDanger();
}
@Test
public void registerNodeTest() {
clientClusteringPage.form().addNode("new node");
assertFlashMessageSuccess();
assertAlertSuccess();
assertNotNull(findClientByClientId(TEST_CLIENT_ID).getRegisteredNodes().get("new node"));
clientClusteringPage.form().addNode("");
assertFlashMessageDanger();
assertAlertDanger();
}
}

View file

@ -60,13 +60,13 @@ public class ClientCredentialsTest extends AbstractClientTest {
public void regenerateSecret() {
clientCredentialsPage.form().selectClientIdAndSecret();
clientCredentialsPage.form().regenerateSecret();
assertFlashMessageSuccess();
assertAlertSuccess();
}
@Test
public void regenerateRegistrationAccessToken() {
clientCredentialsPage.form().regenerateRegistrationAccessToken();
assertFlashMessageSuccess();
assertAlertSuccess();
}
@Test
@ -80,6 +80,6 @@ public class ClientCredentialsTest extends AbstractClientTest {
generatePrivateKeysPage.generateForm().setStorePassword("pass2");
generatePrivateKeysPage.generateForm().clickGenerateAndDownload();
assertFlashMessageSuccess();
assertAlertSuccess();
}
}

View file

@ -79,7 +79,7 @@ public class ClientMappersOIDCTest extends AbstractClientTest {
createClientMappersPage.form().setMapperType(HARDCODED_ROLE);
createClientMappersPage.form().selectRole(REALM_ROLE, "offline_access", null);
createClientMappersPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
//check
ProtocolMapperRepresentation found = findClientMapperByName(id, "hardcoded role");
@ -96,7 +96,7 @@ public class ClientMappersOIDCTest extends AbstractClientTest {
//edit
createClientMappersPage.form().selectRole(CLIENT_ROLE, "view-profile", "account");
createClientMappersPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
//check
config = findClientMapperByName(id, "hardcoded role").getConfig();
@ -105,7 +105,7 @@ public class ClientMappersOIDCTest extends AbstractClientTest {
//delete
clientMapperPage.setMapperId(found.getId());
clientMapperPage.delete();
assertFlashMessageSuccess();
assertAlertSuccess();
//check
assertNull(findClientMapperByName(id, "hardcoded role"));
@ -123,7 +123,7 @@ public class ClientMappersOIDCTest extends AbstractClientTest {
createClientMappersPage.form().setAddToIDToken(true);
createClientMappersPage.form().setAddToAccessToken(true);
createClientMappersPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
//check
ProtocolMapperRepresentation found = findClientMapperByName(id, "hardcoded claim");
@ -152,7 +152,7 @@ public class ClientMappersOIDCTest extends AbstractClientTest {
createClientMappersPage.form().setAddToIDToken(false);
createClientMappersPage.form().setAddToAccessToken(false);
createClientMappersPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
//check
ProtocolMapperRepresentation found = findClientMapperByName(id, "user session note");
@ -178,7 +178,7 @@ public class ClientMappersOIDCTest extends AbstractClientTest {
createClientMappersPage.form().setRole("offline_access");
createClientMappersPage.form().setNewRole("new role");
createClientMappersPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
//check
ProtocolMapperRepresentation found = findClientMapperByName(id, "role name");
@ -196,7 +196,7 @@ public class ClientMappersOIDCTest extends AbstractClientTest {
setInitialValues("user address", false, null);
createClientMappersPage.form().setMapperType(USERS_FULL_NAME);
createClientMappersPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
//check
ProtocolMapperRepresentation found = findClientMapperByName(id, "user address");
@ -210,7 +210,7 @@ public class ClientMappersOIDCTest extends AbstractClientTest {
setInitialValues("user full name", false, null);
createClientMappersPage.form().setMapperType(USERS_FULL_NAME);
createClientMappersPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
//check
ProtocolMapperRepresentation found = findClientMapperByName(id, "user full name");
@ -226,7 +226,7 @@ public class ClientMappersOIDCTest extends AbstractClientTest {
createClientMappersPage.form().setUserAttribute("user attribute");
createClientMappersPage.form().setMultivalued(true);
createClientMappersPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
//check
ProtocolMapperRepresentation found = findClientMapperByName(id, "user attribute");
@ -245,7 +245,7 @@ public class ClientMappersOIDCTest extends AbstractClientTest {
createClientMappersPage.form().setMapperType(USER_PROPERTY);
createClientMappersPage.form().setProperty("property");
createClientMappersPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
//check
ProtocolMapperRepresentation found = findClientMapperByName(id, "user property");
@ -263,7 +263,7 @@ public class ClientMappersOIDCTest extends AbstractClientTest {
createClientMappersPage.form().setMapperType(GROUP_MEMBERSHIP);
createClientMappersPage.form().setFullGroupPath(true);
createClientMappersPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
//check
ProtocolMapperRepresentation found = findClientMapperByName(id, "group membership");
@ -316,7 +316,7 @@ public class ClientMappersOIDCTest extends AbstractClientTest {
//edit
clientMapperPage.form().setConsentRequired(false);
clientMapperPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
//check
assertFalse(findClientMapperByName(id, "mapper name").isConsentRequired());
@ -327,13 +327,13 @@ public class ClientMappersOIDCTest extends AbstractClientTest {
clientMappersPage.mapperTable().addBuiltin();
clientMappersPage.mapperTable().checkBuiltinMapper("locale");
clientMappersPage.mapperTable().clickAddSelectedBuiltinMapper();
assertFlashMessageSuccess();
assertAlertSuccess();
assertTrue("Builtin mapper \"locale\" should be present.", isMapperPresent("locale"));
clientMappersPage.mapperTable().deleteMapper("locale");
modalDialog.confirmDeletion();
assertFlashMessageSuccess();
assertAlertSuccess();
assertFalse("Builtin mapper \"locale\" should not be present.", isMapperPresent("locale"));
}
@ -354,25 +354,25 @@ public class ClientMappersOIDCTest extends AbstractClientTest {
//empty mapper type
clientMappersPage.mapperTable().createMapper();
createClientMappersPage.form().save();
assertFlashMessageDanger();
assertAlertDanger();
//empty name
createClientMappersPage.form().setMapperType(HARDCODED_ROLE);
createClientMappersPage.form().save();
assertFlashMessageDanger();
assertAlertDanger();
createClientMappersPage.form().setName("");
createClientMappersPage.form().save();
assertFlashMessageDanger();
assertAlertDanger();
createClientMappersPage.form().setName("name");
createClientMappersPage.form().setName("");
createClientMappersPage.form().save();
assertFlashMessageDanger();
assertAlertDanger();
//existing name
createClientMappersPage.form().setName("email");
createClientMappersPage.form().save();
assertFlashMessageDanger();
assertAlertDanger();
}
}

View file

@ -77,7 +77,7 @@ public class ClientMappersSAMLTest extends AbstractClientTest {
createClientMappersPage.form().setRole("offline_access");
createClientMappersPage.form().setNewRole("new role");
createClientMappersPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
//check
ProtocolMapperRepresentation found = findClientMapperByName(id, "role name");
@ -99,7 +99,7 @@ public class ClientMappersSAMLTest extends AbstractClientTest {
createClientMappersPage.form().setSamlAttributeNameFormat("URI Reference");
createClientMappersPage.form().setSingleRoleAttribute(true);
createClientMappersPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
//check
ProtocolMapperRepresentation found = findClientMapperByName(id, "new role list");
@ -122,7 +122,7 @@ public class ClientMappersSAMLTest extends AbstractClientTest {
setInitialValues("user property", false, null);
createClientMappersPage.form().setMapperType(USER_PROPERTY);
createClientMappersPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
//check
ProtocolMapperRepresentation found = findClientMapperByName(id, "user property");
@ -136,7 +136,7 @@ public class ClientMappersSAMLTest extends AbstractClientTest {
setInitialValues("user session note", false, null);
createClientMappersPage.form().setMapperType(USER_SESSION_NOTE);
createClientMappersPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
//check
ProtocolMapperRepresentation found = findClientMapperByName(id, "user session note");
@ -154,7 +154,7 @@ public class ClientMappersSAMLTest extends AbstractClientTest {
createClientMappersPage.form().setMapperType(HARDCODED_ATTRIBUTE);
createClientMappersPage.form().setAttributeValue("attribute value");
createClientMappersPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
//check
ProtocolMapperRepresentation found = findClientMapperByName(id, "hardcoded attribute");
@ -177,7 +177,7 @@ public class ClientMappersSAMLTest extends AbstractClientTest {
createClientMappersPage.form().setSingleGroupAttribute(true);
createClientMappersPage.form().setFullGroupPath(true);
createClientMappersPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
//check
ProtocolMapperRepresentation found = findClientMapperByName(id, "group list");
@ -197,7 +197,7 @@ public class ClientMappersSAMLTest extends AbstractClientTest {
createClientMappersPage.form().setMapperType(HARDCODED_ROLE_SAML);
createClientMappersPage.form().selectRole(REALM_ROLE, "offline_access", null);
createClientMappersPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
//check
ProtocolMapperRepresentation found = findClientMapperByName(id, "hardcoded role");

View file

@ -85,7 +85,7 @@ public class ClientRolesTest extends AbstractClientTest {
//delete
clientRolePage.delete();
assertFlashMessageSuccess();
assertAlertSuccess();
assertTrue("Role should be deleted.", testRealmResource().clients().get(id).roles().list().isEmpty());
}

View file

@ -62,7 +62,7 @@ public class ClientScopeTest extends AbstractClientTest {
public void clientScopeTest() {
assertTrue(found.isFullScopeAllowed());
clientScopePage.scopeForm().setFullScopeAllowed(false);
assertFlashMessageSuccess();
assertAlertSuccess();
found = findClientByClientId(TEST_CLIENT_ID);
assertFalse(found.isFullScopeAllowed());
@ -70,11 +70,11 @@ public class ClientScopeTest extends AbstractClientTest {
assertNull(getAllMappingsRepresentation().getClientMappings());
clientScopePage.roleForm().addRealmRole("offline_access");
assertFlashMessageSuccess();
assertAlertSuccess();
clientScopePage.roleForm().selectClientRole("account");
clientScopePage.roleForm().addClientRole("view-profile");
assertFlashMessageSuccess();
assertAlertSuccess();
found = findClientByClientId(TEST_CLIENT_ID);
List<RoleRepresentation> realmMappings = getAllMappingsRepresentation().getRealmMappings();
@ -85,9 +85,9 @@ public class ClientScopeTest extends AbstractClientTest {
assertEquals("view-profile", clientMappings.get("account").getMappings().get(0).getName());
clientScopePage.roleForm().removeAssignedRole("offline_access");
assertFlashMessageSuccess();
assertAlertSuccess();
clientScopePage.roleForm().removeAssignedClientRole("view-profile");
assertFlashMessageSuccess();
assertAlertSuccess();
assertNull(getAllMappingsRepresentation().getRealmMappings());
assertNull(getAllMappingsRepresentation().getClientMappings());

View file

@ -77,7 +77,7 @@ public class ClientSettingsTest extends AbstractClientTest {
clientSettingsPage.form().setRedirectUris(redirectUris);
clientSettingsPage.form().setWebOrigins(webOrigins);
clientSettingsPage.form().save();
assertFlashMessageSuccess();
assertAlertSuccess();
found = findClientByClientId(newClient.getClientId());
assertNotNull("Client " + newClient.getClientId() + " was not found.", found);
@ -85,7 +85,7 @@ public class ClientSettingsTest extends AbstractClientTest {
// delete
clientPage.delete();
assertFlashMessageSuccess();
assertAlertSuccess();
found = findClientByClientId(newClient.getClientId());
assertNull("Deleted client " + newClient.getClientId() + " was found.", found);
}
@ -108,7 +108,7 @@ public class ClientSettingsTest extends AbstractClientTest {
newClient = createOidcClientRep(PUBLIC, "oidc-public");
newClient.setStandardFlowEnabled(false);
createClient(newClient);
assertFlashMessageSuccess();
assertAlertSuccess();
ClientRepresentation found = findClientByClientId(newClient.getClientId());
assertNotNull("Client " + newClient.getClientId() + " was not found.", found);
@ -130,7 +130,7 @@ public class ClientSettingsTest extends AbstractClientTest {
public void createSAML() {
newClient = createSamlClientRep("saml");
createClient(newClient);
assertFlashMessageSuccess();
assertAlertSuccess();
ClientRepresentation found = findClientByClientId(newClient.getClientId());
System.out.println("...." + found.isFrontchannelLogout());

View file

@ -66,7 +66,7 @@ public class ClientsTest extends AbstractClientTest {
clientsPage.navigateTo();
clientsPage.table().deleteClient(TEST_CLIENT_ID);
modalDialog.confirmDeletion();
assertFlashMessageSuccess();
assertAlertSuccess();
ClientRepresentation found = findClientByClientId(TEST_CLIENT_ID);
assertNull("Deleted client " + TEST_CLIENT_ID + " was found.", found);