keycloak-uncached

Changes

testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/clients/ClientRole.java 47(+0 -47)

testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/clients/ClientRoles.java 29(+0 -29)

Details

diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/clients/mappers/ClientMapper.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/clients/mappers/ClientMapper.java
new file mode 100644
index 0000000..35df866
--- /dev/null
+++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/clients/mappers/ClientMapper.java
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.keycloak.testsuite.console.page.clients.mappers;
+
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+
+/**
+ *
+ * @author <a href="mailto:vramik@redhat.com">Vlastislav Ramik</a>
+ */
+public class ClientMapper extends ClientMappers {
+    
+    public static final String MAPPER_ID = "mapperId";
+    
+    @FindBy(xpath = "//i[contains(@class, 'delete')]")
+    private WebElement deleteIcon;
+    
+    @FindBy(tagName = "form")
+    private MapperSettingsForm form;
+    
+    @Override
+    public String getUriFragment() {
+        return super.getUriFragment() + "/{" + MAPPER_ID + "}";
+    }
+    
+    public void setMapperId(String id) {
+        setUriParameter(MAPPER_ID, id);
+    }
+
+    public String getMapperId() {
+        return getUriParameter(MAPPER_ID).toString();
+    }
+    
+    @Override
+    public void delete() {
+        deleteIcon.click();
+        modalDialog.confirmDeletion();
+    }
+    
+    public MapperSettingsForm form() {
+        return form;
+    }
+}
diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/clients/mappers/MapperSettingsForm.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/clients/mappers/MapperSettingsForm.java
new file mode 100644
index 0000000..09a9ba9
--- /dev/null
+++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/clients/mappers/MapperSettingsForm.java
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.keycloak.testsuite.console.page.clients.mappers;
+
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+
+/**
+ * @author <a href="mailto:vramik@redhat.com">Vlastislav Ramik</a>
+ */
+public class MapperSettingsForm extends CreateClientMappersForm {
+
+    @FindBy(id = "protocol")
+    private WebElement protocolInput;
+    @FindBy(id = "mapperId")
+    private WebElement mapperIdInput;
+    @FindBy(id = "name")
+    private WebElement nameInput;
+    @FindBy(id = "mapperType")
+    private WebElement mapperTypeInput;
+    
+    public String getProtocol() {
+        return getInputValue(protocolInput);
+    }
+    
+    public String getMapperId() {
+        return getInputValue(mapperIdInput);
+    }
+    
+    public String getName() {
+        return getInputValue(nameInput);
+    }
+    
+    public String getMapperType() {
+        return getInputValue(mapperTypeInput);
+    }
+}
diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/clients/roles/ClientRole.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/clients/roles/ClientRole.java
index 472ef02..2621997 100644
--- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/clients/roles/ClientRole.java
+++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/clients/roles/ClientRole.java
@@ -1,6 +1,8 @@
 package org.keycloak.testsuite.console.page.clients.roles;
 
 import org.keycloak.testsuite.console.page.roles.*;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
 
 /**
  *
@@ -9,6 +11,9 @@ import org.keycloak.testsuite.console.page.roles.*;
 public class ClientRole extends ClientRoles {
 
     public static final String ROLE_ID = "roleId";
+    
+    @FindBy(xpath = "//i[contains(@class, 'delete')]")
+    private WebElement deleteIcon;
 
     @Override
     public String getUriFragment() {
@@ -32,5 +37,11 @@ public class ClientRole extends ClientRoles {
     public void backToClientRolesViaBreadcrumb() {
         breadcrumb().clickItemOneLevelUp();
     }
+    
+    @Override
+    public void delete() {
+        deleteIcon.click();
+        modalDialog.confirmDeletion();
+    }
 
 }
diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/FlashMessage.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/FlashMessage.java
index f78b660..f6638cd 100644
--- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/FlashMessage.java
+++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/FlashMessage.java
@@ -17,6 +17,7 @@
  */
 package org.keycloak.testsuite.console.page.fragment;
 
+import java.util.concurrent.TimeUnit;
 import static org.jboss.arquillian.graphene.Graphene.waitGui;
 import org.jboss.arquillian.graphene.fragment.Root;
 
@@ -42,7 +43,9 @@ public class FlashMessage {
     }
     
     public boolean isSuccess() {
-        waitGui().until("Flash message should be success")
+        waitGui().withTimeout(SCRIPT_TIMEOUT, TimeUnit.MILLISECONDS)
+                .pollingEvery(POLLING_INTERVAL, TimeUnit.MILLISECONDS)
+                .until("Flash message should be success")
                 .element(root)
                 .attribute("class")
                 .contains("success");
@@ -50,7 +53,9 @@ public class FlashMessage {
     }
 
     public boolean isError() {
-        waitGui().until("Flash message should be error")
+        waitGui().withTimeout(SCRIPT_TIMEOUT, TimeUnit.MILLISECONDS)
+                .pollingEvery(POLLING_INTERVAL, TimeUnit.MILLISECONDS)
+                .until("Flash message should be error")
                 .element(root)
                 .attribute("class")
                 .contains("error");
@@ -58,7 +63,9 @@ public class FlashMessage {
     }
 
     public boolean isDanger() {
-        waitGui().until("Flash message should be danger")
+        waitGui().withTimeout(SCRIPT_TIMEOUT, TimeUnit.MILLISECONDS)
+                .pollingEvery(POLLING_INTERVAL, TimeUnit.MILLISECONDS)
+                .until("Flash message should be danger")
                 .element(root)
                 .attribute("class")
                 .contains("danger");
diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/ModalDialog.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/ModalDialog.java
index 9bb95dd..09fbc18 100644
--- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/ModalDialog.java
+++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/ModalDialog.java
@@ -17,6 +17,8 @@ public class ModalDialog {
 
     @FindBy(xpath = ".//button[@ng-click='ok()']")
     private WebElement okButton;
+    @FindBy(id = "name")
+    private WebElement nameInput;
 
     public void ok() {
         waitAjaxForElement(okButton);
@@ -33,4 +35,9 @@ public class ModalDialog {
         cancelButton.click();
     }
 
+    public void setName(String name) {
+        waitAjaxForElement(nameInput);
+        nameInput.clear();
+        nameInput.sendKeys(name);
+    }
 }
diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/AbstractClientTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/AbstractClientTest.java
index 1b25373..cb2388f 100644
--- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/AbstractClientTest.java
+++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/AbstractClientTest.java
@@ -80,7 +80,7 @@ public abstract class AbstractClientTest extends AbstractConsoleTest {
         return client;
     }
     
-    public ClientRepresentation findClientRepByClientId(String clientId) {
+    public ClientRepresentation findClientByClientId(String clientId) {
         ClientRepresentation found = null;
         for (ClientRepresentation clientRepresentation : testRealmResource().clients().findAll()) {
             if (clientRepresentation.getClientId().equals(clientId)) {
diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientCredentialsTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientCredentialsTest.java
index a813f73..a12e684 100644
--- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientCredentialsTest.java
+++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientCredentialsTest.java
@@ -49,7 +49,7 @@ public class ClientCredentialsTest extends AbstractClientTest {
         newClient = createClientRepresentation(TEST_CLIENT_ID, TEST_REDIRECT_URIS);
         testRealmResource().clients().create(newClient).close();
         
-        ClientRepresentation found = findClientRepByClientId(TEST_CLIENT_ID);
+        ClientRepresentation found = findClientByClientId(TEST_CLIENT_ID);
         assertNotNull("Client " + TEST_CLIENT_ID + " was not found.", found);
         clientCredentials.setId(found.getId());
         clientCredentials.navigateTo();
diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientMappersTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientMappersTest.java
new file mode 100644
index 0000000..a386d5f
--- /dev/null
+++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientMappersTest.java
@@ -0,0 +1,389 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.keycloak.testsuite.console.clients;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.jboss.arquillian.graphene.page.Page;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+import org.junit.Before;
+import org.keycloak.representations.idm.ClientRepresentation;
+import org.keycloak.representations.idm.ProtocolMapperRepresentation;
+import org.keycloak.testsuite.console.page.clients.mappers.ClientMapper;
+import org.keycloak.testsuite.console.page.clients.mappers.ClientMappers;
+import org.keycloak.testsuite.console.page.clients.mappers.CreateClientMappers;
+import static org.keycloak.testsuite.console.page.clients.mappers.CreateClientMappersForm.*;
+
+/**
+ * 
+ * @author <a href="mailto:vramik@redhat.com">Vlastislav Ramik</a>
+ * 
+ * TODO: saml mappers
+ */
+public class ClientMappersTest extends AbstractClientTest {
+
+    private String id;
+    
+    @Page
+    private ClientMappers clientMappersPage;
+    @Page
+    private ClientMapper clientMapperPage;
+
+    @Page 
+    private CreateClientMappers createClientMappersPage;
+    
+    @Before
+    public void beforeClientMappersTest() {
+        ClientRepresentation newClient = createClientRepresentation(TEST_CLIENT_ID, TEST_REDIRECT_URIS);
+        testRealmResource().clients().create(newClient).close();
+        
+        id = findClientByClientId(TEST_CLIENT_ID).getId();
+        clientMappersPage.setId(id);
+        clientMappersPage.navigateTo();
+    }
+    
+    private ProtocolMapperRepresentation findClientMapperByName(String mapperName) {
+        ProtocolMapperRepresentation found = null;
+        for (ProtocolMapperRepresentation mapper : testRealmResource().clients().get(id).getProtocolMappers().getMappers()) {
+            if (mapperName.equals(mapper.getName())) {
+                found = mapper;
+            }
+        }
+        return found;
+    }
+    
+    private void setInitialValues(String name, boolean consentRequired, String consentText) {
+        createClientMappersPage.form().setName(name);
+        createClientMappersPage.form().setConsentRequired(consentRequired);
+        if (consentRequired) {
+            createClientMappersPage.form().setConsentText(consentText);
+        }
+    }
+    
+    @Test
+    public void testOIDCHardcodedRole() {
+        //create
+        clientMappersPage.mapperTable().createMapper();
+        setInitialValues("hardcoded role", true, "Consent Text");
+        createClientMappersPage.form().setMapperType(HARDCODED_ROLE);
+        createClientMappersPage.form().selectRole(REALM_ROLE, "offline_access", null);
+        createClientMappersPage.form().save();
+        assertFlashMessageSuccess();
+        
+        //check
+        ProtocolMapperRepresentation found = findClientMapperByName("hardcoded role");
+        assertNotNull(found);
+        
+        assertTrue(found.isConsentRequired());
+        assertEquals("Consent Text", found.getConsentText());
+        assertEquals("oidc-hardcoded-role-mapper", found.getProtocolMapper());
+        Map<String, String> config = found.getConfig();
+        
+        assertEquals(1, config.size());
+        assertEquals("offline_access", config.get("role"));
+        
+        //edit
+        createClientMappersPage.form().selectRole(CLIENT_ROLE, "view-profile", "account");
+        createClientMappersPage.form().save();
+        assertFlashMessageSuccess();
+        
+        //check
+        config = findClientMapperByName("hardcoded role").getConfig();
+        assertEquals("account.view-profile", config.get("role"));
+        
+        //delete
+        clientMapperPage.setMapperId(found.getId());
+        clientMapperPage.delete();
+        assertFlashMessageSuccess();
+        
+        //check
+        assertNull(findClientMapperByName("hardcoded role"));
+    }
+    
+    @Test
+    public void testOIDCHardcodedClaim() {
+        //create
+        clientMappersPage.mapperTable().createMapper();
+        setInitialValues("hardcoded claim", false, null);
+        createClientMappersPage.form().setMapperType(HARDCODED_CLAIM);
+        createClientMappersPage.form().setTokenClaimName("claim name");
+        createClientMappersPage.form().setTokenClaimValue("claim value");
+        createClientMappersPage.form().setClaimJSONType("long");
+        createClientMappersPage.form().setAddToIDToken(true);
+        createClientMappersPage.form().setAddToAccessToken(true);
+        createClientMappersPage.form().save();
+        assertFlashMessageSuccess();
+        
+        //check
+        ProtocolMapperRepresentation found = findClientMapperByName("hardcoded claim");
+        assertNotNull(found);
+        
+        assertFalse(found.isConsentRequired());
+        assertEquals("oidc-hardcoded-claim-mapper", found.getProtocolMapper());
+        
+        Map<String, String> config = found.getConfig();
+        assertEquals("true", config.get("id.token.claim"));
+        assertEquals("true", config.get("access.token.claim"));
+        assertEquals("claim name", config.get("claim.name"));
+        assertEquals("claim value", config.get("claim.value"));
+        assertEquals("long", config.get("jsonType.label"));
+    }
+    
+    @Test
+    public void testOIDCUserSessionNote() {
+        //create
+        clientMappersPage.mapperTable().createMapper();
+        setInitialValues("user session note", false, null);
+        createClientMappersPage.form().setMapperType(USER_SESSION_NOTE);
+        createClientMappersPage.form().setUserSessionNote("session note");
+        createClientMappersPage.form().setTokenClaimName("claim name");
+        createClientMappersPage.form().setClaimJSONType("int");
+        createClientMappersPage.form().setAddToIDToken(false);
+        createClientMappersPage.form().setAddToAccessToken(false);
+        createClientMappersPage.form().save();
+        assertFlashMessageSuccess();
+        
+        //check
+        ProtocolMapperRepresentation found = findClientMapperByName("user session note");
+        assertNotNull(found);
+        
+        assertFalse(found.isConsentRequired());
+        assertEquals("oidc-usersessionmodel-note-mapper", found.getProtocolMapper());
+        
+        Map<String, String> config = found.getConfig();
+        assertNull(config.get("id.token.claim"));
+        assertNull(config.get("access.token.claim"));
+        assertEquals("claim name", config.get("claim.name"));
+        assertEquals("session note", config.get("user.session.note"));
+        assertEquals("int", config.get("jsonType.label"));
+    }
+
+    @Test
+    public void testOIDCRoleName() {
+        //create
+        clientMappersPage.mapperTable().createMapper();
+        setInitialValues("role name", false, null);
+        createClientMappersPage.form().setMapperType(ROLE_NAME_MAPPER);
+        createClientMappersPage.form().setRole("offline_access");
+        createClientMappersPage.form().setNewRole("new role");
+        createClientMappersPage.form().save();
+        assertFlashMessageSuccess();
+        
+        //check
+        ProtocolMapperRepresentation found = findClientMapperByName("role name");
+        assertEquals("oidc-role-name-mapper", found.getProtocolMapper());
+        
+        Map<String, String> config = found.getConfig();
+        assertEquals("offline_access", config.get("role"));
+        assertEquals("new role", config.get("new.role.name"));
+    }
+
+    @Test
+    public void testOIDCUserAddress() {
+        //create
+        clientMappersPage.mapperTable().createMapper();
+        setInitialValues("user address", false, null);
+        createClientMappersPage.form().setMapperType(USERS_FULL_NAME);
+        createClientMappersPage.form().save();
+        assertFlashMessageSuccess();
+        
+        //check
+        ProtocolMapperRepresentation found = findClientMapperByName("user address");
+        assertEquals("oidc-full-name-mapper", found.getProtocolMapper());
+    }
+    
+    @Test
+    public void testOIDCUserFullName() {
+        //create
+        clientMappersPage.mapperTable().createMapper();
+        setInitialValues("user full name", false, null);
+        createClientMappersPage.form().setMapperType(USERS_FULL_NAME);
+        createClientMappersPage.form().save();
+        assertFlashMessageSuccess();
+        
+        //check
+        ProtocolMapperRepresentation found = findClientMapperByName("user full name");
+        assertEquals("oidc-full-name-mapper", found.getProtocolMapper());
+    }
+    
+    @Test
+    public void testOIDCUserAttribute() {
+        //create
+        clientMappersPage.mapperTable().createMapper();
+        setInitialValues("user attribute", false, null);
+        createClientMappersPage.form().setMapperType(USER_ATTRIBUTE);
+        createClientMappersPage.form().setUserAttribute("user attribute");
+        createClientMappersPage.form().setMultivalued(true);
+        createClientMappersPage.form().save();
+        assertFlashMessageSuccess();
+        
+        //check
+        ProtocolMapperRepresentation found = findClientMapperByName("user attribute");
+        assertEquals("oidc-usermodel-attribute-mapper", found.getProtocolMapper());
+        
+        Map<String, String> config = found.getConfig();
+        assertEquals("true", config.get("multivalued"));
+        assertEquals("user attribute", config.get("user.attribute"));
+    }
+
+    @Test
+    public void testOIDCUserProperty() {
+        //create
+        clientMappersPage.mapperTable().createMapper();
+        setInitialValues("user property", false, null);
+        createClientMappersPage.form().setMapperType(USER_PROPERTY);
+        createClientMappersPage.form().setProperty("property");
+        createClientMappersPage.form().save();
+        assertFlashMessageSuccess();
+        
+        //check
+        ProtocolMapperRepresentation found = findClientMapperByName("user property");
+        assertEquals("oidc-usermodel-property-mapper", found.getProtocolMapper());
+        
+        Map<String, String> config = found.getConfig();
+        assertEquals("property", config.get("user.attribute"));
+    }
+    
+    @Test
+    public void testOIDCGroupMembership() {
+        //create
+        clientMappersPage.mapperTable().createMapper();
+        setInitialValues("group membership", false, null);
+        createClientMappersPage.form().setMapperType(GROUP_MEMBERSHIP);
+        createClientMappersPage.form().setFullGroupPath(true);
+        createClientMappersPage.form().save();
+        assertFlashMessageSuccess();
+        
+        //check
+        ProtocolMapperRepresentation found = findClientMapperByName("group membership");
+        assertEquals("oidc-group-membership-mapper", found.getProtocolMapper());
+        
+        Map<String, String> config = found.getConfig();
+        assertEquals("true", config.get("full.path"));
+    }
+    
+    @Test
+    public void testOIDCEditMapper() {
+        //prepare data
+        ProtocolMapperRepresentation mapper = new ProtocolMapperRepresentation();
+        mapper.setName("mapper name");
+        mapper.setConsentRequired(true);
+        mapper.setConsentText("consent text");
+        mapper.setProtocol("openid-connect");
+        mapper.setProtocolMapper("oidc-usersessionmodel-note-mapper");
+        
+        Map<String, String> config = new HashMap<>();
+        config.put("access.token.claim", "true");
+        config.put("id.token.claim", "true");
+        config.put("claim.name", "claim name");
+        config.put("jsonType.label", "String");
+        config.put("user.session.note", "session note");
+        
+        mapper.setConfig(config);
+        
+        //insert data
+        testRealmResource().clients().get(id).getProtocolMappers().createMapper(mapper).close();
+        
+        //check form
+        clientMapperPage.setId(id);
+        String mapperId = findClientMapperByName("mapper name").getId();
+        clientMapperPage.setMapperId(mapperId);
+        clientMapperPage.navigateTo();
+        
+        assertEquals("openid-connect", clientMapperPage.form().getProtocol());
+        assertEquals(mapperId, clientMapperPage.form().getMapperId());
+        assertEquals("mapper name", clientMapperPage.form().getName());
+        assertTrue(clientMapperPage.form().isConsentRequired());
+        assertEquals("consent text", clientMapperPage.form().getConsentText());
+        assertEquals("User Session Note", clientMapperPage.form().getMapperType());
+        assertEquals("session note", clientMapperPage.form().getUserSessionNote());
+        assertEquals("claim name", clientMapperPage.form().getTokenClaimName());
+        assertEquals("String", clientMapperPage.form().getClaimJSONType());
+        assertTrue(clientMapperPage.form().isAddToIDToken());
+        assertTrue(clientMapperPage.form().isAddToAccessToken());
+        
+        //edit
+        clientMapperPage.form().setConsentRequired(false);
+        clientMapperPage.form().save();
+        assertFlashMessageSuccess();
+        
+        //check
+        assertFalse(findClientMapperByName("mapper name").isConsentRequired());
+    }
+    
+    @Test
+    public void testAddBuiltin() {
+        clientMappersPage.mapperTable().addBuiltin();
+        clientMappersPage.mapperTable().checkBuiltinMapper("locale");
+        clientMappersPage.mapperTable().clickAddSelectedBuiltinMapper();
+        assertFlashMessageSuccess();
+        
+        assertTrue("Builtin mapper \"locale\" should be present.", isMapperPresent("locale"));
+        
+        clientMappersPage.mapperTable().deleteMapper("locale");
+        modalDialog.confirmDeletion();
+        assertFlashMessageSuccess();
+        
+        assertFalse("Builtin mapper \"locale\" should not be present.", isMapperPresent("locale"));
+    }
+    
+    private boolean isMapperPresent(String name) {
+        List<ProtocolMapperRepresentation> mappers = testRealmResource().clients().get(id).getProtocolMappers().getMappers();
+        boolean found = false;
+        for (ProtocolMapperRepresentation mapper : mappers) {
+            if (name.equals(mapper.getName())) {
+                found = true;
+            }
+        }
+        return found;
+    }
+    
+    @Test
+    public void testCreateMapperInvalidValues() {
+        //empty mapper type
+        clientMappersPage.mapperTable().createMapper();
+        createClientMappersPage.form().save();
+        assertFlashMessageDanger();
+        
+        //empty name
+        createClientMappersPage.form().setMapperType(HARDCODED_ROLE);
+        createClientMappersPage.form().save();
+        assertFlashMessageDanger();
+        
+        createClientMappersPage.form().setName("");
+        createClientMappersPage.form().save();
+        assertFlashMessageDanger();
+        
+        createClientMappersPage.form().setName("name");
+        createClientMappersPage.form().setName("");
+        createClientMappersPage.form().save();
+        assertFlashMessageDanger();
+        
+        //existing name
+        createClientMappersPage.form().setName("email");
+        createClientMappersPage.form().save();
+        assertFlashMessageDanger();
+    }
+}
diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientRolesTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientRolesTest.java
index 7463c70..f22b13d 100644
--- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientRolesTest.java
+++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientRolesTest.java
@@ -9,9 +9,9 @@ import static org.junit.Assert.*;
 import org.junit.Before;
 import org.keycloak.representations.idm.ClientRepresentation;
 import org.keycloak.representations.idm.RoleRepresentation;
-import org.keycloak.testsuite.console.page.clients.ClientRole;
-import org.keycloak.testsuite.console.page.clients.ClientRoles;
-import org.keycloak.testsuite.console.page.clients.CreateClientRole;
+import org.keycloak.testsuite.console.page.clients.roles.ClientRole;
+import org.keycloak.testsuite.console.page.clients.roles.ClientRoles;
+import org.keycloak.testsuite.console.page.clients.roles.CreateClientRole;
 import org.keycloak.testsuite.console.page.users.User;
 import org.keycloak.testsuite.util.URLAssert;
 
@@ -41,7 +41,7 @@ public class ClientRolesTest extends AbstractClientTest {
         ClientRepresentation newClient = createClientRepresentation(TEST_CLIENT_ID, TEST_REDIRECT_URIS);
         testRealmResource().clients().create(newClient).close();
         
-        id = findClientRepByClientId(TEST_CLIENT_ID).getId();
+        id = findClientByClientId(TEST_CLIENT_ID).getId();
         clientPage.setId(id);
         clientRolePage.setId(id);
         clientRolesPage.setId(id);
diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientSettingsTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientSettingsTest.java
index 54782a8..85bc433 100644
--- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientSettingsTest.java
+++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientSettingsTest.java
@@ -53,7 +53,7 @@ public class ClientSettingsTest extends AbstractClientTest {
         assertFlashMessageSuccess();
 
         // read & verify
-        ClientRepresentation found = findClientRepByClientId(newClient.getClientId());
+        ClientRepresentation found = findClientByClientId(newClient.getClientId());
         assertNotNull("Client " + newClient.getClientId() + " was not found.", found);
         assertClientSettingsEqual(newClient, found);
         
@@ -80,14 +80,14 @@ public class ClientSettingsTest extends AbstractClientTest {
         clientSettingsPage.form().save();
         assertFlashMessageSuccess();
         
-        found = findClientRepByClientId(newClient.getClientId());
+        found = findClientByClientId(newClient.getClientId());
         assertNotNull("Client " + newClient.getClientId() + " was not found.", found);
         assertClientSettingsEqual(newClient, found);
 
         // delete
         clientPage.delete();
         assertFlashMessageSuccess();
-        found = findClientRepByClientId(newClient.getClientId());
+        found = findClientByClientId(newClient.getClientId());
         assertNull("Deleted client " + newClient.getClientId() + " was found.", found);
     }
 
@@ -98,7 +98,7 @@ public class ClientSettingsTest extends AbstractClientTest {
         createClient(newClient);
         assertFlashMessageSuccess();
 
-        ClientRepresentation found = findClientRepByClientId(newClient.getClientId());
+        ClientRepresentation found = findClientByClientId(newClient.getClientId());
         assertNotNull("Client " + newClient.getClientId() + " was not found.", found);
         assertClientSettingsEqual(newClient, found);
     }
@@ -112,7 +112,7 @@ public class ClientSettingsTest extends AbstractClientTest {
         createClient(newClient);
         assertFlashMessageSuccess();
 
-        ClientRepresentation found = findClientRepByClientId(newClient.getClientId());
+        ClientRepresentation found = findClientByClientId(newClient.getClientId());
         assertNotNull("Client " + newClient.getClientId() + " was not found.", found);
         assertClientSettingsEqual(newClient, found);
     }
@@ -129,7 +129,7 @@ public class ClientSettingsTest extends AbstractClientTest {
         createClient(newClient);
         assertFlashMessageSuccess();
 
-        ClientRepresentation found = findClientRepByClientId(newClient.getClientId());
+        ClientRepresentation found = findClientByClientId(newClient.getClientId());
         assertNotNull("Client " + newClient.getClientId() + " was not found.", found);
         assertClientSettingsEqual(newClient, found);
         assertClientSamlAttributes(getSAMLAttributes(), found.getAttributes());
diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientsTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientsTest.java
index c977dbe..14e690b 100644
--- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientsTest.java
+++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientsTest.java
@@ -21,8 +21,6 @@
  */
 package org.keycloak.testsuite.console.clients;
 
-import java.util.ArrayList;
-import java.util.List;
 import org.jboss.arquillian.graphene.page.Page;
 import static org.junit.Assert.*;
 import org.junit.Before;
@@ -30,8 +28,6 @@ import org.junit.Test;
 import org.keycloak.representations.idm.ClientRepresentation;
 import org.keycloak.testsuite.console.page.clients.settings.ClientSettings;
 import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlEquals;
-import org.openqa.selenium.By;
-import org.openqa.selenium.WebElement;
 
 /**
  *
@@ -49,7 +45,7 @@ public class ClientsTest extends AbstractClientTest {
         newClient = createClientRepresentation(TEST_CLIENT_ID, TEST_REDIRECT_URIS);
         testRealmResource().clients().create(newClient).close();
         
-        ClientRepresentation found = findClientRepByClientId(TEST_CLIENT_ID);
+        ClientRepresentation found = findClientByClientId(TEST_CLIENT_ID);
         assertNotNull("Client " + TEST_CLIENT_ID + " was not found.", found);
         clientSettingsPage.setId(found.getId());
     }
@@ -71,93 +67,7 @@ public class ClientsTest extends AbstractClientTest {
         modalDialog.confirmDeletion();
         assertFlashMessageSuccess();
         
-        ClientRepresentation found = findClientRepByClientId(TEST_CLIENT_ID);
+        ClientRepresentation found = findClientByClientId(TEST_CLIENT_ID);
         assertNull("Deleted client " + TEST_CLIENT_ID + " was found.", found);
     }
-    
-    @Test
-    public void tabs() {
-        clientSettingsPage.navigateTo();
-        
-        //oidc-confidential
-        WebElement tabs = clientPage.tabs().getTabs();
-        List<String> visibleTabs = new ArrayList<>();
-        visibleTabs.add("Settings");
-        visibleTabs.add("Credentials");
-        visibleTabs.add("Roles");
-        visibleTabs.add("Mappers");
-        visibleTabs.add("Scope");
-        visibleTabs.add("Revocation");
-        visibleTabs.add("Sessions");
-        visibleTabs.add("Offline Access");
-        visibleTabs.add("Clustering");
-        visibleTabs.add("Installation");
-        
-        List<String> invisibleTabs = new ArrayList<>();
-        invisibleTabs.add("SAML Keys");
-        invisibleTabs.add("Service Account Roles");
-        
-        assertVisibilityOfTabs(tabs, visibleTabs, invisibleTabs);
-        
-        //oidc-public
-        newClient.setPublicClient(true);
-        clientSettingsPage.form().setAccessType(newClient);
-        clientSettingsPage.form().save();
-        assertFlashMessageSuccess();
-        
-        tabs = clientPage.tabs().getTabs();
-        visibleTabs.clear();
-        invisibleTabs.clear();
-        
-        visibleTabs.add("Settings");
-        visibleTabs.add("Roles");
-        visibleTabs.add("Mappers");
-        visibleTabs.add("Scope");
-        visibleTabs.add("Revocation");
-        visibleTabs.add("Sessions");
-        visibleTabs.add("Offline Access");
-        visibleTabs.add("Installation");
-        
-        invisibleTabs.add("Credentials");
-        invisibleTabs.add("SAML Keys");
-        invisibleTabs.add("Clustering");
-        invisibleTabs.add("Service Account Roles");
-        
-        assertVisibilityOfTabs(tabs, visibleTabs, invisibleTabs);
-        
-        //oidc-bearer-only
-        newClient.setPublicClient(false);
-        newClient.setBearerOnly(true);
-        clientSettingsPage.form().setAccessType(newClient);
-        clientSettingsPage.form().save();
-        assertFlashMessageSuccess();
-        
-        tabs = clientPage.tabs().getTabs();
-        visibleTabs.clear();
-        invisibleTabs.clear();
-        
-        visibleTabs.add("Settings");
-        visibleTabs.add("Credentials");
-        visibleTabs.add("Roles");
-        visibleTabs.add("Revocation");
-        visibleTabs.add("Clustering");
-        visibleTabs.add("Installation");
-        
-        invisibleTabs.add("SAML Keys");
-        invisibleTabs.add("Mappers");
-        invisibleTabs.add("Scope");
-        invisibleTabs.add("Sessions");
-        invisibleTabs.add("Service Account Roles");
-        
-        assertVisibilityOfTabs(tabs, visibleTabs, invisibleTabs);
-    }
-    
-    private void assertVisibilityOfTabs(WebElement tabs, List<String> visible, List<String> invisible) {
-        for (String visibleLink : visible) {
-            assertTrue(tabs.findElement(By.linkText(visibleLink)).isDisplayed());
-        }
-        for (String invisibleLink : invisible) {
-            assertTrue(tabs.findElements(By.linkText(invisibleLink)).isEmpty());
-        }
-    }
 }