Add LDAP vendors test

This commit is contained in:
Vaclav Muzikar 2016-02-25 17:52:11 +01:00
parent a35aa47f27
commit cd063c6a36
2 changed files with 37 additions and 0 deletions

View file

@ -11,6 +11,9 @@ import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.Select;
import java.util.ArrayList;
import java.util.List;
/**
* @author fkiss, pdrozd
*/
@ -181,6 +184,21 @@ public class LdapUserProviderForm extends Form {
vendorSelect.selectByVisibleText(vendor);
}
public List<String> getVendors() {
waitUntilElement(By.id("vendor")).is().present();
List<WebElement> vendorsElements = vendorSelect.getOptions();
List<String> vendorsString = new ArrayList<>();
for (WebElement vendorElement : vendorsElements) {
String text = vendorElement.getText();
if (text.equals("")) {continue;}
vendorsString.add(text);
}
return vendorsString;
}
public void selectAuthenticationType(String authenticationType) {
waitUntilElement(By.id("authType")).is().present();
authTypeSelect.selectByVisibleText(authenticationType);

View file

@ -1,9 +1,12 @@
package org.keycloak.testsuite.console.federation;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.List;
import java.util.Properties;
import org.apache.commons.configuration.ConfigurationException;
import org.jboss.arquillian.graphene.page.Page;
import org.junit.Ignore;
import org.junit.Test;
@ -12,6 +15,7 @@ import org.keycloak.representations.idm.UserFederationProviderRepresentation;
import org.keycloak.testsuite.console.AbstractConsoleTest;
import org.keycloak.testsuite.console.page.federation.CreateLdapUserProvider;
import org.keycloak.util.ldap.LDAPEmbeddedServer;
import org.openqa.selenium.WebElement;
/**
* @author fkiss, pdrozd
@ -141,6 +145,21 @@ public class LdapUserFederationTest extends AbstractConsoleTest {
}
}
@Test
public void checkVendors() throws ConfigurationException {
createLdapUserProvider.navigateTo();
List<String> vendorsExpected = (List<String>) (List<?>) getConstantsProperties().getList("ldap-vendors");
List<String> vendorsActual = createLdapUserProvider.form().getVendors();
int vendorsExpectedSize = vendorsExpected.size();
int vendorsActualSize = vendorsActual.size();
assertTrue("Expected vendors count: " + vendorsExpectedSize + "; actual count: " + vendorsActualSize,
vendorsExpectedSize == vendorsActualSize);
assertTrue("Vendors list doesn't match", vendorsExpected.containsAll(vendorsActual));
}
private void assertLdapProviderSetting(UserFederationProviderRepresentation ufpr, String name, int priority,
String editMode, String syncRegistrations, String vendor, String searchScope, String connectionPooling,
String pagination, String enableAccountAfterPasswordUpdate) {