1 package com.atlassian.webdriver.it.pageobjects; 2 3 import com.atlassian.pageobjects.Defaults; 4 import com.atlassian.pageobjects.Page; 5 import com.atlassian.pageobjects.PageBinder; 6 import com.atlassian.pageobjects.ProductInstance; 7 import com.atlassian.pageobjects.TestedProduct; 8 import com.atlassian.pageobjects.TestedProductFactory; 9 import com.atlassian.pageobjects.binder.BrowserModule; 10 import com.atlassian.pageobjects.binder.InjectPageBinder; 11 import com.atlassian.pageobjects.binder.LoggerModule; 12 import com.atlassian.pageobjects.binder.StandardModule; 13 import com.atlassian.webdriver.AtlassianWebDriverModule; 14 import com.atlassian.webdriver.pageobjects.DefaultWebDriverTester; 15 import com.atlassian.webdriver.pageobjects.WebDriverTester; 16 17 import static com.google.common.base.Preconditions.checkNotNull; 18 19 @Defaults(instanceId = "testapp", contextPath = "/", httpPort = 5990) 20 public class SimpleTestedProduct implements TestedProduct<WebDriverTester> 21 { 22 private final PageBinder pageBinder; 23 private final WebDriverTester webDriverTester; 24 private final ProductInstance productInstance; 25 26 public SimpleTestedProduct(TestedProductFactory.TesterFactory<WebDriverTester> testerFactory, ProductInstance productInstance) 27 { 28 this.productInstance = checkNotNull(productInstance); 29 30 this.webDriverTester = new DefaultWebDriverTester(); 31 this.pageBinder = new InjectPageBinder(productInstance, webDriverTester, 32 new StandardModule(this), 33 new AtlassianWebDriverModule(this), 34 new BrowserModule(), 35 new LoggerModule(SimpleTestedProduct.class)); 36 } 37 38 public <P extends Page> P visit(Class<P> pageClass, Object... args) 39 { 40 return pageBinder.navigateToAndBind(pageClass, args); 41 } 42 43 public PageBinder getPageBinder() 44 { 45 return pageBinder; 46 } 47 48 public ProductInstance getProductInstance() 49 { 50 return productInstance; 51 } 52 53 public WebDriverTester getTester() 54 { 55 return webDriverTester; 56 } 57 }