Merge pull request #3622 from vramik/KEYCLOAK-4022

KEYCLOAK-4022 added missing test
This commit is contained in:
Stan Silvert 2016-12-07 14:10:13 -05:00 committed by GitHub
commit 7868152ffe
2 changed files with 34 additions and 1 deletions

View file

@ -6,6 +6,7 @@ import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import static org.keycloak.testsuite.console.page.fragment.Breadcrumb.BREADCRUMB_XPATH;
import org.openqa.selenium.NoSuchElementException;
/**
*
@ -73,6 +74,8 @@ public class Client extends Clients {
private WebElement sessionsLink;
@FindBy(linkText = "Installation")
private WebElement installationLink;
@FindBy(linkText = "Service Account Roles")
private WebElement serviceAccountRoles;
public void settings() {
settingsLink.click();
@ -102,6 +105,14 @@ public class Client extends Clients {
installationLink.click();
}
public boolean isServiceAccountRolesDisplayed() {
try {
return serviceAccountRoles.isDisplayed();
} catch (NoSuchElementException ex) {
}
return false;
}
public WebElement getTabs() {
return tabs;
}

View file

@ -22,6 +22,7 @@ import org.junit.Test;
import org.keycloak.representations.idm.ClientRepresentation;
import org.keycloak.testsuite.console.page.clients.settings.ClientSettings;
import org.keycloak.testsuite.util.Timer;
import org.openqa.selenium.By;
import javax.ws.rs.core.Response;
import java.util.ArrayList;
@ -32,7 +33,6 @@ import static org.keycloak.testsuite.auth.page.login.Login.OIDC;
import static org.keycloak.testsuite.auth.page.login.Login.SAML;
import static org.keycloak.testsuite.console.page.clients.settings.ClientSettingsForm.OidcAccessType.BEARER_ONLY;
import static org.keycloak.testsuite.console.page.clients.settings.ClientSettingsForm.OidcAccessType.CONFIDENTIAL;
import static org.keycloak.testsuite.console.page.clients.settings.ClientSettingsForm.SAMLClientSettingsForm.*;
import static org.keycloak.testsuite.util.WaitUtils.pause;
/**
@ -109,6 +109,28 @@ public class ClientSettingsTest extends AbstractClientTest {
assertClientSettingsEqual(newClient, found);
}
//KEYCLOAK-4022
@Test
public void testOIDCConfidentialServiceAccountRolesTab() {
newClient = createClientRep("oidc-service-account-tab", OIDC);
createClient(newClient);
newClient.setRedirectUris(TEST_REDIRECT_URIs);
newClient.setPublicClient(false);
clientSettingsPage.form().setAccessType(CONFIDENTIAL);
clientSettingsPage.form().setServiceAccountsEnabled(true);
assertTrue(clientSettingsPage.form().isServiceAccountsEnabled());
//check if Service Account Roles tab is not present
assertFalse(clientSettingsPage.tabs().isServiceAccountRolesDisplayed());
clientSettingsPage.form().setRedirectUris(TEST_REDIRECT_URIs);
clientSettingsPage.form().save();
//should be there now
assertTrue(clientSettingsPage.tabs().getTabs().findElement(By.linkText("Service Account Roles")).isDisplayed());
}
@Test
public void saveOIDCConfidentialWithoutRedirectURIs() {
newClient = createClientRep("oidc-confidential", OIDC);