/src/main/java/RemoteTestedProduct.java
Java | 64 lines | 50 code | 11 blank | 3 comment | 0 complexity | eab1e996ff77e05b117c4faf1f9163f0 MD5 | raw file
- import com.atlassian.pageobjects.*;
- import com.atlassian.pageobjects.binder.InjectPageBinder;
- import com.atlassian.pageobjects.binder.StandardModule;
- import com.atlassian.pageobjects.elements.ElementModule;
- import com.atlassian.pageobjects.elements.timeout.TimeoutsModule;
- import com.atlassian.webdriver.AtlassianWebDriverModule;
- import com.atlassian.webdriver.pageobjects.DefaultWebDriverTester;
- import com.atlassian.webdriver.pageobjects.WebDriverTester;
-
- /**
- * TODO: Document this class / interface here
- */
- public class RemoteTestedProduct implements TestedProduct<WebDriverTester>
- {
- private final WebDriverTester webDriverTester;
- private final ProductInstance productInstance;
- private final PageBinder pageBinder;
-
- public RemoteTestedProduct(TestedProductFactory.TesterFactory<WebDriverTester> testerFactory, ProductInstance productInstance)
- {
- this.webDriverTester = new DefaultWebDriverTester();
- this.productInstance = productInstance;
-
- this.pageBinder = new InjectPageBinder(productInstance, webDriverTester, new StandardModule(this), new AtlassianWebDriverModule(this),
- new ElementModule(), new TimeoutsModule());
- }
-
- public <P extends Page> P visit(Class<P> pClass, Object... objects) {
- return pageBinder.navigateToAndBind(pClass, objects);
- }
-
- public PageBinder getPageBinder() {
- return this.pageBinder;
- }
-
- public ProductInstance getProductInstance() {
- return this.productInstance;
- }
-
- public WebDriverTester getTester() {
- return this.webDriverTester;
- }
-
- public static RemoteTestedProduct create(final String baseUrl)
- {
- return TestedProductFactory.create(RemoteTestedProduct.class, new ProductInstance(){
- public String getBaseUrl() {
- return baseUrl;
- }
-
- public int getHttpPort() {
- return 0;
- }
-
- public String getContextPath() {
- return null;
- }
-
- public String getInstanceId() {
- return null;
- }
- }, null);
- }
- }