/src/test/java/it/ToolsMenu.java

https://bitbucket.org/xavist/easyfollow-confluence-plugin · Java · 48 lines · 37 code · 10 blank · 1 comment · 1 complexity · 48f2adf336adce091c427e1319c71658 MD5 · raw file

  1. package it;
  2. import com.atlassian.confluence.pageobjects.component.PageComponent;
  3. import com.atlassian.confluence.pageobjects.component.menu.AUIDropdownMenu;
  4. import com.atlassian.pageobjects.elements.ElementBy;
  5. import com.atlassian.pageobjects.elements.PageElement;
  6. import com.atlassian.pageobjects.elements.PageElementFinder;
  7. import com.atlassian.webdriver.utils.by.ByJquery;
  8. import org.openqa.selenium.By;
  9. import javax.inject.Inject;
  10. public class ToolsMenu extends AUIDropdownMenu implements PageComponent
  11. {
  12. @Inject
  13. protected PageElementFinder finder;
  14. @ElementBy(id="action-menu-link")
  15. protected PageElement tools;
  16. public ToolsMenu()
  17. {
  18. super(ByJquery.$("#action-menu-link").parent("li"));
  19. }
  20. public ToolsMenu open()
  21. {
  22. if (!isOpen())
  23. {
  24. tools.click();
  25. }
  26. // Wait until the menu has finished loading items
  27. driver.waitUntilElementIsVisibleAt(By.className("ajs-drop-down"), menuContainer);
  28. return this;
  29. }
  30. public boolean canFollow()
  31. {
  32. return finder.find(By.id("easyfollow-follow-label-action")).isPresent();
  33. }
  34. public boolean canUnfollow()
  35. {
  36. return finder.find(By.id("easyfollow-unfollow-label-action")).isPresent();
  37. }
  38. }