/sitebricks-acceptance-tests/src/test/java/com/google/sitebricks/acceptance/page/DecoratorPage.java

http://github.com/dhanji/sitebricks · Java · 36 lines · 29 code · 7 blank · 0 comment · 0 complexity · 380b0eede9a0d0e6d2e43b78cc6be111 MD5 · raw file

  1. package com.google.sitebricks.acceptance.page;
  2. import org.openqa.selenium.WebDriver;
  3. import org.openqa.selenium.support.PageFactory;
  4. import com.google.sitebricks.acceptance.util.AcceptanceTest;
  5. public class DecoratorPage {
  6. private WebDriver driver;
  7. public DecoratorPage(WebDriver driver) {
  8. this.driver = driver;
  9. }
  10. public boolean hasBasePageText() {
  11. return driver.getPageSource().contains("Text defined in");
  12. }
  13. public boolean hasBasePageVariable() {
  14. return driver.getPageSource().contains("from the superclass");
  15. }
  16. public boolean hasSubclassVariableInTemplate() {
  17. return driver.getPageSource().contains("This comes from the subclass");
  18. }
  19. public boolean hasSubclassVariable() {
  20. return driver.getPageSource().contains("very cool");
  21. }
  22. public boolean hasSubclassText() {
  23. return driver.getPageSource().contains("This is in the extension");
  24. }
  25. public static DecoratorPage open(WebDriver driver) {
  26. driver.get(AcceptanceTest.baseUrl() + "/template");
  27. return PageFactory.initElements(driver, DecoratorPage.class);
  28. }
  29. }