PageRenderTime 28ms CodeModel.GetById 10ms app.highlight 14ms RepoModel.GetById 1ms app.codeStats 0ms

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