KEYCLOAK-3437 Add User Federation Console UI test
This commit is contained in:
parent
ba076ad159
commit
be83e2fb6b
3 changed files with 98 additions and 3 deletions
|
@ -45,6 +45,10 @@ public class KerberosUserProviderForm extends Form {
|
|||
setInputValue(consoleDisplayNameInput, name);
|
||||
}
|
||||
|
||||
public String getConsoleDisplayNameInput() {
|
||||
return getInputValue(consoleDisplayNameInput);
|
||||
}
|
||||
|
||||
public void setPriorityInput(Integer priority) {
|
||||
setInputValue(priorityInput, String.valueOf(priority));
|
||||
}
|
||||
|
|
|
@ -2,13 +2,18 @@ package org.keycloak.testsuite.console.page.federation;
|
|||
|
||||
import org.jboss.arquillian.graphene.findby.FindByJQuery;
|
||||
import org.keycloak.testsuite.console.page.AdminConsoleRealm;
|
||||
import org.keycloak.testsuite.console.page.fragment.DataTable;
|
||||
import org.keycloak.testsuite.console.page.fragment.ModalDialog;
|
||||
import org.keycloak.testsuite.util.UIUtils;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
import org.openqa.selenium.support.ui.Select;
|
||||
|
||||
import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;
|
||||
|
||||
/**
|
||||
* Created by fkiss.
|
||||
* @author fkiss
|
||||
* @author Vaclav Muzikar <vmuzikar@redhat.com>
|
||||
*/
|
||||
public class UserFederation extends AdminConsoleRealm {
|
||||
|
||||
|
@ -20,9 +25,37 @@ public class UserFederation extends AdminConsoleRealm {
|
|||
@FindByJQuery("select[ng-model*='selectedProvider']")
|
||||
private Select addProviderSelect;
|
||||
|
||||
public void addProvider(String provider) {
|
||||
waitUntilElement(By.cssSelector("select[ng-model*='selectedProvider']")).is().present();
|
||||
@FindBy(xpath = "//div[./h1/span[text()='User Federation']]/table")
|
||||
private FederationsTable federationsTable;
|
||||
|
||||
public FederationsTable table() {
|
||||
return federationsTable;
|
||||
}
|
||||
|
||||
public void addFederation(String provider) {
|
||||
addProviderSelect.selectByVisibleText(provider);
|
||||
}
|
||||
|
||||
public boolean hasProvider(String provider) {
|
||||
return UIUtils.selectContainsOption(addProviderSelect, provider);
|
||||
}
|
||||
|
||||
public class FederationsTable extends DataTable {
|
||||
@FindBy(xpath = "//div[@class='modal-dialog']")
|
||||
private ModalDialog modalDialog;
|
||||
|
||||
public void editFederation(String federation) {
|
||||
clickRowActionButton(getRowByLinkText(federation), "Edit");
|
||||
}
|
||||
|
||||
public void removeFederation(String federation) {
|
||||
clickRowActionButton(getRowByLinkText(federation), "Delete");
|
||||
modalDialog.confirmDeletion();
|
||||
}
|
||||
|
||||
public int getFederationsCount() {
|
||||
return rows().size();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
package org.keycloak.testsuite.console.federation;
|
||||
|
||||
import org.jboss.arquillian.graphene.page.Page;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.keycloak.testsuite.console.AbstractConsoleTest;
|
||||
import org.keycloak.testsuite.console.page.federation.CreateKerberosUserProvider;
|
||||
import org.keycloak.testsuite.console.page.federation.UserFederation;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @author Vaclav Muzikar <vmuzikar@redhat.com>
|
||||
*/
|
||||
public class UserFederationTest extends AbstractConsoleTest {
|
||||
@Page
|
||||
private UserFederation userFederationPage;
|
||||
|
||||
@Page
|
||||
private CreateKerberosUserProvider createKerberosUserProviderPage;
|
||||
|
||||
@Before
|
||||
public void beforeUserFederationTest() {
|
||||
userFederationPage.navigateTo();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void availableProviders() {
|
||||
assertTrue(userFederationPage.hasProvider("ldap"));
|
||||
assertTrue(userFederationPage.hasProvider("kerberos"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addRemoveFederation() {
|
||||
final String federationName = "KerberosProvider";
|
||||
|
||||
userFederationPage.addFederation("kerberos");
|
||||
assertTrue(createKerberosUserProviderPage.isCurrent());
|
||||
|
||||
createKerberosUserProviderPage.form().setConsoleDisplayNameInput(federationName);
|
||||
createKerberosUserProviderPage.form().setKerberosRealmInput("KEYCLOAK.ORG");
|
||||
createKerberosUserProviderPage.form().setServerPrincipalInput("HTTP/localhost@KEYCLOAK.ORG");
|
||||
createKerberosUserProviderPage.form().setKeyTabInput("http.keytab");
|
||||
createKerberosUserProviderPage.form().save();
|
||||
assertAlertSuccess();
|
||||
userFederationPage.navigateTo();
|
||||
|
||||
assertEquals(1, userFederationPage.table().getFederationsCount());
|
||||
|
||||
userFederationPage.table().editFederation(federationName);
|
||||
assertEquals(federationName, createKerberosUserProviderPage.form().getConsoleDisplayNameInput());
|
||||
userFederationPage.navigateTo();
|
||||
|
||||
userFederationPage.table().removeFederation(federationName);
|
||||
assertEquals(0, userFederationPage.table().getFederationsCount());
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue