PageRenderTime 40ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/src/main/java/RemoteTestedProduct.java

https://bitbucket.org/farmas/studio-workflow-tester
Java | 64 lines | 50 code | 11 blank | 3 comment | 0 complexity | eab1e996ff77e05b117c4faf1f9163f0 MD5 | raw file
  1. import com.atlassian.pageobjects.*;
  2. import com.atlassian.pageobjects.binder.InjectPageBinder;
  3. import com.atlassian.pageobjects.binder.StandardModule;
  4. import com.atlassian.pageobjects.elements.ElementModule;
  5. import com.atlassian.pageobjects.elements.timeout.TimeoutsModule;
  6. import com.atlassian.webdriver.AtlassianWebDriverModule;
  7. import com.atlassian.webdriver.pageobjects.DefaultWebDriverTester;
  8. import com.atlassian.webdriver.pageobjects.WebDriverTester;
  9. /**
  10. * TODO: Document this class / interface here
  11. */
  12. public class RemoteTestedProduct implements TestedProduct<WebDriverTester>
  13. {
  14. private final WebDriverTester webDriverTester;
  15. private final ProductInstance productInstance;
  16. private final PageBinder pageBinder;
  17. public RemoteTestedProduct(TestedProductFactory.TesterFactory<WebDriverTester> testerFactory, ProductInstance productInstance)
  18. {
  19. this.webDriverTester = new DefaultWebDriverTester();
  20. this.productInstance = productInstance;
  21. this.pageBinder = new InjectPageBinder(productInstance, webDriverTester, new StandardModule(this), new AtlassianWebDriverModule(this),
  22. new ElementModule(), new TimeoutsModule());
  23. }
  24. public <P extends Page> P visit(Class<P> pClass, Object... objects) {
  25. return pageBinder.navigateToAndBind(pClass, objects);
  26. }
  27. public PageBinder getPageBinder() {
  28. return this.pageBinder;
  29. }
  30. public ProductInstance getProductInstance() {
  31. return this.productInstance;
  32. }
  33. public WebDriverTester getTester() {
  34. return this.webDriverTester;
  35. }
  36. public static RemoteTestedProduct create(final String baseUrl)
  37. {
  38. return TestedProductFactory.create(RemoteTestedProduct.class, new ProductInstance(){
  39. public String getBaseUrl() {
  40. return baseUrl;
  41. }
  42. public int getHttpPort() {
  43. return 0;
  44. }
  45. public String getContextPath() {
  46. return null;
  47. }
  48. public String getInstanceId() {
  49. return null;
  50. }
  51. }, null);
  52. }
  53. }