View Javadoc

1   package com.atlassian.pageobjects.elements.test.pageobjects.component;
2   
3   import com.atlassian.pageobjects.PageBinder;
4   import com.atlassian.pageobjects.binder.Init;
5   import com.atlassian.pageobjects.components.ActivatedComponent;
6   import com.atlassian.pageobjects.components.aui.AuiDropDownMenu;
7   import com.atlassian.pageobjects.elements.PageElement;
8   import com.atlassian.pageobjects.elements.test.pageobjects.page.JQueryPage;
9   import com.atlassian.webdriver.AtlassianWebDriver;
10  import org.openqa.selenium.By;
11  
12  import javax.inject.Inject;
13  import java.util.List;
14  
15  /**
16   * Represents the Links menu that is present in the AUIPage. This page is generated by the AUIServlet plugin that is
17   * installed in the RefApp
18   */
19  public class LinksMenu implements ActivatedComponent<LinksMenu>
20  {
21      @Inject
22      private AtlassianWebDriver driver;
23  
24      @Inject
25      private PageBinder pageBinder;
26  
27      private AuiDropDownMenu auiMenu;
28  
29      @Init
30      public void initialize()
31      {
32          auiMenu = pageBinder.bind(AuiDropDownMenu.class, By.id("dropDown-standard"));
33      }
34  
35      public PageElement getTrigger()
36      {
37          return auiMenu.getTrigger();
38      }
39  
40      public PageElement getView()
41      {
42          return auiMenu.getView();
43      }
44  
45      public LinksMenu open()
46      {
47          auiMenu.open();
48          return this;
49      }
50  
51      public LinksMenu close()
52      {
53          auiMenu.close();
54          return this;
55      }
56  
57      public boolean isOpen()
58      {
59          return auiMenu.isOpen();
60      }
61  
62      public List<String> getItems()
63      {
64          return auiMenu.getItems();
65      }
66  
67      public JQueryPage gotoJQueryPage()
68      {
69          getView().find(By.linkText("JQuery Page")).click();
70          return pageBinder.bind(JQueryPage.class);
71      }
72  }