use of org.keycloak.testsuite.pages.AbstractPage in project keycloak by keycloak.
the class AbstractX509AuthenticationTest method replaceDefaultWebDriver.
public void replaceDefaultWebDriver(WebDriver driver) {
this.driver = driver;
DroneUtils.addWebDriver(driver);
List<Field> allFields = new ArrayList<>();
// Add all fields of this class and superclasses
Class<?> testClass = this.getClass();
while (AbstractX509AuthenticationTest.class.isAssignableFrom(testClass)) {
allFields.addAll(Arrays.asList(testClass.getDeclaredFields()));
allFields.addAll(Arrays.asList(testClass.getFields()));
testClass = testClass.getSuperclass();
}
for (Field f : allFields) {
if (f.getAnnotation(Page.class) != null) {
try {
AbstractPage page = (AbstractPage) f.get(this);
page.setDriver(driver);
} catch (IllegalAccessException e) {
throw new IllegalStateException("Could not replace the driver in " + f, e);
}
}
}
}
Aggregations