net.nemerosa.ontrack.acceptance.browser.Browser.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ontrack-acceptance Show documentation
Show all versions of ontrack-acceptance Show documentation
Ontrack module: ontrack-acceptance
The newest version!
package net.nemerosa.ontrack.acceptance.browser
import org.apache.commons.lang3.reflect.ConstructorUtils
class Browser {
@Delegate
private final Configuration configuration;
Browser(Configuration configuration) {
this.configuration = configuration;
}
Configuration getConfiguration() {
configuration
}
def P goTo(Class
pageClass, Map parameters = [:], boolean wait = true) {
P page = page(pageClass)
String path = page.getPath(parameters);
configuration.goTo(path);
if (wait) {
page.waitFor();
}
return page;
}
def P at(Class
pageClass) {
P page = page(pageClass)
page.waitFor()
page
}
def
P page(Class
pageClass) {
P page;
try {
page = ConstructorUtils.invokeExactConstructor(pageClass, this);
} catch (Exception e) {
throw new CannotBuildPageException(pageClass, e);
}
page
}
}